mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Add MC to test disabling React Native invalidation under memory pressure
Summary: Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D35732504 fbshipit-source-id: d81d6ddefc98d1e73be697c3eef8a2c90104658c
This commit is contained in:
committed by
Facebook GitHub Bot
parent
c5c17985da
commit
0916df9951
@@ -21,3 +21,15 @@ RCT_EXTERN void RCTExperimentSetPreemptiveViewAllocationDisabled(BOOL value);
|
||||
*/
|
||||
RCT_EXTERN BOOL RCTGetDispatchW3CPointerEvents(void);
|
||||
RCT_EXTERN void RCTSetDispatchW3CPointerEvents(BOOL value);
|
||||
|
||||
/*
|
||||
* Memory Pressure Unloading
|
||||
*/
|
||||
RCT_EXTERN BOOL RCTGetDisableBridgeMemoryPressureUnload(void);
|
||||
RCT_EXTERN void RCTSetDisableBridgeMemoryPressureUnload(BOOL value);
|
||||
|
||||
/*
|
||||
* Memory Pressure Unloading Level
|
||||
*/
|
||||
RCT_EXTERN BOOL RCTGetMemoryPressureUnloadLevel(void);
|
||||
RCT_EXTERN void RCTSetMemoryPressureUnloadLevel(int value);
|
||||
|
||||
@@ -39,3 +39,34 @@ void RCTSetDispatchW3CPointerEvents(BOOL value)
|
||||
{
|
||||
RCTDispatchW3CPointerEvents = value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Memory Pressure Unloading
|
||||
*/
|
||||
static BOOL RCTDisableBridgeMemoryPressureUnload = NO;
|
||||
|
||||
BOOL RCTGetDisableBridgeMemoryPressureUnload()
|
||||
{
|
||||
return RCTDisableBridgeMemoryPressureUnload;
|
||||
}
|
||||
|
||||
void RCTSetDisableBridgeMemoryPressureUnload(BOOL value)
|
||||
{
|
||||
RCTDisableBridgeMemoryPressureUnload = value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Memory Pressure Unloading Level for experimentation only.
|
||||
* Default is 15, which is TRIM_MEMORY_RUNNING_CRITICAL.
|
||||
*/
|
||||
static int RCTMemoryPressureUnloadLevel = 15;
|
||||
|
||||
BOOL RCTGetMemoryPressureUnloadLevel()
|
||||
{
|
||||
return RCTMemoryPressureUnloadLevel;
|
||||
}
|
||||
|
||||
void RCTSetMemoryPressureUnloadLevel(int value)
|
||||
{
|
||||
RCTMemoryPressureUnloadLevel = value;
|
||||
}
|
||||
|
||||
@@ -359,7 +359,8 @@ struct RCTInstanceCallback : public InstanceCallback {
|
||||
// in case if some other tread resets it.
|
||||
auto reactInstance = _reactInstance;
|
||||
if (reactInstance) {
|
||||
reactInstance->handleMemoryPressure(15 /* TRIM_MEMORY_RUNNING_CRITICAL */);
|
||||
int unloadLevel = RCTGetMemoryPressureUnloadLevel();
|
||||
reactInstance->handleMemoryPressure(unloadLevel);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user