Add `getName()` method

Summary: adds a `getName()` method to all `JavaScriptExecutor` classes that can be used by `ReactInstanceManager` to identify the bridge type when logging markers.

Reviewed By: fromcelticpark

Differential Revision: D7790531

fbshipit-source-id: efe485588738a38936accc4a7956840784b2dd08
This commit is contained in:
David Aurelio 2018-05-01 13:02:32 -07:00 committed by Facebook Github Bot
parent 837d496ac8
commit 8e3105dbce
3 changed files with 16 additions and 0 deletions

View File

@ -20,5 +20,11 @@ import com.facebook.proguard.annotations.DoNotStrip;
super(initHybrid(jscConfig)); super(initHybrid(jscConfig));
} }
@Override
public String getName() {
return "JSCJavaScriptExecutor";
}
private native static HybridData initHybrid(ReadableNativeMap jscConfig); private native static HybridData initHybrid(ReadableNativeMap jscConfig);
} }

View File

@ -26,4 +26,9 @@ public abstract class JavaScriptExecutor {
public void close() { public void close() {
mHybridData.resetNative(); mHybridData.resetNative();
} }
/**
* Returns the name of the executor, identifying the underlying runtime.
*/
abstract public String getName();
} }

View File

@ -59,5 +59,10 @@ public class ProxyJavaScriptExecutor extends JavaScriptExecutor {
} }
} }
@Override
public String getName() {
return "ProxyJavaScriptExecutor";
}
private native static HybridData initHybrid(JavaJSExecutor executor); private native static HybridData initHybrid(JavaJSExecutor executor);
} }