Adding support in the new RN bridge on iOS

Differential Revision: D4393955

fbshipit-source-id: e5f3fb6773908678773a5dd4fdea568bcc200336
This commit is contained in:
Dan Caspi
2017-01-10 11:19:09 -08:00
committed by Facebook Github Bot
parent 7c2f8a9e14
commit b50f55026a
7 changed files with 51 additions and 22 deletions

View File

@@ -1,15 +1,16 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#ifdef WITH_JSC_EXTRA_TRACING
#include "JSCSamplingProfiler.h"
#include <stdio.h>
#include <string.h>
#include <JavaScriptCore/API/JSProfilerPrivate.h>
#include <jschelpers/JSCHelpers.h>
#include <jschelpers/Value.h>
#ifndef __APPLE__
#include <JavaScriptCore/API/JSProfilerPrivate.h>
#endif
namespace facebook {
namespace react {
namespace {
@@ -26,10 +27,11 @@ static JSValueRef pokeSamplingProfiler(
void initSamplingProfilerOnMainJSCThread(JSGlobalContextRef ctx) {
JSC_JSStartSamplingProfilingOnMainJSCThread(ctx);
// Allow the profiler to be poked from JS as well
// (see SamplingProfiler.js for an example of how it could be used with the JSCSamplingProfiler module).
installGlobalFunction(ctx, "pokeSamplingProfiler", pokeSamplingProfiler);
}
}
}
#endif // WITH_JSC_EXTRA_TRACING