make the CREATE_MODULE marker actually end

Reviewed By: fkgozali

Differential Revision: D5024378

fbshipit-source-id: 6f25ecd15e25a6d9aabaa52013c2abe24a3f8fb9
This commit is contained in:
Aaron Chiu
2017-05-11 20:00:21 -07:00
committed by Facebook Github Bot
parent 2fbe3b799e
commit c7317c5e61
2 changed files with 31 additions and 6 deletions
@@ -5,6 +5,8 @@ package com.facebook.react.bridge;
import javax.annotation.Nullable;
import javax.inject.Provider;
import java.util.concurrent.atomic.AtomicInteger;
import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.react.bridge.NativeModule;
import com.facebook.react.bridge.ReactMarker;
@@ -30,6 +32,8 @@ import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
@DoNotStrip
public class ModuleHolder {
private static final AtomicInteger sInstanceKeyCounter = new AtomicInteger(1);
private final String mName;
private final boolean mCanOverrideExistingModule;
private final boolean mHasConstants;
@@ -96,7 +100,8 @@ public class ModuleHolder {
private NativeModule create() {
SoftAssertions.assertCondition(mModule == null, "Creating an already created module.");
ReactMarker.logMarker(CREATE_MODULE_START, mName);
int instanceKey = sInstanceKeyCounter.getAndIncrement();
ReactMarker.logMarker(CREATE_MODULE_START, mName, instanceKey);
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "createModule")
.arg("name", mName)
.flush();
@@ -110,7 +115,7 @@ public class ModuleHolder {
}
} finally {
Systrace.endSection(TRACE_TAG_REACT_JAVA_BRIDGE);
ReactMarker.logMarker(CREATE_MODULE_END);
ReactMarker.logMarker(CREATE_MODULE_END, instanceKey);
}
return module;
}