Don't try to create tracing runtimes in OSS RN

Summary:
Tracing isn't supported in OSS builds, so use `hermes/hermes.h` instead
of `hermes_tracing.h` to avoid pulling in any unnecessary dependencies.

Changelog: [Internal]

Reviewed By: dulinriley

Differential Revision: D20201826

fbshipit-source-id: 4c2977db191bb9a1a82310888a435b761629169b
This commit is contained in:
Will Holen
2020-03-02 15:04:26 -08:00
committed by Facebook Github Bot
parent 3508017fb3
commit 5166856d04
@@ -11,7 +11,7 @@
#include <cxxreact/MessageQueueThread.h>
#include <cxxreact/SystraceSection.h>
#include <hermes/hermes_tracing.h>
#include <hermes/hermes.h>
#include <jsi/decorator.h>
#ifdef HERMES_ENABLE_DEBUGGER
@@ -148,7 +148,7 @@ struct ReentrancyCheck {
// Runtime.
class DecoratedRuntime : public jsi::WithRuntimeDecorator<ReentrancyCheck> {
public:
// The first argument may be a tracing runtime which itself
// The first argument may be another decorater which itself
// decorates the real HermesRuntime, depending on the build config.
// The second argument is the the real HermesRuntime as well to
// manage the debugger registration.
@@ -176,9 +176,8 @@ class DecoratedRuntime : public jsi::WithRuntimeDecorator<ReentrancyCheck> {
}
private:
// runtime_ is a TracingRuntime, but we don't need to worry about
// the details. hermesRuntime is a reference to the HermesRuntime
// managed by the TracingRuntime.
// runtime_ is a potentially decorated Runtime.
// hermesRuntime is a reference to a HermesRuntime managed by runtime_.
//
// HermesExecutorRuntimeAdapter requirements are kept, because the
// dtor will disable debugging on the HermesRuntime before the
@@ -198,18 +197,18 @@ std::unique_ptr<JSExecutor> HermesExecutorFactory::createJSExecutor(
makeHermesRuntimeSystraced(runtimeConfig_);
HermesRuntime &hermesRuntimeRef = *hermesRuntime;
auto decoratedRuntime = std::make_shared<DecoratedRuntime>(
makeTracingHermesRuntime(std::move(hermesRuntime), runtimeConfig_),
std::move(hermesRuntime),
hermesRuntimeRef,
jsQueue);
// So what do we have now?
// DecoratedRuntime -> TracingRuntime -> HermesRuntime
// DecoratedRuntime -> HermesRuntime
//
// DecoratedRuntime is held by JSIExecutor. When it gets used, it
// will check that it's on the right thread, do any necessary trace
// logging, then call the real HermesRuntime. When it is destroyed,
// it will shut down the debugger before the HermesRuntime is. In
// the normal case where tracing and debugging are not compiled in,
// the normal case where debugging is not compiled in,
// all that's left is the thread checking.
// Add js engine information to Error.prototype so in error reporting we