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

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 | « cc/layers/delegated_renderer_layer_impl.cc ('k') | 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..7c6f4f74582ba6e758c22b25e9d4b52cae6d6bac 100644
--- a/cc/surfaces/surface_aggregator.cc
+++ b/cc/surfaces/surface_aggregator.cc
@@ -170,6 +170,17 @@ bool SurfaceAggregator::ValidateResources(
provider_->ReceiveFromChild(child_id, frame_data->resource_list);
ResourceProvider::ResourceIdSet referenced_resources;
+ size_t reserve_size = frame_data->resource_list.size();
+#if defined(COMPILER_MSVC)
+ referenced_resources.reserve(reserve_size);
+#elif defined(COMPILER_GCC)
+ // Pre-standard hash-tables only implement resize, which behaves similarly
+ // to reserve for these keys. Resizing to 0 may also be broken (particularly
+ // on stlport).
+ // TODO(jbauman): Replace with reserve when C++11 is supported everywhere.
+ if (reserve_size)
+ referenced_resources.resize(reserve_size);
+#endif
bool invalid_frame = false;
DrawQuad::ResourceIteratorCallback remap =
« no previous file with comments | « cc/layers/delegated_renderer_layer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698