Refactor ReactMarker out of Platform

Reviewed By: fromcelticpark

Differential Revision: D7803908

fbshipit-source-id: 957e80519c209732b163ece2bccb7c8c36ff8107
This commit is contained in:
Marc Horowitz 2018-05-09 22:01:53 -07:00 committed by Facebook Github Bot
parent 042449f24a
commit a363a7b501
16 changed files with 98 additions and 47 deletions

View File

@ -33,6 +33,7 @@
#import <cxxreact/JSBundleType.h>
#import <cxxreact/JSCExecutor.h>
#import <cxxreact/JSIndexedRAMBundle.h>
#import <cxxreact/ModuleRegistry.h>
#import <cxxreact/Platform.h>
#import <cxxreact/RAMBundleRegistry.h>
#import <jschelpers/Value.h>

View File

@ -51,6 +51,7 @@
133957881DF76D3500EC27BE /* YGEnums.h in Headers */ = {isa = PBXBuildFile; fileRef = 130A77031DF767AF001F9587 /* YGEnums.h */; };
133957891DF76D3500EC27BE /* YGMacros.h in Headers */ = {isa = PBXBuildFile; fileRef = 130A77041DF767AF001F9587 /* YGMacros.h */; };
1339578B1DF76D3500EC27BE /* Yoga.h in Headers */ = {isa = PBXBuildFile; fileRef = 130A77081DF767AF001F9587 /* Yoga.h */; };
133EA4E52098F6E30035B1D8 /* ReactMarker.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 13DA8A2F2097A90A00276ED4 /* ReactMarker.h */; };
13456E931ADAD2DE009F94A7 /* RCTConvert+CoreLocation.m in Sources */ = {isa = PBXBuildFile; fileRef = 13456E921ADAD2DE009F94A7 /* RCTConvert+CoreLocation.m */; };
134D63C31F1FEC4B008872B5 /* RCTCxxBridgeDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 134D63C21F1FEC4B008872B5 /* RCTCxxBridgeDelegate.h */; };
134D63C41F1FEC65008872B5 /* RCTCxxBridgeDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 134D63C21F1FEC4B008872B5 /* RCTCxxBridgeDelegate.h */; };
@ -127,6 +128,10 @@
13D033631C1837FE0021DC29 /* RCTClipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 13D033621C1837FE0021DC29 /* RCTClipboard.m */; };
13D9FEEB1CDCCECF00158BD7 /* RCTEventEmitter.m in Sources */ = {isa = PBXBuildFile; fileRef = 13D9FEEA1CDCCECF00158BD7 /* RCTEventEmitter.m */; };
13D9FEEE1CDCD93000158BD7 /* RCTKeyboardObserver.m in Sources */ = {isa = PBXBuildFile; fileRef = 13D9FEED1CDCD93000158BD7 /* RCTKeyboardObserver.m */; };
13DA8A312097A90B00276ED4 /* ReactMarker.h in Headers */ = {isa = PBXBuildFile; fileRef = 13DA8A2F2097A90A00276ED4 /* ReactMarker.h */; };
13DA8A322097A90B00276ED4 /* ReactMarker.h in Headers */ = {isa = PBXBuildFile; fileRef = 13DA8A2F2097A90A00276ED4 /* ReactMarker.h */; };
13DA8A332097A90B00276ED4 /* ReactMarker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 13DA8A302097A90B00276ED4 /* ReactMarker.cpp */; };
13DA8A342097A90B00276ED4 /* ReactMarker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 13DA8A302097A90B00276ED4 /* ReactMarker.cpp */; };
13E0674A1A70F434002CDEE1 /* RCTUIManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E067491A70F434002CDEE1 /* RCTUIManager.m */; };
13E067561A70F44B002CDEE1 /* RCTViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E0674E1A70F44B002CDEE1 /* RCTViewManager.m */; };
13E067571A70F44B002CDEE1 /* RCTView.m in Sources */ = {isa = PBXBuildFile; fileRef = 13E067501A70F44B002CDEE1 /* RCTView.m */; };
@ -1756,6 +1761,7 @@
dstPath = include/cxxreact;
dstSubfolderSpec = 16;
files = (
133EA4E52098F6E30035B1D8 /* ReactMarker.h in Copy Headers */,
C669D8981F72E3DE006748EB /* RAMBundleRegistry.h in Copy Headers */,
3DA981A01E5B0E34004F2374 /* CxxModule.h in Copy Headers */,
3DA981A11E5B0E34004F2374 /* CxxNativeModule.h in Copy Headers */,
@ -2017,6 +2023,8 @@
13D9FEEA1CDCCECF00158BD7 /* RCTEventEmitter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTEventEmitter.m; sourceTree = "<group>"; };
13D9FEEC1CDCD93000158BD7 /* RCTKeyboardObserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTKeyboardObserver.h; sourceTree = "<group>"; };
13D9FEED1CDCD93000158BD7 /* RCTKeyboardObserver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTKeyboardObserver.m; sourceTree = "<group>"; };
13DA8A2F2097A90A00276ED4 /* ReactMarker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReactMarker.h; sourceTree = "<group>"; };
13DA8A302097A90B00276ED4 /* ReactMarker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReactMarker.cpp; sourceTree = "<group>"; };
13E067481A70F434002CDEE1 /* RCTUIManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTUIManager.h; sourceTree = "<group>"; };
13E067491A70F434002CDEE1 /* RCTUIManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUIManager.m; sourceTree = "<group>"; };
13E0674B1A70F44B002CDEE1 /* RCTShadowView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTShadowView.h; sourceTree = "<group>"; };
@ -3041,6 +3049,8 @@
AC70D2EA1DE489FC002E6351 /* cxxreact */ = {
isa = PBXGroup;
children = (
13DA8A302097A90B00276ED4 /* ReactMarker.cpp */,
13DA8A2F2097A90A00276ED4 /* ReactMarker.h */,
E223624320875A8000108244 /* JSExecutor.cpp */,
3D92B0A71E03699D0018521A /* CxxModule.h */,
3D92B0A81E03699D0018521A /* CxxNativeModule.cpp */,
@ -3329,6 +3339,7 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
13DA8A322097A90B00276ED4 /* ReactMarker.h in Headers */,
3D74547E1E54759A00E74ADD /* JSModulesUnbundle.h in Headers */,
C6D3801B1F71D76200621378 /* RAMBundleRegistry.h in Headers */,
27595AD51E575C7800CCE2B1 /* NativeToJsBridge.h in Headers */,
@ -3423,6 +3434,7 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
13DA8A312097A90B00276ED4 /* ReactMarker.h in Headers */,
3D74547F1E54759E00E74ADD /* JSModulesUnbundle.h in Headers */,
C6D3801A1F71D76100621378 /* RAMBundleRegistry.h in Headers */,
27595ABA1E575C7800CCE2B1 /* NativeToJsBridge.h in Headers */,
@ -4405,6 +4417,7 @@
13F8876E1E29726200C3C7A1 /* CxxNativeModule.cpp in Sources */,
13F887721E29726200C3C7A1 /* JSCExecutor.cpp in Sources */,
13F887741E29726200C3C7A1 /* JSCLegacyTracing.cpp in Sources */,
13DA8A332097A90B00276ED4 /* ReactMarker.cpp in Sources */,
13F887771E29726200C3C7A1 /* JSCPerfStats.cpp in Sources */,
13F887711E29726200C3C7A1 /* JSBundleType.cpp in Sources */,
13F887791E29726200C3C7A1 /* JSCUtils.cpp in Sources */,
@ -4430,6 +4443,7 @@
13F887851E29726300C3C7A1 /* JSCExecutor.cpp in Sources */,
13F887871E29726300C3C7A1 /* JSCLegacyTracing.cpp in Sources */,
13F8878A1E29726300C3C7A1 /* JSCPerfStats.cpp in Sources */,
13DA8A342097A90B00276ED4 /* ReactMarker.cpp in Sources */,
13F887841E29726300C3C7A1 /* Instance.cpp in Sources */,
13F8878C1E29726300C3C7A1 /* JSCUtils.cpp in Sources */,
13F8878B1E29726300C3C7A1 /* JSCSamplingProfiler.cpp in Sources */,

View File

@ -9,6 +9,7 @@ LOCAL_SRC_FILES := \
CatalystInstanceImpl.cpp \
CxxModuleWrapper.cpp \
JavaModuleWrapper.cpp \
JReactMarker.cpp \
JMessageQueueThread.cpp \
JSCPerfLogging.cpp \
JSLoader.cpp \
@ -22,7 +23,6 @@ LOCAL_SRC_FILES := \
NativeMap.cpp \
OnLoad.cpp \
ProxyExecutor.cpp \
ReactMarker.cpp \
ReadableNativeArray.cpp \
ReadableNativeMap.cpp \
WritableNativeArray.cpp \

View File

@ -13,7 +13,7 @@
#include "JSCPerfLogging.h"
#include "JSLogging.h"
#include "ReactMarker.h"
#include "JReactMarker.h"
using namespace facebook::jni;

View File

@ -7,6 +7,7 @@ EXPORTED_HEADERS = [
"CxxSharedModuleWrapper.h",
"JavaModuleWrapper.h",
"JavaScriptExecutorHolder.h",
"JReactMarker.h",
"JSLoader.h",
"JSLogging.h",
"MethodInvoker.h",
@ -14,7 +15,6 @@ EXPORTED_HEADERS = [
"NativeArray.h",
"NativeCommon.h",
"NativeMap.h",
"ReactMarker.h",
"ReadableNativeArray.h",
"ReadableNativeMap.h",
"WritableNativeArray.h",

View File

@ -1,9 +1,8 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#include "ReactMarker.h"
#include "JReactMarker.h"
#include <mutex>
#include <cxxreact/Platform.h>
#include <jschelpers/JSCHelpers.h>
#include <cxxreact/ReactMarker.h>
#include <fb/fbjni.h>
namespace facebook {

View File

@ -4,7 +4,8 @@
#include <string>
#include <fb/fbjni.h>
#include <cxxreact/Platform.h>
#include <cxxreact/ReactMarker.h>
namespace facebook {
namespace react {

View File

@ -25,6 +25,7 @@ LOCAL_SRC_FILES := \
NativeToJsBridge.cpp \
Platform.cpp \
RAMBundleRegistry.cpp \
ReactMarker.cpp \
LOCAL_C_INCLUDES := $(LOCAL_PATH)/..
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)

View File

@ -102,6 +102,7 @@ CXXREACT_PUBLIC_HEADERS = [
"NativeToJsBridge.h",
"Platform.h",
"RAMBundleRegistry.h",
"ReactMarker.h",
"RecoverableError.h",
"SharedProxyCxxModule.h",
"SystraceSection.h",

View File

@ -27,12 +27,12 @@
#include "JSBundleType.h"
#include "JSCLegacyTracing.h"
#include "JSCMemory.h"
#include "JSCNativeModules.h"
#include "JSCPerfStats.h"
#include "JSCSamplingProfiler.h"
#include "JSCTracing.h"
#include "JSCUtils.h"
#include "JSModulesUnbundle.h"
#include "MessageQueueThread.h"
#include "ModuleRegistry.h"
#include "Platform.h"
#include "RAMBundleRegistry.h"

View File

@ -4,7 +4,8 @@
#include <string>
#include "Platform.h"
#include "ModuleRegistry.h"
#include "ReactMarker.h"
namespace facebook {
namespace react {

View File

@ -5,13 +5,14 @@
#include <memory>
#include <string>
#include <cxxreact/ModuleRegistry.h>
#include <folly/Optional.h>
#include <jschelpers/Value.h>
namespace facebook {
namespace react {
class ModuleRegistry;
/**
* Holds and creates JS representations of the modules in ModuleRegistry
*/

View File

@ -10,15 +10,6 @@ namespace react {
#pragma clang diagnostic ignored "-Wglobal-constructors"
#endif
namespace ReactMarker {
LogTaggedMarker logTaggedMarker = nullptr;
void logMarker(const ReactMarkerId markerId) {
logTaggedMarker(markerId, nullptr);
}
}
namespace JSCNativeHooks {
Hook loggingHook = nullptr;

View File

@ -6,8 +6,7 @@
#include <memory>
#include <string>
#include <cxxreact/JSExecutor.h>
#include <cxxreact/MessageQueueThread.h>
#include <cxxreact/ReactMarker.h>
#include <jschelpers/JavaScriptCore.h>
#ifndef RN_EXPORT
@ -17,31 +16,6 @@
namespace facebook {
namespace react {
namespace ReactMarker {
enum ReactMarkerId {
NATIVE_REQUIRE_START,
NATIVE_REQUIRE_STOP,
RUN_JS_BUNDLE_START,
RUN_JS_BUNDLE_STOP,
CREATE_REACT_CONTEXT_STOP,
JS_BUNDLE_STRING_CONVERT_START,
JS_BUNDLE_STRING_CONVERT_STOP,
NATIVE_MODULE_SETUP_START,
NATIVE_MODULE_SETUP_STOP,
};
#ifdef __APPLE__
using LogTaggedMarker = std::function<void(const ReactMarkerId, const char* tag)>;
#else
typedef void(*LogTaggedMarker)(const ReactMarkerId, const char* tag);
#endif
extern RN_EXPORT LogTaggedMarker logTaggedMarker;
extern void logMarker(const ReactMarkerId markerId);
}
namespace JSCNativeHooks {
using Hook = JSValueRef(*)(

View File

@ -0,0 +1,26 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#include "ReactMarker.h"
namespace facebook {
namespace react {
namespace ReactMarker {
#if __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wglobal-constructors"
#endif
LogTaggedMarker logTaggedMarker = nullptr;
#if __clang__
#pragma clang diagnostic pop
#endif
void logMarker(const ReactMarkerId markerId) {
logTaggedMarker(markerId, nullptr);
}
}
}
}

View File

@ -0,0 +1,41 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#pragma once
#ifdef __APPLE__
#include <functional>
#endif
namespace facebook {
namespace react {
namespace ReactMarker {
enum ReactMarkerId {
NATIVE_REQUIRE_START,
NATIVE_REQUIRE_STOP,
RUN_JS_BUNDLE_START,
RUN_JS_BUNDLE_STOP,
CREATE_REACT_CONTEXT_STOP,
JS_BUNDLE_STRING_CONVERT_START,
JS_BUNDLE_STRING_CONVERT_STOP,
NATIVE_MODULE_SETUP_START,
NATIVE_MODULE_SETUP_STOP,
};
#ifdef __APPLE__
using LogTaggedMarker = std::function<void(const ReactMarkerId, const char* tag)>;
#else
typedef void(*LogTaggedMarker)(const ReactMarkerId, const char* tag);
#endif
#ifndef RN_EXPORT
#define RN_EXPORT __attribute__((visibility("default")))
#endif
extern RN_EXPORT LogTaggedMarker logTaggedMarker;
extern void logMarker(const ReactMarkerId markerId);
}
}
}