Skip to content

Commit

Permalink
Don't try to create tracing runtimes in OSS RN
Browse files Browse the repository at this point in the history
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
  • Loading branch information
willholen authored and facebook-github-bot committed Mar 2, 2020
1 parent 3508017 commit 5166856
Showing 1 changed file with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 5166856

Please sign in to comment.