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

Unified Diff: cc/layer_tree_impl.h

Issue 11575018: cc: Add id->LayerImpl map to LayerTreeImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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/layer_tree_impl.h
diff --git a/cc/layer_tree_impl.h b/cc/layer_tree_impl.h
index 6fc4429d9e7752d147f65e639df66901b49a758c..62e01354f5530c084edfa56935937613c834b9bc 100644
--- a/cc/layer_tree_impl.h
+++ b/cc/layer_tree_impl.h
@@ -5,8 +5,20 @@
#ifndef CC_LAYER_TREE_IMPL_H_
#define CC_LAYER_TREE_IMPL_H_
+#include "base/hash_tables.h"
#include "cc/layer_impl.h"
+#if defined(COMPILER_GCC)
danakj 2012/12/13 23:57:11 I would expect you to need an MSVC version too. If
enne (OOO) 2012/12/14 00:21:12 Nope. That's just for std::pair being weird. See
+namespace BASE_HASH_NAMESPACE {
+template<>
+struct hash<cc::LayerImpl*> {
+ size_t operator()(cc::LayerImpl* ptr) const {
+ return hash<size_t>()(reinterpret_cast<size_t>(ptr));
+ }
+};
+} // namespace BASE_HASH_NAMESPACE
+#endif // COMPILER
+
namespace cc {
class DebugRectHistory;
@@ -70,6 +82,12 @@ class CC_EXPORT LayerTreeImpl {
void ClearCurrentlyScrollingLayer();
+ LayerImpl* LayerById(int id);
+
+ // These should be called by LayerImpl's ctor/dtor.
+ void RegisterLayer(LayerImpl* layer);
+ void UnregisterLayer(LayerImpl* layer);
+
protected:
LayerTreeImpl(LayerTreeHostImpl* layer_tree_host_impl);
@@ -80,6 +98,9 @@ protected:
LayerImpl* root_scroll_layer_;
LayerImpl* currently_scrolling_layer_;
+ typedef base::hash_map<int, LayerImpl*> LayerIdMap;
+ LayerIdMap layer_id_map_;
+
// Persisted state
int scrolling_layer_id_from_previous_tree_;

Powered by Google App Engine
This is Rietveld 408576698