cxxreact: executors: insert ID of segment reliably into the bundle path
Reviewed By: fromcelticpark Differential Revision: D7623232 fbshipit-source-id: df833d18f0445d52e3098b58aac347a2e9aa0040
This commit is contained in:
parent
2e7dfd5213
commit
5fd92f90af
|
@ -1215,6 +1215,7 @@
|
|||
CF2731C11E7B8DE40044CA4F /* RCTDeviceInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = CF2731BF1E7B8DE40044CA4F /* RCTDeviceInfo.m */; };
|
||||
CF2731C21E7B8DEF0044CA4F /* RCTDeviceInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = CF2731BE1E7B8DE40044CA4F /* RCTDeviceInfo.h */; };
|
||||
CF2731C31E7B8DF30044CA4F /* RCTDeviceInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = CF2731BF1E7B8DE40044CA4F /* RCTDeviceInfo.m */; };
|
||||
E223624420875A8000108244 /* JSExecutor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E223624320875A8000108244 /* JSExecutor.cpp */; };
|
||||
E9B20B7B1B500126007A2DA7 /* RCTAccessibilityManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E9B20B7A1B500126007A2DA7 /* RCTAccessibilityManager.m */; };
|
||||
EBF21BBC1FC498270052F4D5 /* InspectorInterfaces.h in Headers */ = {isa = PBXBuildFile; fileRef = EBF21BBA1FC498270052F4D5 /* InspectorInterfaces.h */; };
|
||||
EBF21BBD1FC498270052F4D5 /* InspectorInterfaces.cpp in Sources */ = {isa = PBXBuildFile; fileRef = EBF21BBB1FC498270052F4D5 /* InspectorInterfaces.cpp */; };
|
||||
|
@ -2305,6 +2306,7 @@
|
|||
C6D380191F71D75B00621378 /* RAMBundleRegistry.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RAMBundleRegistry.cpp; sourceTree = "<group>"; };
|
||||
CF2731BE1E7B8DE40044CA4F /* RCTDeviceInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTDeviceInfo.h; sourceTree = "<group>"; };
|
||||
CF2731BF1E7B8DE40044CA4F /* RCTDeviceInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDeviceInfo.m; sourceTree = "<group>"; };
|
||||
E223624320875A8000108244 /* JSExecutor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSExecutor.cpp; sourceTree = "<group>"; };
|
||||
E3BBC8EB1ADE6F47001BBD81 /* RCTTextDecorationLineType.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RCTTextDecorationLineType.h; sourceTree = "<group>"; };
|
||||
E9B20B791B500126007A2DA7 /* RCTAccessibilityManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTAccessibilityManager.h; sourceTree = "<group>"; };
|
||||
E9B20B7A1B500126007A2DA7 /* RCTAccessibilityManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAccessibilityManager.m; sourceTree = "<group>"; };
|
||||
|
@ -3034,6 +3036,7 @@
|
|||
AC70D2EA1DE489FC002E6351 /* cxxreact */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E223624320875A8000108244 /* JSExecutor.cpp */,
|
||||
3D92B0A71E03699D0018521A /* CxxModule.h */,
|
||||
3D92B0A81E03699D0018521A /* CxxNativeModule.cpp */,
|
||||
3D92B0A91E03699D0018521A /* CxxNativeModule.h */,
|
||||
|
@ -4440,6 +4443,7 @@
|
|||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
13134C9A1E296B2A00B9F3CB /* RCTCxxMethod.mm in Sources */,
|
||||
E223624420875A8000108244 /* JSExecutor.cpp in Sources */,
|
||||
59500D451F71C63F00B122B7 /* RCTUIManagerUtils.m in Sources */,
|
||||
597633361F4E021D005BE8A4 /* RCTShadowView+Internal.m in Sources */,
|
||||
13723B501A82FD3C00F88898 /* RCTStatusBarManager.m in Sources */,
|
||||
|
|
|
@ -17,6 +17,7 @@ LOCAL_SRC_FILES := \
|
|||
JSCSamplingProfiler.cpp \
|
||||
JSCTracing.cpp \
|
||||
JSCUtils.cpp \
|
||||
JSExecutor.cpp \
|
||||
JSIndexedRAMBundle.cpp \
|
||||
MethodCall.cpp \
|
||||
ModuleRegistry.cpp \
|
||||
|
|
|
@ -89,6 +89,7 @@ CXXREACT_PUBLIC_HEADERS = [
|
|||
"JSExecutor.h",
|
||||
"JSCExecutor.h",
|
||||
"JSCNativeModules.h",
|
||||
"JSCUtils.h",
|
||||
"JSIndexedRAMBundle.h",
|
||||
"JSModulesUnbundle.h",
|
||||
"MessageQueueThread.h",
|
||||
|
|
|
@ -458,13 +458,16 @@ namespace facebook {
|
|||
m_bundleRegistry = std::move(bundleRegistry);
|
||||
}
|
||||
|
||||
void JSCExecutor::registerBundle(uint32_t bundleId, const std::string& bundlePath) {
|
||||
void JSCExecutor::registerBundle(
|
||||
uint32_t bundleId,
|
||||
const std::string& bundlePath) {
|
||||
if (m_bundleRegistry) {
|
||||
m_bundleRegistry->registerBundle(bundleId, bundlePath);
|
||||
} else {
|
||||
auto sourceUrl = String(m_context, bundlePath.c_str());
|
||||
auto stPath = JSCExecutor::getSyntheticBundlePath(bundleId, bundlePath);
|
||||
auto sourceUrlStr = String(m_context, stPath.c_str());
|
||||
auto source = adoptString(JSBigFileString::fromPath(bundlePath));
|
||||
evaluateScript(m_context, source, sourceUrl);
|
||||
evaluateScript(m_context, source, sourceUrlStr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include "JSCUtils.h"
|
||||
|
||||
#include "RAMBundleRegistry.h"
|
||||
|
||||
#include <folly/Conv.h>
|
||||
|
||||
namespace facebook {
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
// Copyright 2004-present Facebook. All Rights Reserved.
|
||||
|
||||
#include "JSExecutor.h"
|
||||
|
||||
#include "RAMBundleRegistry.h"
|
||||
|
||||
#include <folly/Conv.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
std::string JSExecutor::getSyntheticBundlePath(
|
||||
uint32_t bundleId,
|
||||
const std::string& bundlePath) {
|
||||
if (bundleId == RAMBundleRegistry::MAIN_BUNDLE_ID) {
|
||||
return bundlePath;
|
||||
}
|
||||
return folly::to<std::string>("seg-", bundleId, ".js");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -101,6 +101,10 @@ public:
|
|||
|
||||
virtual void destroy() {}
|
||||
virtual ~JSExecutor() {}
|
||||
|
||||
static std::string getSyntheticBundlePath(
|
||||
uint32_t bundleId,
|
||||
const std::string& bundlePath);
|
||||
};
|
||||
|
||||
} }
|
||||
|
|
Loading…
Reference in New Issue