Java Code Examples for com.facebook.react.bridge.MemoryPressure

The following are top voted examples for showing how to use com.facebook.react.bridge.MemoryPressure. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: RNLearn_Project1   File: CatalystInstanceImpl.java   View source code 6 votes vote down vote up
@Override
public void handleMemoryPressure(MemoryPressure level) {
  if (mDestroyed) {
    return;
  }
  switch (level) {
    case UI_HIDDEN:
      handleMemoryPressureUiHidden();
      break;
    case MODERATE:
      handleMemoryPressureModerate();
      break;
    case CRITICAL:
      handleMemoryPressureCritical();
      break;
  }
}
 
Example 2
Project: RNLearn_Project1   File: CatalystInstanceImpl.java   View source code 6 votes vote down vote up
@Override
public void handleMemoryPressure(MemoryPressure level) {
  if (mDestroyed) {
    return;
  }
  switch (level) {
    case UI_HIDDEN:
      handleMemoryPressureUiHidden();
      break;
    case MODERATE:
      handleMemoryPressureModerate();
      break;
    case CRITICAL:
      handleMemoryPressureCritical();
      break;
  }
}
 
Example 3
Project: Ironman   File: CatalystInstanceImpl.java   View source code 6 votes vote down vote up
@Override
public void handleMemoryPressure(MemoryPressure level) {
  if (mDestroyed) {
    return;
  }
  switch(level) {
    case UI_HIDDEN:
      handleMemoryPressureUiHidden();
      break;
    case MODERATE:
      handleMemoryPressureModerate();
      break;
    case CRITICAL:
      handleMemoryPressureCritical();
      break;
  }
}
 
Example 4
Project: RNLearn_Project1   File: MemoryPressureRouter.java   View source code 5 votes vote down vote up
private void trimMemory(int level) {
  if (level >= TRIM_MEMORY_COMPLETE) {
    dispatchMemoryPressure(MemoryPressure.CRITICAL);
  } else if (level >= TRIM_MEMORY_BACKGROUND || level == TRIM_MEMORY_RUNNING_CRITICAL) {
    dispatchMemoryPressure(MemoryPressure.MODERATE);
  } else if (level == TRIM_MEMORY_UI_HIDDEN) {
    dispatchMemoryPressure(MemoryPressure.UI_HIDDEN);
  }
}
 
Example 5
Project: RNLearn_Project1   File: MemoryPressureRouter.java   View source code 5 votes vote down vote up
private void dispatchMemoryPressure(MemoryPressure level) {
  // copy listeners array to avoid ConcurrentModificationException if any of the listeners remove
  // themselves in handleMemoryPressure()
  MemoryPressureListener[] listeners =
    mListeners.toArray(new MemoryPressureListener[mListeners.size()]);
  for (MemoryPressureListener listener : listeners) {
    listener.handleMemoryPressure(level);
  }
}
 
Example 6
Project: RNLearn_Project1   File: MemoryPressureRouter.java   View source code 5 votes vote down vote up
private void trimMemory(int level) {
  if (level >= TRIM_MEMORY_COMPLETE) {
    dispatchMemoryPressure(MemoryPressure.CRITICAL);
  } else if (level >= TRIM_MEMORY_BACKGROUND || level == TRIM_MEMORY_RUNNING_CRITICAL) {
    dispatchMemoryPressure(MemoryPressure.MODERATE);
  } else if (level == TRIM_MEMORY_UI_HIDDEN) {
    dispatchMemoryPressure(MemoryPressure.UI_HIDDEN);
  }
}
 
Example 7
Project: RNLearn_Project1   File: MemoryPressureRouter.java   View source code 5 votes vote down vote up
private void dispatchMemoryPressure(MemoryPressure level) {
  // copy listeners array to avoid ConcurrentModificationException if any of the listeners remove
  // themselves in handleMemoryPressure()
  MemoryPressureListener[] listeners =
    mListeners.toArray(new MemoryPressureListener[mListeners.size()]);
  for (MemoryPressureListener listener : listeners) {
    listener.handleMemoryPressure(level);
  }
}
 
Example 8
Project: ReactNativeSignatureExample   File: MemoryPressureRouter.java   View source code 5 votes vote down vote up
private void trimMemory(int level) {
  if (level >= ComponentCallbacks2.TRIM_MEMORY_COMPLETE) {
    dispatchMemoryPressure(MemoryPressure.CRITICAL);
  } else if (level >= TRIM_MEMORY_BACKGROUND || level == TRIM_MEMORY_RUNNING_CRITICAL) {
    dispatchMemoryPressure(MemoryPressure.MODERATE);
  }
}
 
Example 9
Project: ReactNativeSignatureExample   File: MemoryPressureRouter.java   View source code 5 votes vote down vote up
private void dispatchMemoryPressure(MemoryPressure level) {
  // copy listeners array to avoid ConcurrentModificationException if any of the listeners remove
  // themselves in handleMemoryPressure()
  MemoryPressureListener[] listeners =
    mListeners.toArray(new MemoryPressureListener[mListeners.size()]);
  for (MemoryPressureListener listener : listeners) {
    listener.handleMemoryPressure(level);
  }
}
 
Example 10
Project: react-native-ibeacon-android   File: MemoryPressureRouter.java   View source code 5 votes vote down vote up
private void trimMemory(int level) {
  if (level >= ComponentCallbacks2.TRIM_MEMORY_COMPLETE) {
    dispatchMemoryPressure(MemoryPressure.CRITICAL);
  } else if (level >= TRIM_MEMORY_BACKGROUND || level == TRIM_MEMORY_RUNNING_CRITICAL) {
    dispatchMemoryPressure(MemoryPressure.MODERATE);
  }
}
 
Example 11
Project: react-native-ibeacon-android   File: MemoryPressureRouter.java   View source code 5 votes vote down vote up
private void dispatchMemoryPressure(MemoryPressure level) {
  // copy listeners array to avoid ConcurrentModificationException if any of the listeners remove
  // themselves in handleMemoryPressure()
  MemoryPressureListener[] listeners =
    mListeners.toArray(new MemoryPressureListener[mListeners.size()]);
  for (MemoryPressureListener listener : listeners) {
    listener.handleMemoryPressure(level);
  }
}
 
Example 12
Project: react-native-box-loaders   File: MemoryPressureRouter.java   View source code 5 votes vote down vote up
private void trimMemory(int level) {
  if (level >= ComponentCallbacks2.TRIM_MEMORY_COMPLETE) {
    dispatchMemoryPressure(MemoryPressure.CRITICAL);
  } else if (level >= TRIM_MEMORY_BACKGROUND || level == TRIM_MEMORY_RUNNING_CRITICAL) {
    dispatchMemoryPressure(MemoryPressure.MODERATE);
  }
}
 
Example 13
Project: react-native-box-loaders   File: MemoryPressureRouter.java   View source code 5 votes vote down vote up
private void dispatchMemoryPressure(MemoryPressure level) {
  // copy listeners array to avoid ConcurrentModificationException if any of the listeners remove
  // themselves in handleMemoryPressure()
  MemoryPressureListener[] listeners =
    mListeners.toArray(new MemoryPressureListener[mListeners.size()]);
  for (MemoryPressureListener listener : listeners) {
    listener.handleMemoryPressure(level);
  }
}
 
Example 14
Project: Ironman   File: MemoryPressureRouter.java   View source code 5 votes vote down vote up
private void trimMemory(int level) {
  if (level >= TRIM_MEMORY_COMPLETE) {
    dispatchMemoryPressure(MemoryPressure.CRITICAL);
  } else if (level >= TRIM_MEMORY_BACKGROUND || level == TRIM_MEMORY_RUNNING_CRITICAL) {
    dispatchMemoryPressure(MemoryPressure.MODERATE);
  } else if (level == TRIM_MEMORY_UI_HIDDEN) {
    dispatchMemoryPressure(MemoryPressure.UI_HIDDEN);
  }
}
 
Example 15
Project: Ironman   File: MemoryPressureRouter.java   View source code 5 votes vote down vote up
private void dispatchMemoryPressure(MemoryPressure level) {
  // copy listeners array to avoid ConcurrentModificationException if any of the listeners remove
  // themselves in handleMemoryPressure()
  MemoryPressureListener[] listeners =
    mListeners.toArray(new MemoryPressureListener[mListeners.size()]);
  for (MemoryPressureListener listener : listeners) {
    listener.handleMemoryPressure(level);
  }
}