Move node cloning to YGConfig
Summary: @public Encapsulates node cloning within `YGConfig`. This is necessary for allowing for context-aware cloning functions, which will ultimately allow for removal of weak global JNI references. Reviewed By: shergin Differential Revision: D14132608 fbshipit-source-id: 0dec114c8e172b1e34a4b7fd146c43f13c151ade
This commit is contained in:
committed by
Facebook Github Bot
parent
2643b96589
commit
367a93de88
@@ -6,7 +6,7 @@
|
||||
*/
|
||||
#include "YGConfig.h"
|
||||
|
||||
YGConfig::YGConfig(YGLogger logger) {
|
||||
YGConfig::YGConfig(YGLogger logger) : cloneNodeCallback_{nullptr} {
|
||||
logger_.noContext = logger;
|
||||
loggerUsesContext_ = false;
|
||||
}
|
||||
@@ -24,3 +24,14 @@ void YGConfig::log(
|
||||
logger_.noContext(config, node, logLevel, format, args);
|
||||
}
|
||||
}
|
||||
|
||||
YGNodeRef YGConfig::cloneNode(YGNodeRef node, YGNodeRef owner, int childIndex) {
|
||||
YGNodeRef clone = nullptr;
|
||||
if (cloneNodeCallback_ != nullptr) {
|
||||
clone = cloneNodeCallback_(node, owner, childIndex);
|
||||
}
|
||||
if (clone == nullptr) {
|
||||
clone = YGNodeClone(node);
|
||||
}
|
||||
return clone;
|
||||
}
|
||||
|
Reference in New Issue
Block a user