mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-07 09:27:29 +08:00
add Systrace to render logic
Reviewed By: achen1 Differential Revision: D5153246 fbshipit-source-id: 4f6f6c7117734552682995fc74a3a926a63feb28
This commit is contained in:
committed by
Facebook Github Bot
parent
ae49713342
commit
8394f9b553
@@ -552,19 +552,53 @@ public class UIImplementation {
|
||||
* Invoked at the end of the transaction to commit any updates to the node hierarchy.
|
||||
*/
|
||||
public void dispatchViewUpdates(int batchId) {
|
||||
updateViewHierarchy();
|
||||
mNativeViewHierarchyOptimizer.onBatchComplete();
|
||||
mOperationsQueue.dispatchViewUpdates(batchId);
|
||||
SystraceMessage.beginSection(
|
||||
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
|
||||
"UIImplementation.dispatchViewUpdates")
|
||||
.arg("batchId", batchId)
|
||||
.flush();
|
||||
try {
|
||||
updateViewHierarchy();
|
||||
mNativeViewHierarchyOptimizer.onBatchComplete();
|
||||
mOperationsQueue.dispatchViewUpdates(batchId);
|
||||
} finally {
|
||||
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateViewHierarchy() {
|
||||
for (int i = 0; i < mShadowNodeRegistry.getRootNodeCount(); i++) {
|
||||
int tag = mShadowNodeRegistry.getRootTag(i);
|
||||
ReactShadowNode cssRoot = mShadowNodeRegistry.getNode(tag);
|
||||
notifyOnBeforeLayoutRecursive(cssRoot);
|
||||
Systrace.beginSection(
|
||||
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
|
||||
"UIImplementation.updateViewHierarchy");
|
||||
try {
|
||||
for (int i = 0; i < mShadowNodeRegistry.getRootNodeCount(); i++) {
|
||||
int tag = mShadowNodeRegistry.getRootTag(i);
|
||||
ReactShadowNode cssRoot = mShadowNodeRegistry.getNode(tag);
|
||||
SystraceMessage.beginSection(
|
||||
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
|
||||
"UIImplementation.notifyOnBeforeLayoutRecursive")
|
||||
.arg("rootTag", cssRoot.getReactTag())
|
||||
.flush();
|
||||
try {
|
||||
notifyOnBeforeLayoutRecursive(cssRoot);
|
||||
} finally {
|
||||
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
|
||||
}
|
||||
|
||||
calculateRootLayout(cssRoot);
|
||||
applyUpdatesRecursive(cssRoot, 0f, 0f);
|
||||
calculateRootLayout(cssRoot);
|
||||
SystraceMessage.beginSection(
|
||||
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
|
||||
"UIImplementation.applyUpdatesRecursive")
|
||||
.arg("rootTag", cssRoot.getReactTag())
|
||||
.flush();
|
||||
try {
|
||||
applyUpdatesRecursive(cssRoot, 0f, 0f);
|
||||
} finally {
|
||||
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user