revert D2773664

Reviewed By: dwitte

Differential Revision: D2802582

fb-gh-sync-id: 39d59be297f0f23e6a4e40175ad30284766349cb
This commit is contained in:
Fada Chen 2016-01-04 23:48:33 -08:00 committed by facebook-github-bot-6
parent 27ac04742a
commit 18cdead76b
4 changed files with 5 additions and 44 deletions

View File

@ -35,8 +35,7 @@
typedef NS_ENUM(NSUInteger, RCTBridgeFields) {
RCTBridgeFieldRequestModuleIDs = 0,
RCTBridgeFieldMethodIDs,
RCTBridgeFieldParams,
RCTBridgeFieldCallID,
RCTBridgeFieldParamss,
};
RCT_EXTERN NSArray<Class> *RCTGetModuleClasses(void);
@ -66,9 +65,6 @@ RCT_EXTERN NSArray<Class> *RCTGetModuleClasses(void);
NSUInteger _asyncInitializedModules;
}
@synthesize flowID = _flowID;
@synthesize flowIDMap = _flowIDMap;
- (instancetype)initWithParentBridge:(RCTBridge *)bridge
{
RCTAssertMainThread();
@ -595,9 +591,6 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
_modulesByName_DEPRECATED = nil;
_frameUpdateObservers = nil;
if (_flowIDMap != NULL) {
CFRelease(_flowIDMap);
}
}];
});
}
@ -800,22 +793,15 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
- (void)handleBuffer:(NSArray *)buffer
{
NSArray *requestsArray = [RCTConvert NSArray:buffer];
if (RCT_DEBUG && requestsArray.count <= RCTBridgeFieldParams) {
if (RCT_DEBUG && requestsArray.count <= RCTBridgeFieldParamss) {
RCTLogError(@"Buffer should contain at least %tu sub-arrays. Only found %tu",
RCTBridgeFieldParams + 1, requestsArray.count);
RCTBridgeFieldParamss + 1, requestsArray.count);
return;
}
NSArray<NSNumber *> *moduleIDs = [RCTConvert NSNumberArray:requestsArray[RCTBridgeFieldRequestModuleIDs]];
NSArray<NSNumber *> *methodIDs = [RCTConvert NSNumberArray:requestsArray[RCTBridgeFieldMethodIDs]];
NSArray<NSArray *> *paramsArrays = [RCTConvert NSArrayArray:requestsArray[RCTBridgeFieldParams]];
int64_t callID = -1;
if (requestsArray.count > 3) {
callID = [requestsArray[RCTBridgeFieldCallID] longLongValue];
}
NSArray<NSArray *> *paramsArrays = [RCTConvert NSArrayArray:requestsArray[RCTBridgeFieldParamss]];
if (RCT_DEBUG && (moduleIDs.count != methodIDs.count || moduleIDs.count != paramsArrays.count)) {
RCTLogError(@"Invalid data message - all must be length: %zd", moduleIDs.count);
@ -849,11 +835,6 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
@autoreleasepool {
for (NSNumber *indexObj in calls) {
NSUInteger index = indexObj.unsignedIntegerValue;
if (callID != -1) {
int64_t newFlowID = (int64_t)CFDictionaryGetValue(_flowIDMap, (const void *)(_flowID + index));
_RCTProfileEndFlowEvent(@(newFlowID));
CFDictionaryRemoveValue(_flowIDMap, (const void *)(_flowID + index));
}
[self _handleRequestNumber:index
moduleID:[moduleIDs[index] integerValue]
methodID:[methodIDs[index] integerValue]
@ -872,8 +853,6 @@ RCT_NOT_IMPLEMENTED(- (instancetype)initWithBundleURL:(__unused NSURL *)bundleUR
dispatch_async(queue, block);
}
}
_flowID = callID;
}
- (void)partialBatchDidFlush

View File

@ -13,10 +13,6 @@
@interface RCTBridge ()
// Used for the profiler flow events between JS and native
@property (nonatomic, assign) int64_t flowID;
@property (nonatomic, assign) CFMutableDictionaryRef flowIDMap;
+ (instancetype)currentBridge;
+ (void)setCurrentBridge:(RCTBridge *)bridge;

View File

@ -283,20 +283,6 @@ static void RCTInstallJSCProfiler(RCTBridge *bridge, JSContextRef context)
CFDictionaryRemoveValue(cookieMap, (const void *)cookie);
};
#ifndef __clang_analyzer__
weakBridge.flowIDMap = CFDictionaryCreateMutable(NULL, 0, NULL, NULL);
#endif
context[@"nativeTraceBeginAsyncFlow"] = ^(__unused uint64_t tag, __unused NSString *name, int64_t cookie) {
int64_t newCookie = [_RCTProfileBeginFlowEvent() longLongValue];
CFDictionarySetValue(weakBridge.flowIDMap, (const void *)cookie, (const void *)newCookie);
};
context[@"nativeTraceEndAsyncFlow"] = ^(__unused uint64_t tag, __unused NSString *name, int64_t cookie) {
int64_t newCookie = (int64_t)CFDictionaryGetValue(weakBridge.flowIDMap, (const void *)cookie);
_RCTProfileEndFlowEvent(@(newCookie));
CFDictionaryRemoveValue(weakBridge.flowIDMap, (const void *)cookie);
};
context[@"nativeTraceBeginSection"] = ^(NSNumber *tag, NSString *profileName){
static int profileCounter = 1;
if (!profileName) {

View File

@ -190,7 +190,7 @@ RCT_EXTERN void RCTProfileRegisterCallbacks(RCTProfileCallbacks *);
#define _RCTProfileBeginFlowEvent() @0
#define RCTProfileEndFlowEvent()
#define _RCTProfileEndFlowEvent(...)
#define _RCTProfileEndFlowEvent()
#define RCTProfileIsProfiling(...) NO
#define RCTProfileInit(...)