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

Side by Side Diff: cc/layer_impl.h

Issue 11598005: Ref count layer animation controllers. (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/layer_animation_value_observer.h ('k') | cc/layer_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CC_LAYER_IMPL_H_ 5 #ifndef CC_LAYER_IMPL_H_
6 #define CC_LAYER_IMPL_H_ 6 #define CC_LAYER_IMPL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "cc/cc_export.h" 12 #include "cc/cc_export.h"
13 #include "cc/draw_properties.h" 13 #include "cc/draw_properties.h"
14 #include "cc/input_handler.h" 14 #include "cc/input_handler.h"
15 #include "cc/layer_animation_controller.h" 15 #include "cc/layer_animation_controller.h"
16 #include "cc/layer_animation_value_observer.h"
16 #include "cc/region.h" 17 #include "cc/region.h"
17 #include "cc/render_pass.h" 18 #include "cc/render_pass.h"
18 #include "cc/render_surface_impl.h" 19 #include "cc/render_surface_impl.h"
19 #include "cc/resource_provider.h" 20 #include "cc/resource_provider.h"
20 #include "cc/scoped_ptr_vector.h" 21 #include "cc/scoped_ptr_vector.h"
21 #include "cc/shared_quad_state.h" 22 #include "cc/shared_quad_state.h"
22 #include "skia/ext/refptr.h" 23 #include "skia/ext/refptr.h"
23 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations .h" 24 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations .h"
24 #include "third_party/skia/include/core/SkColor.h" 25 #include "third_party/skia/include/core/SkColor.h"
25 #include "third_party/skia/include/core/SkImageFilter.h" 26 #include "third_party/skia/include/core/SkImageFilter.h"
(...skipping 10 matching lines...) Expand all
36 class LayerTreeHostImpl; 37 class LayerTreeHostImpl;
37 class LayerTreeImpl; 38 class LayerTreeImpl;
38 class QuadSink; 39 class QuadSink;
39 class Renderer; 40 class Renderer;
40 class ScrollbarAnimationController; 41 class ScrollbarAnimationController;
41 class ScrollbarLayerImpl; 42 class ScrollbarLayerImpl;
42 class Layer; 43 class Layer;
43 44
44 struct AppendQuadsData; 45 struct AppendQuadsData;
45 46
46 class CC_EXPORT LayerImpl : public LayerAnimationControllerClient { 47 class CC_EXPORT LayerImpl : LayerAnimationValueObserver {
47 public: 48 public:
48 typedef ScopedPtrVector<LayerImpl> LayerList; 49 typedef ScopedPtrVector<LayerImpl> LayerList;
49 50
50 static scoped_ptr<LayerImpl> create(LayerTreeImpl* treeImpl, int id) 51 static scoped_ptr<LayerImpl> create(LayerTreeImpl* treeImpl, int id)
51 { 52 {
52 return make_scoped_ptr(new LayerImpl(treeImpl, id)); 53 return make_scoped_ptr(new LayerImpl(treeImpl, id));
53 } 54 }
54 55
55 virtual ~LayerImpl(); 56 virtual ~LayerImpl();
56 57
57 // LayerAnimationControllerClient implementation. 58 int id() const;
58 virtual int id() const OVERRIDE; 59
59 virtual void setOpacityFromAnimation(float) OVERRIDE; 60 // LayerAnimationValueObserver implementation.
60 virtual float opacity() const OVERRIDE; 61 virtual void OnOpacityAnimated(float) OVERRIDE;
61 virtual void setTransformFromAnimation(const gfx::Transform&) OVERRIDE; 62 virtual void OnTransformAnimated(const gfx::Transform&) OVERRIDE;
62 virtual const gfx::Transform& transform() const OVERRIDE;
63 63
64 // Tree structure. 64 // Tree structure.
65 LayerImpl* parent() { return m_parent; } 65 LayerImpl* parent() { return m_parent; }
66 const LayerImpl* parent() const { return m_parent; } 66 const LayerImpl* parent() const { return m_parent; }
67 const LayerList& children() const { return m_children; } 67 const LayerList& children() const { return m_children; }
68 void addChild(scoped_ptr<LayerImpl>); 68 void addChild(scoped_ptr<LayerImpl>);
69 scoped_ptr<LayerImpl> removeChild(LayerImpl* child); 69 scoped_ptr<LayerImpl> removeChild(LayerImpl* child);
70 void removeAllChildren(); 70 void removeAllChildren();
71 71
72 void setMaskLayer(scoped_ptr<LayerImpl>); 72 void setMaskLayer(scoped_ptr<LayerImpl>);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 void setFilter(const skia::RefPtr<SkImageFilter>&); 124 void setFilter(const skia::RefPtr<SkImageFilter>&);
125 skia::RefPtr<SkImageFilter> filter() const { return m_filter; } 125 skia::RefPtr<SkImageFilter> filter() const { return m_filter; }
126 126
127 void setMasksToBounds(bool); 127 void setMasksToBounds(bool);
128 bool masksToBounds() const { return m_masksToBounds; } 128 bool masksToBounds() const { return m_masksToBounds; }
129 129
130 void setContentsOpaque(bool); 130 void setContentsOpaque(bool);
131 bool contentsOpaque() const { return m_contentsOpaque; } 131 bool contentsOpaque() const { return m_contentsOpaque; }
132 132
133 void setOpacity(float); 133 void setOpacity(float);
134 float opacity() const;
134 bool opacityIsAnimating() const; 135 bool opacityIsAnimating() const;
135 136
136 void setPosition(const gfx::PointF&); 137 void setPosition(const gfx::PointF&);
137 const gfx::PointF& position() const { return m_position; } 138 const gfx::PointF& position() const { return m_position; }
138 139
139 void setIsContainerForFixedPositionLayers(bool isContainerForFixedPositionLa yers) { m_isContainerForFixedPositionLayers = isContainerForFixedPositionLayers; } 140 void setIsContainerForFixedPositionLayers(bool isContainerForFixedPositionLa yers) { m_isContainerForFixedPositionLayers = isContainerForFixedPositionLayers; }
140 bool isContainerForFixedPositionLayers() const { return m_isContainerForFixe dPositionLayers; } 141 bool isContainerForFixedPositionLayers() const { return m_isContainerForFixe dPositionLayers; }
141 142
142 void setFixedToContainerLayer(bool fixedToContainerLayer = true) { m_fixedTo ContainerLayer = fixedToContainerLayer;} 143 void setFixedToContainerLayer(bool fixedToContainerLayer = true) { m_fixedTo ContainerLayer = fixedToContainerLayer;}
143 bool fixedToContainerLayer() const { return m_fixedToContainerLayer; } 144 bool fixedToContainerLayer() const { return m_fixedToContainerLayer; }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 233
233 void setDrawCheckerboardForMissingTiles(bool checkerboard) { m_drawCheckerbo ardForMissingTiles = checkerboard; } 234 void setDrawCheckerboardForMissingTiles(bool checkerboard) { m_drawCheckerbo ardForMissingTiles = checkerboard; }
234 bool drawCheckerboardForMissingTiles() const; 235 bool drawCheckerboardForMissingTiles() const;
235 236
236 InputHandlerClient::ScrollStatus tryScroll(const gfx::PointF& screenSpacePoi nt, InputHandlerClient::ScrollInputType) const; 237 InputHandlerClient::ScrollStatus tryScroll(const gfx::PointF& screenSpacePoi nt, InputHandlerClient::ScrollInputType) const;
237 238
238 bool doubleSided() const { return m_doubleSided; } 239 bool doubleSided() const { return m_doubleSided; }
239 void setDoubleSided(bool); 240 void setDoubleSided(bool);
240 241
241 void setTransform(const gfx::Transform&); 242 void setTransform(const gfx::Transform&);
243 const gfx::Transform& transform() const;
242 bool transformIsAnimating() const; 244 bool transformIsAnimating() const;
243 245
244 const gfx::RectF& updateRect() const { return m_updateRect; } 246 const gfx::RectF& updateRect() const { return m_updateRect; }
245 void setUpdateRect(const gfx::RectF& updateRect) { m_updateRect = updateRect ; } 247 void setUpdateRect(const gfx::RectF& updateRect) { m_updateRect = updateRect ; }
246 248
247 std::string layerTreeAsText() const; 249 std::string layerTreeAsText() const;
248 virtual base::DictionaryValue* layerTreeAsJson() const; 250 virtual base::DictionaryValue* layerTreeAsJson() const;
249 251
250 void setStackingOrderChanged(bool); 252 void setStackingOrderChanged(bool);
251 253
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 #ifndef NDEBUG 383 #ifndef NDEBUG
382 bool m_betweenWillDrawAndDidDraw; 384 bool m_betweenWillDrawAndDidDraw;
383 #endif 385 #endif
384 386
385 // Rect indicating what was repainted/updated during update. 387 // Rect indicating what was repainted/updated during update.
386 // Note that plugin layers bypass this and leave it empty. 388 // Note that plugin layers bypass this and leave it empty.
387 // Uses layer's content space. 389 // Uses layer's content space.
388 gfx::RectF m_updateRect; 390 gfx::RectF m_updateRect;
389 391
390 // Manages animations for this layer. 392 // Manages animations for this layer.
391 scoped_ptr<LayerAnimationController> m_layerAnimationController; 393 scoped_refptr<LayerAnimationController> m_layerAnimationController;
392 394
393 // Manages scrollbars for this layer 395 // Manages scrollbars for this layer
394 scoped_ptr<ScrollbarAnimationController> m_scrollbarAnimationController; 396 scoped_ptr<ScrollbarAnimationController> m_scrollbarAnimationController;
395 397
396 // Group of properties that need to be computed based on the layer tree 398 // Group of properties that need to be computed based on the layer tree
397 // hierarchy before layers can be drawn. 399 // hierarchy before layers can be drawn.
398 DrawProperties<LayerImpl, RenderSurfaceImpl> m_drawProperties; 400 DrawProperties<LayerImpl, RenderSurfaceImpl> m_drawProperties;
399 401
400 DISALLOW_COPY_AND_ASSIGN(LayerImpl); 402 DISALLOW_COPY_AND_ASSIGN(LayerImpl);
401 }; 403 };
402 404
403 } 405 }
404 406
405 #endif // CC_LAYER_IMPL_H_ 407 #endif // CC_LAYER_IMPL_H_
OLDNEW
« no previous file with comments | « cc/layer_animation_value_observer.h ('k') | cc/layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698