Change HermesRuntime to jsi::Runtime in RuntimeAdapter

Summary:
Changelog: [Internal]

The inspector API doesn't really need a `HermesRuntime`, all it needs is a `jsi::Runtime` and a `Debugger &`.
Change the return type of `RuntimeAdapter::getRuntime` to be `jsi::Runtime`.
This will allow the inspector to use the tracing runtime instead of the direct hermes runtime.

Reviewed By: willholen

Differential Revision: D18973867

fbshipit-source-id: 6809e52452a35e62be9ca8143aeaba8964c98eaa
This commit is contained in:
Riley Dulin
2020-01-23 13:16:47 -08:00
committed by Facebook Github Bot
parent f92b161eb3
commit e6f3388541
12 changed files with 54 additions and 34 deletions
@@ -50,18 +50,21 @@ class HermesExecutorRuntimeAdapter
virtual ~HermesExecutorRuntimeAdapter() = default;
HermesRuntime &getRuntime() override {
return hermesRuntime_;
jsi::Runtime &getRuntime() override {
return *runtime_;
}
debugger::Debugger &getDebugger() override {
return hermesRuntime_.getDebugger();
}
void tickleJs() override {
// The queue will ensure that runtime_ is still valid when this
// gets invoked.
// clang-format off
thread_->runOnQueue([&runtime = hermesRuntime_]() {
// clang-format on
auto func = runtime.global().getPropertyAsFunction(runtime, "__tickleJs");
func.call(runtime);
thread_->runOnQueue([&runtime = runtime_]() {
auto func =
runtime->global().getPropertyAsFunction(*runtime, "__tickleJs");
func.call(*runtime);
});
}
@@ -193,7 +196,7 @@ std::unique_ptr<JSExecutor> HermesExecutorFactory::createJSExecutor(
std::shared_ptr<MessageQueueThread> jsQueue) {
std::unique_ptr<HermesRuntime> hermesRuntime =
makeHermesRuntimeSystraced(runtimeConfig_);
HermesRuntime& hermesRuntimeRef = *hermesRuntime;
HermesRuntime &hermesRuntimeRef = *hermesRuntime;
auto decoratedRuntime = std::make_shared<DecoratedRuntime>(
makeTracingHermesRuntime(std::move(hermesRuntime), runtimeConfig_),
hermesRuntimeRef,