Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2927)

Unified Diff: cc/base/rtree.h

Issue 2871183002: Use emplace_back in RTree::Build (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « AUTHORS ('k') | cc/base/rtree.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/base/rtree.h
diff --git a/cc/base/rtree.h b/cc/base/rtree.h
index 3a19c29ac3d4545fad75b15e5b4918ccda113e50..679bc84516ae982be750a894bf75d01f239f00b7 100644
--- a/cc/base/rtree.h
+++ b/cc/base/rtree.h
@@ -52,10 +52,7 @@ class CC_BASE_EXPORT RTree {
if (bounds.IsEmpty())
continue;
- branches.push_back(Branch());
- Branch& branch = branches.back();
- branch.bounds = bounds;
- branch.index = i;
+ branches.emplace_back(i, bounds);
}
num_data_elements_ = branches.size();
@@ -115,12 +112,18 @@ class CC_BASE_EXPORT RTree {
size_t index;
};
gfx::Rect bounds;
+
+ Branch() {}
+ Branch(size_t index, const gfx::Rect& bounds)
+ : index(index), bounds(bounds) {}
};
struct Node {
uint16_t num_children;
uint16_t level;
Branch children[kMaxChildren];
+
+ explicit Node(uint16_t level) : num_children(0), level(level) {}
};
void SearchRecursive(Node* root,
« no previous file with comments | « AUTHORS ('k') | cc/base/rtree.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698