tag INITIALIZE_MODULE marker with the non-zero instance key

Reviewed By: javache

Differential Revision: D5255044

fbshipit-source-id: 9bd72970488cfba4271562e83416f6515b9e77b3
This commit is contained in:
Aaron Chiu 2017-06-15 02:41:02 -07:00 committed by Facebook Github Bot
parent 559805d0b0
commit e48ad9609c
1 changed files with 6 additions and 5 deletions

View File

@ -32,6 +32,8 @@ public class ModuleHolder {
private static final AtomicInteger sInstanceKeyCounter = new AtomicInteger(1); private static final AtomicInteger sInstanceKeyCounter = new AtomicInteger(1);
private final int mInstanceKey = sInstanceKeyCounter.getAndIncrement();
private final String mName; private final String mName;
private final boolean mCanOverrideExistingModule; private final boolean mCanOverrideExistingModule;
private final boolean mHasConstants; private final boolean mHasConstants;
@ -149,8 +151,7 @@ public class ModuleHolder {
private NativeModule create() { private NativeModule create() {
SoftAssertions.assertCondition(mModule == null, "Creating an already created module."); SoftAssertions.assertCondition(mModule == null, "Creating an already created module.");
int instanceKey = sInstanceKeyCounter.getAndIncrement(); ReactMarker.logMarker(CREATE_MODULE_START, mName, mInstanceKey);
ReactMarker.logMarker(CREATE_MODULE_START, mName, instanceKey);
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "ModuleHolder.createModule") SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "ModuleHolder.createModule")
.arg("name", mName) .arg("name", mName)
.flush(); .flush();
@ -169,7 +170,7 @@ public class ModuleHolder {
doInitialize(module); doInitialize(module);
} }
} finally { } finally {
ReactMarker.logMarker(CREATE_MODULE_END, instanceKey); ReactMarker.logMarker(CREATE_MODULE_END, mInstanceKey);
SystraceMessage.endSection(TRACE_TAG_REACT_JAVA_BRIDGE).flush(); SystraceMessage.endSection(TRACE_TAG_REACT_JAVA_BRIDGE).flush();
} }
return module; return module;
@ -179,7 +180,7 @@ public class ModuleHolder {
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "ModuleHolder.initialize") SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "ModuleHolder.initialize")
.arg("name", mName) .arg("name", mName)
.flush(); .flush();
ReactMarker.logMarker(ReactMarkerConstants.INITIALIZE_MODULE_START, mName); ReactMarker.logMarker(ReactMarkerConstants.INITIALIZE_MODULE_START, mName, mInstanceKey);
try { try {
boolean shouldInitialize = false; boolean shouldInitialize = false;
// Check to see if another thread is initializing the object, if not claim the responsibility // Check to see if another thread is initializing the object, if not claim the responsibility
@ -198,7 +199,7 @@ public class ModuleHolder {
} }
} }
} finally { } finally {
ReactMarker.logMarker(ReactMarkerConstants.INITIALIZE_MODULE_END); ReactMarker.logMarker(ReactMarkerConstants.INITIALIZE_MODULE_END, mInstanceKey);
SystraceMessage.endSection(TRACE_TAG_REACT_JAVA_BRIDGE).flush(); SystraceMessage.endSection(TRACE_TAG_REACT_JAVA_BRIDGE).flush();
} }
} }