Fabric: Collecting and printing ShadowNode's revision/generation

Summary: It drastically simplifies reading logs.

Reviewed By: fkgozali

Differential Revision: D7388963

fbshipit-source-id: 7849c803f295719918c20ddf8c082e5a5780116f
This commit is contained in:
Valentin Shergin 2018-03-25 22:43:43 -07:00 committed by Facebook Github Bot
parent cb7a7f3b93
commit 99e9c6e798
2 changed files with 6 additions and 3 deletions

View File

@ -31,7 +31,8 @@ ShadowNode::ShadowNode(
rootTag_(rootTag),
instanceHandle_(instanceHandle),
props_(props),
children_(children) {}
children_(children),
revision_(1) {}
ShadowNode::ShadowNode(
SharedShadowNode shadowNode,
@ -43,7 +44,8 @@ ShadowNode::ShadowNode(
instanceHandle_(shadowNode->instanceHandle_),
props_(props ? props : shadowNode->props_),
children_(children ? children : shadowNode->children_),
sourceNode_(shadowNode) {}
sourceNode_(shadowNode),
revision_(shadowNode->revision_ + 1) {}
#pragma mark - Getters
@ -121,7 +123,7 @@ std::string ShadowNode::getDebugName() const {
}
std::string ShadowNode::getDebugValue() const {
return getSealed() ? "sealed" : "";
return "r" + std::to_string(revision_) + (getSealed() ? "/sealed" : "");
}
SharedDebugStringConvertibleList ShadowNode::getDebugChildren() const {

View File

@ -81,6 +81,7 @@ protected:
SharedProps props_;
SharedShadowNodeSharedList children_;
WeakShadowNode sourceNode_;
int revision_;
};
} // namespace react