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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 1587283002: Switch cc to std::unordered_*. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@unordered-map
Patch Set: Created 4 years, 11 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
Index: cc/trees/layer_tree_host_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 2399289de05203c768f2b7755d83270ebfcb6618..532af762753c4210081057cc5af7f9718588e293 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -11,9 +11,10 @@
#include <limits>
#include <map>
#include <set>
+#include <unordered_map>
+#include <utility>
#include "base/auto_reset.h"
-#include "base/containers/hash_tables.h"
#include "base/containers/small_map.h"
#include "base/json/json_writer.h"
#include "base/metrics/histogram.h"
@@ -1185,7 +1186,8 @@ void LayerTreeHostImpl::RemoveRenderPasses(FrameData* frame) {
std::set<RenderPassId> pass_exists;
// A set of RenderPassDrawQuads that we have seen (stored by the RenderPasses
// they refer to).
- base::SmallMap<base::hash_map<RenderPassId, int>> pass_references;
+ base::SmallMap<std::unordered_map<RenderPassId, int, RenderPassIdHash>>
+ pass_references;
// Iterate RenderPasses in draw order, removing empty render passes (except
// the root RenderPass).
@@ -3288,9 +3290,12 @@ void LayerTreeHostImpl::RegisterScrollbarAnimationController(
return;
if (ScrollbarAnimationControllerForId(scroll_layer_id))
return;
- scrollbar_animation_controllers_.add(
+ // TODO(davidben): Is this the same as using operator[]? The check above
danakj 2016/01/14 21:12:32 You're worried for the case where the scroll_layer
davidben 2016/01/14 21:28:19 I'm worried about the case where scroll_layer_id e
danakj 2016/01/14 21:31:54 Yah it is a bit awkward. I think operator[] will b
davidben 2016/01/21 01:33:58 Done.
+ // doesn't quite work if scroll_layer_id gets modified in
+ // ScrollbarAnimationControllerForId.
+ scrollbar_animation_controllers_.insert(std::make_pair(
scroll_layer_id,
- active_tree_->CreateScrollbarAnimationController(scroll_layer_id));
+ active_tree_->CreateScrollbarAnimationController(scroll_layer_id)));
}
void LayerTreeHostImpl::UnregisterScrollbarAnimationController(
@@ -3307,7 +3312,7 @@ LayerTreeHostImpl::ScrollbarAnimationControllerForId(
auto i = scrollbar_animation_controllers_.find(scroll_layer_id);
if (i == scrollbar_animation_controllers_.end())
return nullptr;
- return i->second;
+ return i->second.get();
}
void LayerTreeHostImpl::PostDelayedScrollbarAnimationTask(

Powered by Google App Engine
This is Rietveld 408576698