RN trigger heap capture from js1
Differential Revision: D4397603 fbshipit-source-id: 566cfad9ce47bcc8cddb9219ed9f6a427ce19f84
This commit is contained in:
parent
9724eaeb42
commit
64f394a99b
|
@ -83,6 +83,7 @@ public class DevServerHelper {
|
|||
|
||||
public interface PackagerCommandListener {
|
||||
void onPackagerReloadCommand();
|
||||
void onCaptureHeapCommand();
|
||||
}
|
||||
|
||||
public interface PackagerStatusCallback {
|
||||
|
@ -123,8 +124,12 @@ public class DevServerHelper {
|
|||
new JSPackagerWebSocketClient.JSPackagerCallback() {
|
||||
@Override
|
||||
public void onMessage(String target, String action) {
|
||||
if (commandListener != null && "bridge".equals(target) && "reload".equals(action)) {
|
||||
commandListener.onPackagerReloadCommand();
|
||||
if (commandListener != null && "bridge".equals(target)) {
|
||||
if ("reload".equals(action)) {
|
||||
commandListener.onPackagerReloadCommand();
|
||||
} else if ("captureHeap".equals(action)) {
|
||||
commandListener.onCaptureHeapCommand();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -417,9 +417,7 @@ public class DevSupportManagerImpl implements DevSupportManager, PackagerCommand
|
|||
new DevOptionHandler() {
|
||||
@Override
|
||||
public void onOptionSelected() {
|
||||
JSCHeapCapture.captureHeap(
|
||||
mApplicationContext.getCacheDir().getPath(),
|
||||
JSCHeapUpload.captureCallback(mDevServerHelper.getHeapCaptureUploadUrl()));
|
||||
handleCaptureHeap();
|
||||
}
|
||||
});
|
||||
options.put(
|
||||
|
@ -691,6 +689,22 @@ public class DevSupportManagerImpl implements DevSupportManager, PackagerCommand
|
|||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCaptureHeapCommand() {
|
||||
UiThreadUtil.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
handleCaptureHeap();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void handleCaptureHeap() {
|
||||
JSCHeapCapture.captureHeap(
|
||||
mApplicationContext.getCacheDir().getPath(),
|
||||
JSCHeapUpload.captureCallback(mDevServerHelper.getHeapCaptureUploadUrl()));
|
||||
}
|
||||
|
||||
private void updateLastErrorInfo(
|
||||
final String message,
|
||||
final StackFrame[] stack,
|
||||
|
|
Loading…
Reference in New Issue