Commit 2f15f738 authored by glebl's avatar glebl Committed by Commit bot

Move NGLayoutOpportunityTreeNode off Oilpan

BUG=635619

Review-Url: https://codereview.chromium.org/2750153003
Cr-Commit-Position: refs/heads/master@{#457533}
parent f198985c
......@@ -32,13 +32,13 @@ void AppendNodeToString(const NGLayoutOpportunityTreeNode* node,
string_builder->append(indent_builder.toString());
string_builder->append("Left:\t");
AppendNodeToString(node->left, string_builder, indent + 2);
AppendNodeToString(node->left.get(), string_builder, indent + 2);
string_builder->append(indent_builder.toString());
string_builder->append("Right:\t");
AppendNodeToString(node->right, string_builder, indent + 2);
AppendNodeToString(node->right.get(), string_builder, indent + 2);
string_builder->append(indent_builder.toString());
string_builder->append("Bottom:\t");
AppendNodeToString(node->bottom, string_builder, indent + 2);
AppendNodeToString(node->bottom.get(), string_builder, indent + 2);
}
// Collects all opportunities from leaves of Layout Opportunity spatial tree.
......@@ -48,9 +48,9 @@ void CollectAllOpportunities(const NGLayoutOpportunityTreeNode* node,
return;
if (node->IsLeafNode())
opportunities.push_back(node->opportunity);
CollectAllOpportunities(node->left, opportunities);
CollectAllOpportunities(node->bottom, opportunities);
CollectAllOpportunities(node->right, opportunities);
CollectAllOpportunities(node->left.get(), opportunities);
CollectAllOpportunities(node->bottom.get(), opportunities);
CollectAllOpportunities(node->right.get(), opportunities);
}
// Creates layout opportunity from the provided space and the origin point.
......@@ -161,9 +161,9 @@ NGLayoutOpportunityTreeNode* CreateRightNGLayoutOpportunityTreeNode(
void SplitNGLayoutOpportunityTreeNode(const NGLogicalRect& rect,
NGLayoutOpportunityTreeNode* node) {
node->left = CreateLeftNGLayoutOpportunityTreeNode(node, rect);
node->right = CreateRightNGLayoutOpportunityTreeNode(node, rect);
node->bottom = CreateBottomNGLayoutOpportunityTreeNode(node, rect);
node->left.reset(CreateLeftNGLayoutOpportunityTreeNode(node, rect));
node->right.reset(CreateRightNGLayoutOpportunityTreeNode(node, rect));
node->bottom.reset(CreateBottomNGLayoutOpportunityTreeNode(node, rect));
}
// Gets/Creates the "TOP" positioned constraint space by splitting
......@@ -222,9 +222,9 @@ void InsertExclusion(NGLayoutOpportunityTreeNode* node,
SplitNGLayoutOpportunityTreeNode(node->combined_exclusion->rect, node);
node->exclusions.push_back(exclusion);
} else {
InsertExclusion(node->left, exclusion, opportunities);
InsertExclusion(node->bottom, exclusion, opportunities);
InsertExclusion(node->right, exclusion, opportunities);
InsertExclusion(node->left.get(), exclusion, opportunities);
InsertExclusion(node->bottom.get(), exclusion, opportunities);
InsertExclusion(node->right.get(), exclusion, opportunities);
}
}
......@@ -288,7 +288,8 @@ NGLayoutOpportunityIterator::NGLayoutOpportunityIterator(
NGLayoutOpportunity initial_opportunity =
CreateLayoutOpportunityFromConstraintSpace(*constraint_space_, Offset());
opportunity_tree_root_ = new NGLayoutOpportunityTreeNode(initial_opportunity);
opportunity_tree_root_.reset(
new NGLayoutOpportunityTreeNode(initial_opportunity));
if (opt_leader_point) {
const NGExclusion leader_exclusion =
......
......@@ -7,7 +7,6 @@
#include "core/CoreExport.h"
#include "core/layout/ng/ng_layout_opportunity_tree_node.h"
#include "platform/heap/Handle.h"
#include "wtf/Optional.h"
#include "wtf/Vector.h"
#include "wtf/text/StringBuilder.h"
......@@ -63,7 +62,7 @@ class CORE_EXPORT NGLayoutOpportunityIterator final {
NGLayoutOpportunities opportunities_;
NGLayoutOpportunities::const_iterator opportunity_iter_;
Persistent<NGLayoutOpportunityTreeNode> opportunity_tree_root_;
std::unique_ptr<NGLayoutOpportunityTreeNode> opportunity_tree_root_;
NGLogicalOffset offset_;
};
......
......@@ -28,10 +28,4 @@ String NGLayoutOpportunityTreeNode::ToString() const {
: "null");
}
DEFINE_TRACE(NGLayoutOpportunityTreeNode) {
visitor->trace(left);
visitor->trace(bottom);
visitor->trace(right);
}
} // namespace blink
......@@ -8,15 +8,13 @@
#include "core/layout/ng/geometry/ng_edge.h"
#include "core/layout/ng/geometry/ng_logical_rect.h"
#include "core/layout/ng/ng_exclusion.h"
#include "platform/heap/Handle.h"
namespace blink {
// 3 node R-Tree that represents available space(left, bottom, right) or
// layout opportunity after the parent spatial rectangle is split by the
// exclusion rectangle.
struct CORE_EXPORT NGLayoutOpportunityTreeNode
: public GarbageCollectedFinalized<NGLayoutOpportunityTreeNode> {
struct CORE_EXPORT NGLayoutOpportunityTreeNode {
public:
// Default constructor.
// Creates a Layout Opportunity tree node that is limited by it's own edge
......@@ -31,9 +29,9 @@ struct CORE_EXPORT NGLayoutOpportunityTreeNode
NGEdge exclusion_edge);
// Children of the node.
Member<NGLayoutOpportunityTreeNode> left;
Member<NGLayoutOpportunityTreeNode> bottom;
Member<NGLayoutOpportunityTreeNode> right;
std::unique_ptr<NGLayoutOpportunityTreeNode> left;
std::unique_ptr<NGLayoutOpportunityTreeNode> bottom;
std::unique_ptr<NGLayoutOpportunityTreeNode> right;
// The top layout opportunity associated with this node.
NGLogicalRect opportunity;
......@@ -53,8 +51,6 @@ struct CORE_EXPORT NGLayoutOpportunityTreeNode
bool IsLeafNode() const { return exclusions.isEmpty(); }
String ToString() const;
DECLARE_TRACE();
};
inline std::ostream& operator<<(std::ostream& stream,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment