Skip to content

Commit

Permalink
add Native Module init
Browse files Browse the repository at this point in the history
Reviewed By: achen1

Differential Revision: D5740540

fbshipit-source-id: 9989424812fdcfd0a54c2ccf1e973aa7cc2a1f67
  • Loading branch information
aaronechiu authored and facebook-github-bot committed Sep 20, 2017
1 parent 08befb7 commit 565a241
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ public class ReactDebugOverlayTags {
public static final DebugOverlayTag BRIDGE_CALLS =
new DebugOverlayTag(
"Bridge Calls", "JS to Java calls (warning: this is spammy)", Color.MAGENTA);
public static final DebugOverlayTag NATIVE_MODULE =
new DebugOverlayTag("Native Module", "Native Module init", Color.rgb(0x80, 0x00, 0x80));
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,21 @@

package com.facebook.react.bridge;

import javax.annotation.Nullable;
import javax.annotation.concurrent.GuardedBy;
import javax.inject.Provider;

import java.util.concurrent.atomic.AtomicInteger;
import static com.facebook.infer.annotation.Assertions.assertNotNull;
import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_MODULE_END;
import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_MODULE_START;
import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;

import com.facebook.debug.holder.PrinterHolder;
import com.facebook.debug.tags.ReactDebugOverlayTags;
import com.facebook.infer.annotation.Assertions;
import com.facebook.proguard.annotations.DoNotStrip;
import com.facebook.react.module.model.ReactModuleInfo;
import com.facebook.systrace.SystraceMessage;

import static com.facebook.infer.annotation.Assertions.assertNotNull;
import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_MODULE_END;
import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_MODULE_START;
import static com.facebook.systrace.Systrace.TRACE_TAG_REACT_JAVA_BRIDGE;
import java.util.concurrent.atomic.AtomicInteger;
import javax.annotation.Nullable;
import javax.annotation.concurrent.GuardedBy;
import javax.inject.Provider;

/**
* Holder to enable us to lazy create native modules.
Expand Down Expand Up @@ -62,6 +62,8 @@ public ModuleHolder(NativeModule nativeModule) {
mCanOverrideExistingModule = nativeModule.canOverrideExistingModule();
mHasConstants = true;
mModule = nativeModule;
PrinterHolder.getPrinter()
.logMessage(ReactDebugOverlayTags.NATIVE_MODULE, "NativeModule init: %s", mName);
}

/*
Expand Down Expand Up @@ -155,6 +157,8 @@ private NativeModule create() {
SystraceMessage.beginSection(TRACE_TAG_REACT_JAVA_BRIDGE, "ModuleHolder.createModule")
.arg("name", mName)
.flush();
PrinterHolder.getPrinter()
.logMessage(ReactDebugOverlayTags.NATIVE_MODULE, "NativeModule init: %s", mName);
NativeModule module;
try {
module = assertNotNull(mProvider).get();
Expand Down

0 comments on commit 565a241

Please sign in to comment.