Permalink
Browse files

Fix SamplingProfiler and HeapCapture for apps that lazy load react mo…

…dules

Reviewed By: cwdick

Differential Revision: D4291903

fbshipit-source-id: 684ced8d6370494191cdb182a8e172680d69d17b
  • Loading branch information...
1 parent 8fb2440 commit d919eb746e4b6c508edee0d62487970144021f67 Lukas Piatkowski committed with mkonicek Dec 7, 2016
@@ -22,7 +22,9 @@
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.module.annotations.ReactModule;
-@ReactModule(name = "JSCHeapCapture")
+// This module is being called only by Java via the static method "captureHeap" that
+// requires it to alreay be initialized, thus we eagerly initialize this module
+@ReactModule(name = "JSCHeapCapture", needsEagerInit = true)
public class JSCHeapCapture extends ReactContextBaseJavaModule {
public interface HeapCapture extends JavaScriptModule {
void captureHeap(String path);
@@ -21,7 +21,9 @@
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.module.annotations.ReactModule;
-@ReactModule(name = "JSCSamplingProfiler")
+// This module is being called only by Java via the static method "poke" that
+// requires it to alreay be initialized, thus we eagerly initialize this module
+@ReactModule(name = "JSCSamplingProfiler", needsEagerInit = true)
public class JSCSamplingProfiler extends ReactContextBaseJavaModule {
public interface SamplingProfiler extends JavaScriptModule {
void poke(int token);

0 comments on commit d919eb7

Please sign in to comment.