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

Unified Diff: cc/surfaces/surface_aggregator.cc

Issue 1100713004: Reserve space in the resource ID set. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/surfaces/surface_aggregator.cc
diff --git a/cc/surfaces/surface_aggregator.cc b/cc/surfaces/surface_aggregator.cc
index b4123d01d48c3c376d6f7a19dd2ccd741c4dcab7..1f645f238c2f73ec65f3d585767adaf4c9bf95ac 100644
--- a/cc/surfaces/surface_aggregator.cc
+++ b/cc/surfaces/surface_aggregator.cc
@@ -170,6 +170,15 @@ bool SurfaceAggregator::ValidateResources(
provider_->ReceiveFromChild(child_id, frame_data->resource_list);
ResourceProvider::ResourceIdSet referenced_resources;
+ size_t reserve_size =
+ std::max(static_cast<size_t>(1), frame_data->resource_list.size());
danakj 2015/04/25 17:16:44 why the Max 1?
+#if defined(COMPILER_MSVC)
+ referenced_resources.reserve(reserve_size);
+#elif defined(COMPILER_GCC)
+ // Pre-standard hash-tables only implement resize, which behaves similarly
danakj 2015/04/25 17:16:44 wow really? I'm surprised this is all we have in o
+ // to reserve for these keys.
+ referenced_resources.resize(reserve_size);
+#endif
bool invalid_frame = false;
DrawQuad::ResourceIteratorCallback remap =
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698