Fabric: More systraces for Diffing and Commit phase

Summary: Trivial.

Reviewed By: mdvacca

Differential Revision: D13644482

fbshipit-source-id: 90cfa04797682e57fc4de009fe4a412167b9e8cd
This commit is contained in:
Valentin Shergin 2019-01-11 18:03:25 -08:00 committed by Facebook Github Bot
parent 7bf6f2c238
commit cb14b06309
2 changed files with 8 additions and 0 deletions

View File

@ -6,6 +6,7 @@
#include "Differentiator.h"
#include <react/core/LayoutableShadowNode.h>
#include <react/debug/SystraceSection.h>
#include "ShadowView.h"
namespace facebook {
@ -214,6 +215,8 @@ static void calculateShadowViewMutations(
ShadowViewMutationList calculateShadowViewMutations(
const ShadowNode &oldRootShadowNode,
const ShadowNode &newRootShadowNode) {
SystraceSection s("calculateShadowViewMutations");
// Root shadow nodes must have same tag.
assert(oldRootShadowNode.getTag() == newRootShadowNode.getTag());

View File

@ -7,6 +7,7 @@
#include <react/core/LayoutContext.h>
#include <react/core/LayoutPrimitives.h>
#include <react/debug/SystraceSection.h>
#include <react/mounting/Differentiator.h>
#include <react/mounting/ShadowViewMutation.h>
@ -130,6 +131,7 @@ bool ShadowTree::completeByReplacingShadowNode(
bool ShadowTree::complete(
const SharedRootShadowNode &oldRootShadowNode,
const UnsharedRootShadowNode &newRootShadowNode) const {
SystraceSection s("ShadowTree::complete");
newRootShadowNode->layout();
newRootShadowNode->sealRecursive();
@ -153,6 +155,7 @@ bool ShadowTree::commit(
const SharedRootShadowNode &oldRootShadowNode,
const SharedRootShadowNode &newRootShadowNode,
const ShadowViewMutationList &mutations) const {
SystraceSection s("ShadowTree::commit");
std::lock_guard<std::recursive_mutex> lock(commitMutex_);
if (oldRootShadowNode != rootShadowNode_) {
@ -168,6 +171,8 @@ bool ShadowTree::commit(
void ShadowTree::emitLayoutEvents(
const ShadowViewMutationList &mutations) const {
SystraceSection s("ShadowTree::emitLayoutEvents");
for (const auto &mutation : mutations) {
// Only `Insert` and `Update` mutations can affect layout metrics.
if (mutation.type != ShadowViewMutation::Insert &&