WebWorkers: Rename Bridge.m_jsExecutor -> Bridge.m_mainExecutor

Reviewed By: cjhopman

Differential Revision: D2921994

fb-gh-sync-id: ec06b922264a443932eb0446ff820aaf3dcacaa7
shipit-source-id: ec06b922264a443932eb0446ff820aaf3dcacaa7
This commit is contained in:
Andy Street
2016-02-12 09:09:44 -08:00
committed by facebook-github-bot-5
parent 0de8860a46
commit 9547264a96
2 changed files with 13 additions and 13 deletions

View File

@@ -13,24 +13,24 @@ namespace react {
Bridge::Bridge(JSExecutorFactory* jsExecutorFactory, Callback callback) :
m_callback(std::move(callback)),
m_destroyed(std::shared_ptr<bool>(new bool(false))) {
m_jsExecutor = jsExecutorFactory->createJSExecutor(this);
m_mainExecutor = jsExecutorFactory->createJSExecutor(this);
}
// This must be called on the same thread on which the constructor was called.
Bridge::~Bridge() {
*m_destroyed = true;
m_jsExecutor.reset();
m_mainExecutor.reset();
}
void Bridge::loadApplicationScript(const std::string& script, const std::string& sourceURL) {
m_jsExecutor->loadApplicationScript(script, sourceURL);
m_mainExecutor->loadApplicationScript(script, sourceURL);
}
void Bridge::loadApplicationUnbundle(
std::unique_ptr<JSModulesUnbundle> unbundle,
const std::string& startupCode,
const std::string& sourceURL) {
m_jsExecutor->loadApplicationUnbundle(std::move(unbundle), startupCode, sourceURL);
m_mainExecutor->loadApplicationUnbundle(std::move(unbundle), startupCode, sourceURL);
}
void Bridge::callFunction(const double moduleId, const double methodId, const folly::dynamic& arguments) {
@@ -40,7 +40,7 @@ void Bridge::callFunction(const double moduleId, const double methodId, const fo
#ifdef WITH_FBSYSTRACE
FbSystraceSection s(TRACE_TAG_REACT_CXX_BRIDGE, "Bridge.callFunction");
#endif
m_jsExecutor->callFunction(moduleId, methodId, arguments);
m_mainExecutor->callFunction(moduleId, methodId, arguments);
}
void Bridge::invokeCallback(const double callbackId, const folly::dynamic& arguments) {
@@ -50,31 +50,31 @@ void Bridge::invokeCallback(const double callbackId, const folly::dynamic& argum
#ifdef WITH_FBSYSTRACE
FbSystraceSection s(TRACE_TAG_REACT_CXX_BRIDGE, "Bridge.invokeCallback");
#endif
m_jsExecutor->invokeCallback(callbackId, arguments);
m_mainExecutor->invokeCallback(callbackId, arguments);
}
void Bridge::setGlobalVariable(const std::string& propName, const std::string& jsonValue) {
m_jsExecutor->setGlobalVariable(propName, jsonValue);
m_mainExecutor->setGlobalVariable(propName, jsonValue);
}
bool Bridge::supportsProfiling() {
return m_jsExecutor->supportsProfiling();
return m_mainExecutor->supportsProfiling();
}
void Bridge::startProfiler(const std::string& title) {
m_jsExecutor->startProfiler(title);
m_mainExecutor->startProfiler(title);
}
void Bridge::stopProfiler(const std::string& title, const std::string& filename) {
m_jsExecutor->stopProfiler(title, filename);
m_mainExecutor->stopProfiler(title, filename);
}
void Bridge::handleMemoryPressureModerate() {
m_jsExecutor->handleMemoryPressureModerate();
m_mainExecutor->handleMemoryPressureModerate();
}
void Bridge::handleMemoryPressureCritical() {
m_jsExecutor->handleMemoryPressureCritical();
m_mainExecutor->handleMemoryPressureCritical();
}
void Bridge::callNativeModules(const std::string& callJSON, bool isEndOfBatch) {

View File

@@ -70,7 +70,7 @@ private:
// on the same thread. In that case, the callback will try to run the task on m_callback which
// will have been destroyed within ~Bridge(), thus causing a SIGSEGV.
std::shared_ptr<bool> m_destroyed;
std::unique_ptr<JSExecutor> m_jsExecutor;
std::unique_ptr<JSExecutor> m_mainExecutor;
};
} }