From e48ad9609c0566a2e8c50218f56b958d826d1524 Mon Sep 17 00:00:00 2001 From: Aaron Chiu Date: Thu, 15 Jun 2017 02:41:02 -0700 Subject: [PATCH] tag INITIALIZE_MODULE marker with the non-zero instance key Reviewed By: javache Differential Revision: D5255044 fbshipit-source-id: 9bd72970488cfba4271562e83416f6515b9e77b3 --- .../java/com/facebook/react/bridge/ModuleHolder.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ReactAndroid/src/main/java/com/facebook/react/bridge/ModuleHolder.java b/ReactAndroid/src/main/java/com/facebook/react/bridge/ModuleHolder.java index 45d7b0cf3d5acf..2730e94be4a30b 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/bridge/ModuleHolder.java +++ b/ReactAndroid/src/main/java/com/facebook/react/bridge/ModuleHolder.java @@ -32,6 +32,8 @@ public class ModuleHolder { private static final AtomicInteger sInstanceKeyCounter = new AtomicInteger(1); + private final int mInstanceKey = sInstanceKeyCounter.getAndIncrement(); + private final String mName; private final boolean mCanOverrideExistingModule; private final boolean mHasConstants; @@ -149,8 +151,7 @@ public NativeModule getModule() { private NativeModule create() { SoftAssertions.assertCondition(mModule == null, "Creating an already created module."); - int instanceKey = sInstanceKeyCounter.getAndIncrement(); - ReactMarker.logMarker(CREATE_MODULE_START, mName, instanceKey); + ReactMarker.logMarker(CREATE_MODULE_START, mName, mInstanceKey); SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "ModuleHolder.createModule") .arg("name", mName) .flush(); @@ -169,7 +170,7 @@ private NativeModule create() { doInitialize(module); } } finally { - ReactMarker.logMarker(CREATE_MODULE_END, instanceKey); + ReactMarker.logMarker(CREATE_MODULE_END, mInstanceKey); SystraceMessage.endSection(TRACE_TAG_REACT_JAVA_BRIDGE).flush(); } return module; @@ -179,7 +180,7 @@ private void doInitialize(NativeModule module) { SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "ModuleHolder.initialize") .arg("name", mName) .flush(); - ReactMarker.logMarker(ReactMarkerConstants.INITIALIZE_MODULE_START, mName); + ReactMarker.logMarker(ReactMarkerConstants.INITIALIZE_MODULE_START, mName, mInstanceKey); try { boolean shouldInitialize = false; // Check to see if another thread is initializing the object, if not claim the responsibility @@ -198,7 +199,7 @@ private void doInitialize(NativeModule module) { } } } finally { - ReactMarker.logMarker(ReactMarkerConstants.INITIALIZE_MODULE_END); + ReactMarker.logMarker(ReactMarkerConstants.INITIALIZE_MODULE_END, mInstanceKey); SystraceMessage.endSection(TRACE_TAG_REACT_JAVA_BRIDGE).flush(); } }