Skip to content

Commit

Permalink
tag INITIALIZE_MODULE marker with the non-zero instance key
Browse files Browse the repository at this point in the history
Reviewed By: javache

Differential Revision: D5255044

fbshipit-source-id: 9bd72970488cfba4271562e83416f6515b9e77b3
  • Loading branch information
aaronechiu authored and facebook-github-bot committed Jun 15, 2017
1 parent 559805d commit e48ad96
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand All @@ -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;
Expand All @@ -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
Expand All @@ -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();
}
}
Expand Down

0 comments on commit e48ad96

Please sign in to comment.