Disable SamplingProfiler for OSS builds

Summary:
It depends on symbols that are not available.
Closes https://github.com/facebook/react-native/pull/13950

Reviewed By: cwdick

Differential Revision: D5053724

Pulled By: javache

fbshipit-source-id: 9d5676ce5e4ad3ceeb20aeb8c48429319d48799e
This commit is contained in:
Pieter De Baets
2017-05-15 07:47:00 -07:00
committed by Facebook Github Bot
parent 2f5524d04e
commit 0c1e009ad9
5 changed files with 49 additions and 40 deletions

View File

@@ -45,7 +45,7 @@ import com.facebook.react.devsupport.interfaces.StackFrame;
import com.facebook.react.modules.debug.interfaces.DeveloperSettings;
import com.facebook.react.packagerconnection.JSPackagerClient;
import com.facebook.react.packagerconnection.Responder;
import com.facebook.react.packagerconnection.SamplingProfilerPackagerMethod;
import com.facebook.react.packagerconnection.RequestHandler;
import java.io.File;
import java.io.IOException;
@@ -699,9 +699,14 @@ public class DevSupportManagerImpl implements
responder.error("JSCContext is missing, unable to profile");
return;
}
SamplingProfilerPackagerMethod method =
new SamplingProfilerPackagerMethod(mCurrentContext.getJavaScriptContext());
method.onRequest(null, responder);
try {
long jsContext = mCurrentContext.getJavaScriptContext();
Class clazz = Class.forName("com.facebook.react.packagerconnection.SamplingProfilerPackagerMethod");
RequestHandler handler = (RequestHandler)clazz.getConstructor(long.class).newInstance(jsContext);
handler.onRequest(null, responder);
} catch (Exception e) {
// Module not present
}
}
});
}

View File

@@ -2,7 +2,10 @@ include_defs("//ReactAndroid/DEFS")
android_library(
name = "packagerconnection",
srcs = glob(["**/*.java"]),
srcs = glob(
["**/*.java"],
excludes = ["SamplingProfilerPackagerMethod.java"] if IS_OSS_BUILD else [],
),
visibility = [
"PUBLIC",
],
@@ -17,6 +20,5 @@ android_library(
react_native_dep("third-party/java/okhttp:okhttp3-ws"),
react_native_dep("third-party/java/okio:okio"),
react_native_target("java/com/facebook/react/modules/systeminfo:systeminfo-moduleless"),
react_native_target("jni/packagerconnection:jni"),
],
] + ([react_native_target("jni/packagerconnection:jni")] if not IS_OSS_BUILD else []),
)

View File

@@ -1,32 +1,33 @@
include_defs("//ReactAndroid/DEFS")
cxx_library(
name = "jni",
srcs = glob(["*.cpp"]),
compiler_flags = [
"-Wall",
"-Werror",
"-fexceptions",
"-std=c++1y",
"-frtti",
],
header_namespace = "",
headers = glob(
["*.h"],
),
preprocessor_flags = [
"-DLOG_TAG=\"PackagerConnectionJNI\"",
"-DWITH_FBSYSTRACE=1",
"-DWITH_INSPECTOR=1",
],
soname = "libpackagerconnectionjnifb.$(ext)",
visibility = [
"PUBLIC",
],
xcode_public_headers_symlinks = True,
deps = JSC_DEPS + [
FBJNI_TARGET,
"//xplat/folly:molly",
react_native_xplat_target("jschelpers:jschelpers"),
] if not IS_OSS_BUILD else [],
)
if not IS_OSS_BUILD:
cxx_library(
name = "jni",
srcs = glob(["*.cpp"]),
compiler_flags = [
"-Wall",
"-Werror",
"-fexceptions",
"-std=c++1y",
"-frtti",
],
header_namespace = "",
headers = glob(
["*.h"],
),
preprocessor_flags = [
"-DLOG_TAG=\"PackagerConnectionJNI\"",
"-DWITH_FBSYSTRACE=1",
"-DWITH_INSPECTOR=1",
],
soname = "libpackagerconnectionjnifb.$(ext)",
visibility = [
"PUBLIC",
],
xcode_public_headers_symlinks = True,
deps = JSC_DEPS + [
FBJNI_TARGET,
"//xplat/folly:molly",
react_native_xplat_target("jschelpers:jschelpers"),
]
)

View File

@@ -2,6 +2,9 @@
#include "SamplingProfilerJniMethod.h"
#include <JavaScriptCore/JSProfilerPrivate.h>
#include <jschelpers/JSCHelpers.h>
#include <jni.h>
#include <string>

View File

@@ -1,9 +1,7 @@
// Copyright 2004-present Facebook. All Rights Reserved.
#include <JavaScriptCore/JSProfilerPrivate.h>
#include <JavaScriptCore/JSValueRef.h>
#include <fb/fbjni.h>
#include <jschelpers/JSCHelpers.h>
#include <JavaScriptCore/JSValueRef.h>
#include "JSPackagerClientResponder.h"