Remove unused JS Sampling Profiler code

Reviewed By: cwdick

Differential Revision: D7803915

fbshipit-source-id: 3edb42d449ff7b272f7d25ac8f16a646839f8c20
This commit is contained in:
Marc Horowitz
2018-05-09 22:01:36 -07:00
committed by Facebook Github Bot
parent ef258b0106
commit d1d09c208a
11 changed files with 1 additions and 306 deletions

View File

@@ -81,7 +81,6 @@ public class DevServerHelper {
void onPackagerReloadCommand();
void onPackagerDevMenuCommand();
void onCaptureHeapCommand(final Responder responder);
void onPokeSamplingProfilerCommand(final Responder responder);
}
public interface SymbolicationListener {
@@ -163,12 +162,6 @@ public class DevServerHelper {
commandListener.onCaptureHeapCommand(responder);
}
});
handlers.put("pokeSamplingProfiler", new RequestOnlyHandler() {
@Override
public void onRequest(@Nullable Object params, Responder responder) {
commandListener.onPokeSamplingProfilerCommand(responder);
}
});
handlers.putAll(new FileIoHandler().handlers());
ConnectionCallback onPackagerConnectedCallback =

View File

@@ -841,29 +841,6 @@ public class DevSupportManagerImpl implements
});
}
@Override
public void onPokeSamplingProfilerCommand(final Responder responder) {
UiThreadUtil.runOnUiThread(new Runnable() {
@Override
public void run() {
if (mCurrentContext == null) {
responder.error("JSCContext is missing, unable to profile");
return;
}
try {
JavaScriptContextHolder jsContext = mCurrentContext.getJavaScriptContextHolder();
synchronized (jsContext) {
Class clazz = Class.forName("com.facebook.react.packagerconnection.SamplingProfilerPackagerMethod");
RequestHandler handler = (RequestHandler)clazz.getConstructor(long.class).newInstance(jsContext.get());
handler.onRequest(null, responder);
}
} catch (Exception e) {
// Module not present
}
}
});
}
private void handleCaptureHeap(final Responder responder) {
if (mCurrentContext == null) {
return;

View File

@@ -4,7 +4,6 @@ rn_android_library(
name = "packagerconnection",
srcs = glob(
["**/*.java"],
excludes = ["SamplingProfilerPackagerMethod.java"] if IS_OSS_BUILD else [],
),
visibility = [
"PUBLIC",
@@ -19,5 +18,5 @@ rn_android_library(
react_native_dep("third-party/java/okhttp:okhttp3"),
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")] if not IS_OSS_BUILD else []),
],
)

View File

@@ -1,53 +0,0 @@
/**
* Copyright (c) 2015-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.packagerconnection;
import javax.annotation.Nullable;
import android.os.Looper;
import com.facebook.jni.HybridData;
import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.soloader.SoLoader;
public class SamplingProfilerPackagerMethod extends RequestOnlyHandler {
static {
SoLoader.loadLibrary("packagerconnectionjnifb");
}
final private static class SamplingProfilerJniMethod {
@DoNotStrip
private final HybridData mHybridData;
public SamplingProfilerJniMethod(long javaScriptContext) {
if (Looper.myLooper() == null) {
Looper.prepare();
}
mHybridData = initHybrid(javaScriptContext);
}
@DoNotStrip
private native void poke(Responder responder);
@DoNotStrip
private static native HybridData initHybrid(long javaScriptContext);
}
private SamplingProfilerJniMethod mJniMethod;
public SamplingProfilerPackagerMethod(long javaScriptContext) {
mJniMethod = new SamplingProfilerJniMethod(javaScriptContext);
}
@Override
public void onRequest(@Nullable Object params, Responder responder) {
mJniMethod.poke(responder);
}
}