Permalink
Browse files

Report perf counters always when we call flushPendingBatches()

Reviewed By: AaaChiuuu

Differential Revision: D5678088

fbshipit-source-id: 35d909a432ece9539bd48e0bf4ddb14d5953a096
  • Loading branch information...
alexeylang authored and facebook-github-bot committed Aug 22, 2017
1 parent e063453 commit 4aae843ebb59c7aca0bae090445d45f1ae1bf679
Showing with 19 additions and 25 deletions.
  1. +19 −25 ReactAndroid/src/main/java/com/facebook/react/uimanager/UIViewOperationQueue.java
@@ -899,12 +899,12 @@ public void runGuarded() {
flushPendingBatches();
}
private boolean flushPendingBatches() {
private void flushPendingBatches() {
if (mIsInIllegalUIState) {
FLog.w(
ReactConstants.TAG,
"Not flushing pending UI operations because of previously thrown Exception");
return false;
return;
}
final ArrayList<Runnable> runnables;
@@ -913,18 +913,28 @@ private boolean flushPendingBatches() {
runnables = mDispatchUIRunnables;
mDispatchUIRunnables = new ArrayList<>();
} else {
runnables = null;
return;
}
}
if (runnables == null) {
return false;
}
final long batchedExecutionStartTime = SystemClock.uptimeMillis();
for (Runnable runnable : runnables) {
runnable.run();
}
return true;
if (mIsProfilingNextBatch) {
mProfiledBatchBatchedExecutionTime = SystemClock.uptimeMillis() - batchedExecutionStartTime;
mProfiledBatchNonBatchedExecutionTime = mNonBatchedExecutionTotalTime;
mIsProfilingNextBatch = false;
Systrace.beginAsyncSection(
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
"batchedExecutionTime",
0,
batchedExecutionStartTime * 1000000);
Systrace.endAsyncSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "batchedExecutionTime", 0);
}
mNonBatchedExecutionTotalTime = 0;
}
/**
@@ -969,23 +979,7 @@ public void doFrameGuarded(long frameTimeNanos) {
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
}
final long flushPendingBatchesStartTime = SystemClock.uptimeMillis();
if (flushPendingBatches()) {
if (mIsProfilingNextBatch) {
mProfiledBatchBatchedExecutionTime =
SystemClock.uptimeMillis() - flushPendingBatchesStartTime;
mProfiledBatchNonBatchedExecutionTime = mNonBatchedExecutionTotalTime;
mIsProfilingNextBatch = false;
Systrace.beginAsyncSection(
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
"batchedExecutionTime",
0,
flushPendingBatchesStartTime * 1000000);
Systrace.endAsyncSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "batchedExecutionTime", 0);
}
mNonBatchedExecutionTotalTime = 0;
}
flushPendingBatches();
ReactChoreographer.getInstance().postFrameCallback(
ReactChoreographer.CallbackType.DISPATCH_UI, this);

0 comments on commit 4aae843

Please sign in to comment.