Add MC to check whether canSendEvents_DEPRECATED is needed

Summary:
Changelog: [Internal]

See T118587955

Reviewed By: RSNara

Differential Revision: D36026423

fbshipit-source-id: 26cfcf318af4a5061e94bd0286c0433c06886d8e
This commit is contained in:
Paige Sun authored and Facebook GitHub Bot committed 2022-05-01 13:36:09 -07:00
1 parent f9922a3f46
commit 422c224bb0
3 files changed
+15 -10

No files matched your search

+3 -3
View File
@@ -23,10 +23,10 @@ RCT_EXTERN BOOL RCTGetDispatchW3CPointerEvents(void);
RCT_EXTERN void RCTSetDispatchW3CPointerEvents(BOOL value);
/*
* Memory Pressure Unloading
* Validate RCTEventEmitter
*/
RCT_EXTERN BOOL RCTGetDisableBridgeMemoryPressureUnload(void);
RCT_EXTERN void RCTSetDisableBridgeMemoryPressureUnload(BOOL value);
RCT_EXTERN BOOL RCTGetValidateCanSendEventInRCTEventEmitter(void);
RCT_EXTERN void RCTSetValidateCanSendEventInRCTEventEmitter(BOOL value);
/*
* Memory Pressure Unloading Level
+6 -6
View File
@@ -41,18 +41,18 @@ void RCTSetDispatchW3CPointerEvents(BOOL value)
}
/*
* Memory Pressure Unloading
* Validate RCTEventEmitter. For experimentation only.
*/
static BOOL RCTDisableBridgeMemoryPressureUnload = NO;
static BOOL RCTValidateCanSendEventInRCTEventEmitter = NO;
BOOL RCTGetDisableBridgeMemoryPressureUnload()
BOOL RCTGetValidateCanSendEventInRCTEventEmitter()
{
return RCTDisableBridgeMemoryPressureUnload;
return RCTValidateCanSendEventInRCTEventEmitter;
}
void RCTSetDisableBridgeMemoryPressureUnload(BOOL value)
void RCTSetValidateCanSendEventInRCTEventEmitter(BOOL value)
{
RCTDisableBridgeMemoryPressureUnload = value;
RCTValidateCanSendEventInRCTEventEmitter = value;
}
/*
+6 -1
View File
@@ -6,6 +6,7 @@
*/
#import "RCTEventEmitter.h"
#import <React/RCTConstants.h>
#import "RCTAssert.h"
#import "RCTLog.h"
#import "RCTUtils.h"
@@ -83,7 +84,11 @@
*/
- (BOOL)canSendEvents_DEPRECATED
{
return _callableJSModules != nil;
bool canSendEvents = _callableJSModules != nil;
if (!canSendEvents && RCTGetValidateCanSendEventInRCTEventEmitter()) {
RCTLogError(@"Trying to send event when _callableJSModules is nil.");
}
return canSendEvents;
}
- (void)startObserving