mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-02-12 09:20:14 +08:00
Flows between RN Threads
Reviewed By: tadeuzagallo Differential Revision: D2743733 fb-gh-sync-id: df4ae69a3501a37e08286857a8d4be3cd27c0ac3
This commit is contained in:
committed by
facebook-github-bot-3
parent
cdad5c047a
commit
e42c6d4446
@@ -56,6 +56,7 @@ public class CatalystInstanceImpl implements CatalystInstance {
|
||||
private final TraceListener mTraceListener;
|
||||
private final JavaScriptModuleRegistry mJSModuleRegistry;
|
||||
private final JSBundleLoader mJSBundleLoader;
|
||||
private volatile int mTraceID = 0;
|
||||
|
||||
// Access from native modules thread
|
||||
private final NativeModuleRegistry mJavaRegistry;
|
||||
@@ -176,12 +177,23 @@ public class CatalystInstanceImpl implements CatalystInstance {
|
||||
|
||||
incrementPendingJSCalls();
|
||||
|
||||
final int traceID = mTraceID++;
|
||||
Systrace.startAsyncFlow(
|
||||
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
|
||||
tracingName,
|
||||
traceID);
|
||||
|
||||
mCatalystQueueConfiguration.getJSQueueThread().runOnQueue(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mCatalystQueueConfiguration.getJSQueueThread().assertIsOnThread();
|
||||
|
||||
Systrace.endAsyncFlow(
|
||||
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
|
||||
tracingName,
|
||||
traceID);
|
||||
|
||||
if (mDestroyed) {
|
||||
return;
|
||||
}
|
||||
@@ -208,12 +220,23 @@ public class CatalystInstanceImpl implements CatalystInstance {
|
||||
|
||||
incrementPendingJSCalls();
|
||||
|
||||
final int traceID = mTraceID++;
|
||||
Systrace.startAsyncFlow(
|
||||
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
|
||||
"<callback>",
|
||||
traceID);
|
||||
|
||||
mCatalystQueueConfiguration.getJSQueueThread().runOnQueue(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mCatalystQueueConfiguration.getJSQueueThread().assertIsOnThread();
|
||||
|
||||
Systrace.endAsyncFlow(
|
||||
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
|
||||
"<callback>",
|
||||
traceID);
|
||||
|
||||
if (mDestroyed) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user