Rename Executor to JSExecutor

Summary:
* Cleanup some header files so we use more forward declarations
* Rename Executor to JSExecutor.h
* Move some typedefs to more appropriate locations

Reviewed By: mhorowitz

Differential Revision: D5301913

fbshipit-source-id: e75154797eb3f531d2f42a5e95409f4062b85f91
This commit is contained in:
Pieter De Baets 2017-06-23 16:49:55 -07:00 committed by Facebook Github Bot
parent 6aea140a33
commit e2628f93b5
31 changed files with 124 additions and 129 deletions

View File

@ -12,7 +12,7 @@
#import <React/RCTDefines.h>
#import <React/RCTJavaScriptExecutor.h>
#include <cxxreact/Executor.h>
#import <cxxreact/JSExecutor.h>
namespace facebook {
namespace react {

View File

@ -15,7 +15,8 @@
#import <React/RCTLog.h>
#import <React/RCTProfile.h>
#import <React/RCTUtils.h>
#import <cxxreact/Executor.h>
#import <cxxreact/JSBigString.h>
#import <cxxreact/JSExecutor.h>
#import <cxxreact/MessageQueueThread.h>
#import <cxxreact/ModuleRegistry.h>
#import <folly/json.h>
@ -91,7 +92,7 @@ public:
}
void setJSModulesUnbundle(std::unique_ptr<JSModulesUnbundle>) override {
RCTLogWarn(@"Unbundle is not supported in RCTObjcExecutor");
RCTAssert(NO, @"Unbundle is not supported in RCTObjcExecutor");
}
void callFunction(const std::string &module, const std::string &method,

View File

@ -220,7 +220,7 @@
19F61C071E8495FF00571D81 /* Value.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B10D1E0369AD0018521A /* Value.h */; };
27595AA41E575C7800CCE2B1 /* CxxModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A71E03699D0018521A /* CxxModule.h */; };
27595AA51E575C7800CCE2B1 /* CxxNativeModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A91E03699D0018521A /* CxxNativeModule.h */; };
27595AA61E575C7800CCE2B1 /* Executor.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0AB1E03699D0018521A /* Executor.h */; };
27595AA61E575C7800CCE2B1 /* JSExecutor.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0AB1E03699D0018521A /* JSExecutor.h */; };
27595AA91E575C7800CCE2B1 /* Instance.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0AF1E03699D0018521A /* Instance.h */; };
27595AAA1E575C7800CCE2B1 /* JsArgumentHelpers-inl.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B01E03699D0018521A /* JsArgumentHelpers-inl.h */; };
27595AAB1E575C7800CCE2B1 /* JsArgumentHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B11E03699D0018521A /* JsArgumentHelpers.h */; };
@ -243,7 +243,7 @@
27595ABD1E575C7800CCE2B1 /* SystraceSection.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0D51E03699D0018521A /* SystraceSection.h */; };
27595ABF1E575C7800CCE2B1 /* CxxModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A71E03699D0018521A /* CxxModule.h */; };
27595AC01E575C7800CCE2B1 /* CxxNativeModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A91E03699D0018521A /* CxxNativeModule.h */; };
27595AC11E575C7800CCE2B1 /* Executor.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0AB1E03699D0018521A /* Executor.h */; };
27595AC11E575C7800CCE2B1 /* JSExecutor.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0AB1E03699D0018521A /* JSExecutor.h */; };
27595AC41E575C7800CCE2B1 /* Instance.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0AF1E03699D0018521A /* Instance.h */; };
27595AC51E575C7800CCE2B1 /* JsArgumentHelpers-inl.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B01E03699D0018521A /* JsArgumentHelpers-inl.h */; };
27595AC61E575C7800CCE2B1 /* JsArgumentHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B11E03699D0018521A /* JsArgumentHelpers.h */; };
@ -794,7 +794,7 @@
3DA9819E1E5B0DBB004F2374 /* NSDataBigString.h in Headers */ = {isa = PBXBuildFile; fileRef = 3D7454B31E54786200E74ADD /* NSDataBigString.h */; };
3DA981A01E5B0E34004F2374 /* CxxModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A71E03699D0018521A /* CxxModule.h */; };
3DA981A11E5B0E34004F2374 /* CxxNativeModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A91E03699D0018521A /* CxxNativeModule.h */; };
3DA981A21E5B0E34004F2374 /* Executor.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0AB1E03699D0018521A /* Executor.h */; };
3DA981A21E5B0E34004F2374 /* JSExecutor.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0AB1E03699D0018521A /* JSExecutor.h */; };
3DA981A51E5B0E34004F2374 /* Instance.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0AF1E03699D0018521A /* Instance.h */; };
3DA981A61E5B0E34004F2374 /* JsArgumentHelpers-inl.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B01E03699D0018521A /* JsArgumentHelpers-inl.h */; };
3DA981A71E5B0E34004F2374 /* JsArgumentHelpers.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B11E03699D0018521A /* JsArgumentHelpers.h */; };
@ -933,7 +933,7 @@
3DA982391E5B0F8A004F2374 /* UIView+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 83F15A171B7CC46900F10295 /* UIView+Private.h */; };
3DA9823B1E5B1053004F2374 /* CxxModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A71E03699D0018521A /* CxxModule.h */; };
3DA9823C1E5B1053004F2374 /* CxxNativeModule.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0A91E03699D0018521A /* CxxNativeModule.h */; };
3DA9823D1E5B1053004F2374 /* Executor.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0AB1E03699D0018521A /* Executor.h */; };
3DA9823D1E5B1053004F2374 /* JSExecutor.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0AB1E03699D0018521A /* JSExecutor.h */; };
3DA982401E5B1053004F2374 /* Instance.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0AF1E03699D0018521A /* Instance.h */; };
3DA982411E5B1053004F2374 /* JsArgumentHelpers-inl.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B01E03699D0018521A /* JsArgumentHelpers-inl.h */; };
3DA982421E5B1053004F2374 /* JsArgumentHelpers.h in Copy Headers */ = {isa = PBXBuildFile; fileRef = 3D92B0B11E03699D0018521A /* JsArgumentHelpers.h */; };
@ -1317,7 +1317,7 @@
files = (
3DA9823B1E5B1053004F2374 /* CxxModule.h in Copy Headers */,
3DA9823C1E5B1053004F2374 /* CxxNativeModule.h in Copy Headers */,
3DA9823D1E5B1053004F2374 /* Executor.h in Copy Headers */,
3DA9823D1E5B1053004F2374 /* JSExecutor.h in Copy Headers */,
3DA982401E5B1053004F2374 /* Instance.h in Copy Headers */,
3DA982411E5B1053004F2374 /* JsArgumentHelpers-inl.h in Copy Headers */,
3DA982421E5B1053004F2374 /* JsArgumentHelpers.h in Copy Headers */,
@ -1533,7 +1533,7 @@
files = (
3DA981A01E5B0E34004F2374 /* CxxModule.h in Copy Headers */,
3DA981A11E5B0E34004F2374 /* CxxNativeModule.h in Copy Headers */,
3DA981A21E5B0E34004F2374 /* Executor.h in Copy Headers */,
3DA981A21E5B0E34004F2374 /* JSExecutor.h in Copy Headers */,
3DA981A51E5B0E34004F2374 /* Instance.h in Copy Headers */,
3DA981A61E5B0E34004F2374 /* JsArgumentHelpers-inl.h in Copy Headers */,
3DA981A71E5B0E34004F2374 /* JsArgumentHelpers.h in Copy Headers */,
@ -1862,7 +1862,7 @@
3D92B0A71E03699D0018521A /* CxxModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CxxModule.h; sourceTree = "<group>"; };
3D92B0A81E03699D0018521A /* CxxNativeModule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CxxNativeModule.cpp; sourceTree = "<group>"; };
3D92B0A91E03699D0018521A /* CxxNativeModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CxxNativeModule.h; sourceTree = "<group>"; };
3D92B0AB1E03699D0018521A /* Executor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Executor.h; sourceTree = "<group>"; };
3D92B0AB1E03699D0018521A /* JSExecutor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSExecutor.h; sourceTree = "<group>"; };
3D92B0AE1E03699D0018521A /* Instance.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Instance.cpp; sourceTree = "<group>"; };
3D92B0AF1E03699D0018521A /* Instance.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Instance.h; sourceTree = "<group>"; };
3D92B0B01E03699D0018521A /* JsArgumentHelpers-inl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "JsArgumentHelpers-inl.h"; sourceTree = "<group>"; };
@ -2593,7 +2593,7 @@
3D92B0A71E03699D0018521A /* CxxModule.h */,
3D92B0A81E03699D0018521A /* CxxNativeModule.cpp */,
3D92B0A91E03699D0018521A /* CxxNativeModule.h */,
3D92B0AB1E03699D0018521A /* Executor.h */,
3D92B0AB1E03699D0018521A /* JSExecutor.h */,
3D92B0AE1E03699D0018521A /* Instance.cpp */,
3D92B0AF1E03699D0018521A /* Instance.h */,
3D92B0B01E03699D0018521A /* JsArgumentHelpers-inl.h */,
@ -2852,7 +2852,7 @@
27595AD01E575C7800CCE2B1 /* JSIndexedRAMBundle.h in Headers */,
27595AD31E575C7800CCE2B1 /* ModuleRegistry.h in Headers */,
27595ACC1E575C7800CCE2B1 /* JSCPerfStats.h in Headers */,
27595AC11E575C7800CCE2B1 /* Executor.h in Headers */,
27595AC11E575C7800CCE2B1 /* JSExecutor.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -2941,7 +2941,7 @@
27595AB51E575C7800CCE2B1 /* JSIndexedRAMBundle.h in Headers */,
27595AB81E575C7800CCE2B1 /* ModuleRegistry.h in Headers */,
27595AB11E575C7800CCE2B1 /* JSCPerfStats.h in Headers */,
27595AA61E575C7800CCE2B1 /* Executor.h in Headers */,
27595AA61E575C7800CCE2B1 /* JSExecutor.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -5,21 +5,19 @@
#include <mutex>
#include <condition_variable>
#include <folly/dynamic.h>
#include <folly/Memory.h>
#include <fb/log.h>
#include <jni/Countable.h>
#include <jni/LocalReference.h>
#include <cxxreact/CxxNativeModule.h>
#include <cxxreact/Instance.h>
#include <cxxreact/JSBigString.h>
#include <cxxreact/JSBundleType.h>
#include <cxxreact/JSIndexedRAMBundle.h>
#include <cxxreact/MethodCall.h>
#include <cxxreact/RecoverableError.h>
#include <cxxreact/ModuleRegistry.h>
#include <cxxreact/CxxNativeModule.h>
#include <fb/log.h>
#include <folly/dynamic.h>
#include <folly/Memory.h>
#include <jni/Countable.h>
#include <jni/LocalReference.h>
#include "CxxModuleWrapper.h"
#include "JavaScriptExecutorHolder.h"

View File

@ -2,15 +2,17 @@
#include "JSLoader.h"
#include <android/asset_manager_jni.h>
#include <cxxreact/JSBigString.h>
#include <fb/fbjni.h>
#include <fb/log.h>
#include <folly/Conv.h>
#include <folly/Memory.h>
#include <android/asset_manager_jni.h>
#include <fb/fbjni.h>
#include <fstream>
#include <sstream>
#include <streambuf>
#include <string>
#include <fb/log.h>
#ifdef WITH_FBSYSTRACE
#include <fbsystrace.h>
using fbsystrace::FbSystraceSection;

View File

@ -5,7 +5,7 @@
#include <string>
#include <android/asset_manager.h>
#include <cxxreact/Executor.h>
#include <cxxreact/JSExecutor.h>
#include <fb/fbjni.h>
namespace facebook {

View File

@ -2,10 +2,9 @@
#include <memory>
#include <cxxreact/JSExecutor.h>
#include <fb/fbjni.h>
#include <cxxreact/Executor.h>
namespace facebook {
namespace react {

View File

@ -4,9 +4,9 @@
#include <vector>
#include <cxxreact/JSExecutor.h>
#include <fb/fbjni.h>
#include <folly/dynamic.h>
#include <cxxreact/Executor.h>
namespace facebook {
namespace react {

View File

@ -2,10 +2,10 @@
#include <string>
#include <cxxreact/Executor.h>
#include <jschelpers/JSCHelpers.h>
#include <cxxreact/JSExecutor.h>
#include <cxxreact/JSCExecutor.h>
#include <cxxreact/Platform.h>
#include <jschelpers/JSCHelpers.h>
#include <fb/fbjni.h>
#include <fb/glog_init.h>
#include <fb/log.h>

View File

@ -3,12 +3,11 @@
#pragma once
#include <jni.h>
#include <jni/Countable.h>
#include <cxxreact/Executor.h>
namespace facebook {
namespace react {
jmethodID getLogMarkerMethod();
} // namespace react
} // namespace facebook

View File

@ -2,15 +2,15 @@
#include "ProxyExecutor.h"
#include <cxxreact/JSBigString.h>
#include <cxxreact/ModuleRegistry.h>
#include <cxxreact/SystraceSection.h>
#include <fb/assert.h>
#include <fb/Environment.h>
#include <jni/LocalReference.h>
#include <jni/LocalString.h>
#include <folly/json.h>
#include <folly/Memory.h>
#include <cxxreact/SystraceSection.h>
#include <cxxreact/ModuleRegistry.h>
#include <jni/LocalReference.h>
#include <jni/LocalString.h>
namespace facebook {
namespace react {

View File

@ -2,7 +2,7 @@
#pragma once
#include <cxxreact/Executor.h>
#include <cxxreact/JSExecutor.h>
#include <fb/fbjni.h>
#include <jni.h>
#include <jni/GlobalReference.h>

View File

@ -11,7 +11,7 @@ if THIS_IS_FBOBJC:
rn_xplat_cxx_library(
name = "module",
compiler_flags = CXX_LIBRARY_COMPILER_FLAGS,
header_namespace = "",
exported_headers = subdir_glob(
[
("", "CxxModule.h"),
@ -20,8 +20,8 @@ rn_xplat_cxx_library(
],
prefix = "cxxreact",
),
compiler_flags = CXX_LIBRARY_COMPILER_FLAGS,
force_static = True,
header_namespace = "",
visibility = [
"PUBLIC",
],
@ -36,16 +36,16 @@ rn_xplat_cxx_library(
srcs = [
"JSBigString.cpp",
],
compiler_flags = CXX_LIBRARY_COMPILER_FLAGS + [
"-fexceptions",
"-frtti",
],
header_namespace = "",
exported_headers = subdir_glob(
[("", "JSBigString.h")],
prefix = "cxxreact",
),
compiler_flags = CXX_LIBRARY_COMPILER_FLAGS + [
"-fexceptions",
"-frtti",
],
force_static = True,
header_namespace = "",
visibility = [
"PUBLIC",
],
@ -58,12 +58,12 @@ rn_xplat_cxx_library(
rn_xplat_cxx_library(
name = "samplemodule",
srcs = ["SampleCxxModule.cpp"],
header_namespace = "",
exported_headers = ["SampleCxxModule.h"],
compiler_flags = CXX_LIBRARY_COMPILER_FLAGS + [
"-fno-omit-frame-pointer",
"-fexceptions",
],
exported_headers = ["SampleCxxModule.h"],
header_namespace = "",
soname = "libxplat_react_module_samplemodule.so",
visibility = [
"PUBLIC",
@ -77,9 +77,9 @@ rn_xplat_cxx_library(
CXXREACT_PUBLIC_HEADERS = [
"CxxNativeModule.h",
"Executor.h",
"Instance.h",
"JSBundleType.h",
"JSExecutor.h",
"JSCExecutor.h",
"JSCNativeModules.h",
"JSIndexedRAMBundle.h",
@ -104,10 +104,11 @@ rn_xplat_cxx_library(
"SampleCxxModule.cpp",
],
),
compiler_flags = CXX_LIBRARY_COMPILER_FLAGS + [
"-fexceptions",
"-frtti",
],
headers = glob(
["*.h"],
excludes = CXXREACT_PUBLIC_HEADERS,
),
header_namespace = "",
exported_headers = dict([
(
"cxxreact/%s" % header,
@ -115,6 +116,10 @@ rn_xplat_cxx_library(
)
for header in CXXREACT_PUBLIC_HEADERS
]),
compiler_flags = CXX_LIBRARY_COMPILER_FLAGS + [
"-fexceptions",
"-frtti",
],
fbandroid_preprocessor_flags = [
"-DWITH_JSC_EXTRA_TRACING=1",
"-DWITH_JSC_MEMORY_PRESSURE=1",
@ -144,11 +149,6 @@ rn_xplat_cxx_library(
fbobjc_preprocessor_flags = DEBUG_PREPROCESSOR_FLAGS,
fbobjc_visibility = ["PUBLIC"],
force_static = True,
header_namespace = "",
headers = glob(
["*.h"],
excludes = CXXREACT_PUBLIC_HEADERS,
),
preprocessor_flags = [
"-DLOG_TAG=\"ReactNative\"",
"-DWITH_FBSYSTRACE=1",

View File

@ -1,23 +1,26 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#ifndef FBXPLATMODULE
#define FBXPLATMODULE
#include <folly/dynamic.h>
#pragma once
#include <functional>
#include <map>
#include <tuple>
#include <vector>
#include <folly/dynamic.h>
using namespace std::placeholders;
namespace facebook { namespace react {
class Instance;
namespace facebook {
namespace react {
class Instance;
}}
namespace facebook { namespace xplat { namespace module {
namespace facebook {
namespace xplat {
namespace module {
/**
* Base class for Catalyst native modules whose implementations are
@ -186,5 +189,3 @@ private:
};
}}}
#endif

View File

@ -9,6 +9,7 @@
#include "JsArgumentHelpers.h"
#include "SystraceSection.h"
#include "MessageQueueThread.h"
using facebook::xplat::module::CxxModule;

View File

@ -9,6 +9,7 @@ namespace facebook {
namespace react {
class Instance;
class MessageQueueThread;
std::function<void(folly::dynamic)> makeCallback(
std::weak_ptr<Instance> instance, const folly::dynamic& callbackId);

View File

@ -2,10 +2,14 @@
#include "Instance.h"
#include "Executor.h"
#include "JSExecutor.h"
#include "MethodCall.h"
#include "RecoverableError.h"
#include "SystraceSection.h"
#include "MessageQueueThread.h"
#include "NativeToJsBridge.h"
#include "JSBigString.h"
#include "JSModulesUnbundle.h"
#include <folly/json.h>
#include <folly/Memory.h>

View File

@ -2,17 +2,24 @@
#pragma once
#include <condition_variable>
#include <memory>
#include <cxxreact/ModuleRegistry.h>
#include <cxxreact/NativeModule.h>
#include <cxxreact/NativeToJsBridge.h>
#include <folly/dynamic.h>
#include <jschelpers/Value.h>
namespace folly {
struct dynamic;
}
namespace facebook {
namespace react {
class JSBigString;
class JSExecutorFactory;
class JSModulesUnbundle;
class MessageQueueThread;
class ModuleRegistry;
struct InstanceCallback {
virtual ~InstanceCallback() {}
@ -48,7 +55,7 @@ class Instance {
void *getJavaScriptContext();
void callJSFunction(std::string&& module, std::string&& method, folly::dynamic&& params);
void callJSCallback(uint64_t callbackId, folly::dynamic&& params);
MethodCallResult callSerializableNativeHook(unsigned int moduleId, unsigned int methodId, folly::dynamic&& args);
// This method is experimental, and may be modified or removed.
template <typename T>
Value callFunctionSync(const std::string& module, const std::string& method, T&& args) {
@ -80,5 +87,4 @@ class Instance {
bool m_syncReady = false;
};
}
}
} }

View File

@ -19,10 +19,7 @@
#include <jschelpers/JSCHelpers.h>
#include <jschelpers/Value.h>
#ifdef WITH_INSPECTOR
#include <jschelpers/InspectorInterfaces.h>
#endif
#include "JSBigString.h"
#include "JSBundleType.h"
#include "Platform.h"
#include "SystraceSection.h"
@ -33,6 +30,10 @@
#include "ModuleRegistry.h"
#include "RecoverableError.h"
#ifdef WITH_INSPECTOR
#include <jschelpers/InspectorInterfaces.h>
#endif
#if defined(WITH_JSC_EXTRA_TRACING) || (DEBUG && defined(WITH_FBSYSTRACE))
#include "JSCTracing.h"
#endif

View File

@ -7,8 +7,8 @@
#include <mutex>
#include <unordered_map>
#include <cxxreact/Executor.h>
#include <cxxreact/JSCNativeModules.h>
#include <cxxreact/JSExecutor.h>
#include <folly/Optional.h>
#include <folly/json.h>
#include <jschelpers/JSCHelpers.h>

View File

@ -2,7 +2,8 @@
#pragma once
#include <cxxreact/Executor.h>
#include <cxxreact/JSBigString.h>
#include <jschelpers/JavaScriptCore.h>
#include <jschelpers/Value.h>
namespace facebook {

View File

@ -5,33 +5,18 @@
#include <memory>
#include <string>
#include <cxxreact/JSBigString.h>
#include <folly/Optional.h>
#include <cxxreact/NativeModule.h>
#include <folly/dynamic.h>
#ifndef RN_EXPORT
#define RN_EXPORT __attribute__((visibility("default")))
#endif
namespace facebook {
namespace react {
#define UNPACKED_JS_SOURCE_PATH_SUFFIX "/bundle.js"
#define UNPACKED_META_PATH_SUFFIX "/bundle.meta"
#define UNPACKED_BYTECODE_SUFFIX "/bundle.bytecode"
enum {
UNPACKED_JS_SOURCE = (1 << 0),
UNPACKED_BYTECODE = (1 << 1),
};
class JSBigString;
class JSExecutor;
class JSModulesUnbundle;
class MessageQueueThread;
class ModuleRegistry;
using MethodCallResult = folly::Optional<folly::dynamic>;
// This interface describes the delegate interface required by
// Executor implementations to call from JS into native code.
class ExecutorDelegate {

View File

@ -1,7 +1,9 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#include "JSIndexedRAMBundle.h"
#include "oss-compat-util.h"
#include "JSBigString.h"
namespace facebook {
namespace react {

View File

@ -5,16 +5,15 @@
#include <fstream>
#include <memory>
#include <cxxreact/Executor.h>
#include <cxxreact/JSBundleType.h>
#include <cxxreact/JSModulesUnbundle.h>
namespace facebook {
namespace react {
class JSBigString;
class JSBigBufferString;
class JSIndexedRAMBundle : public facebook::react::JSModulesUnbundle {
class JSIndexedRAMBundle : public JSModulesUnbundle {
public:
// Throws std::runtime_error on failure.
JSIndexedRAMBundle(const char *sourceURL);

View File

@ -2,9 +2,9 @@
#pragma once
#include <map>
#include <string>
#include <vector>
#include <map>
#include <folly/dynamic.h>
@ -17,7 +17,7 @@ struct MethodCall {
folly::dynamic arguments;
int callId;
MethodCall(int mod, int meth, folly::dynamic args, int cid)
MethodCall(int mod, int meth, folly::dynamic&& args, int cid)
: moduleId(mod)
, methodId(meth)
, arguments(std::move(args))

View File

@ -3,10 +3,10 @@
#pragma once
#include <memory>
#include <vector>
#include <unordered_set>
#include <vector>
#include <cxxreact/NativeModule.h>
#include <cxxreact/JSExecutor.h>
#include <folly/Optional.h>
#include <folly/dynamic.h>

View File

@ -5,7 +5,7 @@
#include <string>
#include <vector>
#include <cxxreact/Executor.h>
#include <folly/Optional.h>
#include <folly/dynamic.h>
namespace facebook {
@ -21,14 +21,14 @@ struct MethodDescriptor {
, type(std::move(t)) {}
};
using MethodCallResult = folly::Optional<folly::dynamic>;
class NativeModule {
public:
virtual ~NativeModule() {}
virtual std::string getName() = 0;
virtual std::vector<MethodDescriptor> getMethods() = 0;
virtual folly::dynamic getConstants() = 0;
// TODO mhorowitz: do we need initialize()/onCatalystInstanceDestroy() in C++
// or only Java?
virtual void invoke(unsigned int reactMethodId, folly::dynamic&& params, int callId) = 0;
virtual MethodCallResult callSerializableNativeHook(unsigned int reactMethodId, folly::dynamic&& args) = 0;
};

View File

@ -2,19 +2,21 @@
#include "NativeToJsBridge.h"
#ifdef WITH_FBSYSTRACE
#include <fbsystrace.h>
using fbsystrace::FbSystraceAsyncFlow;
#endif
#include <folly/json.h>
#include <folly/Memory.h>
#include <folly/MoveWrapper.h>
#include "Instance.h"
#include "ModuleRegistry.h"
#include "Platform.h"
#include "JSBigString.h"
#include "SystraceSection.h"
#include "MethodCall.h"
#include "JSModulesUnbundle.h"
#include "MessageQueueThread.h"
#ifdef WITH_FBSYSTRACE
#include <fbsystrace.h>
using fbsystrace::FbSystraceAsyncFlow;
#endif
namespace facebook {
namespace react {

View File

@ -7,27 +7,21 @@
#include <map>
#include <vector>
#include <cxxreact/Executor.h>
#include <cxxreact/JSCExecutor.h>
#include <cxxreact/JSModulesUnbundle.h>
#include <cxxreact/MessageQueueThread.h>
#include <cxxreact/MethodCall.h>
#include <cxxreact/NativeModule.h>
#include <folly/dynamic.h>
#include <jschelpers/Value.h>
#include <cxxreact/JSExecutor.h>
namespace folly {
struct dynamic;
}
namespace facebook {
namespace react {
class ModuleRegistry;
class JsToNativeBridge;
struct InstanceCallback;
class JSModulesUnbundle;
class JsToNativeBridge;
class MessageQueueThread;
class ModuleRegistry;
// This class manages calls from native code to JS. It also manages
// executors and their threads. All functions here can be called from

View File

@ -6,7 +6,7 @@
#include <memory>
#include <string>
#include <cxxreact/Executor.h>
#include <cxxreact/JSExecutor.h>
#include <cxxreact/MessageQueueThread.h>
#include <jschelpers/JavaScriptCore.h>

View File

@ -4,8 +4,7 @@
#include <folly/File.h>
#include <gtest/gtest.h>
#include <cxxreact/Executor.h>
#include <cxxreact/MethodCall.h>
#include <cxxreact/JSBigString.h>
using namespace facebook;
using namespace facebook::react;