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

Side by Side Diff: cc/CCLayerImpl.h

Issue 11099040: [cc] Store CCLayerImpls as scoped_ptrs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix cc unit tests Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « cc/CCIOSurfaceLayerImpl.h ('k') | cc/CCLayerImpl.cpp » ('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 CCLayerImpl_h 5 #ifndef CCLayerImpl_h
6 #define CCLayerImpl_h 6 #define CCLayerImpl_h
7 7
8 #include "base/memory/scoped_ptr.h"
9 #include "cc/scoped_ptr_vector.h"
8 #include "CCInputHandler.h" 10 #include "CCInputHandler.h"
9 #include "CCLayerAnimationController.h" 11 #include "CCLayerAnimationController.h"
10 #include "CCRenderPass.h" 12 #include "CCRenderPass.h"
11 #include "CCRenderSurface.h" 13 #include "CCRenderSurface.h"
12 #include "CCResourceProvider.h" 14 #include "CCResourceProvider.h"
13 #include "CCSharedQuadState.h" 15 #include "CCSharedQuadState.h"
14 #include "FloatRect.h" 16 #include "FloatRect.h"
15 #include "IntRect.h" 17 #include "IntRect.h"
16 #include "Region.h" 18 #include "Region.h"
17 #include "SkColor.h" 19 #include "SkColor.h"
18 #include "cc/own_ptr_vector.h"
19 #include <public/WebFilterOperations.h> 20 #include <public/WebFilterOperations.h>
20 #include <public/WebTransformationMatrix.h> 21 #include <public/WebTransformationMatrix.h>
21 #include <string> 22 #include <string>
22 #include <wtf/OwnPtr.h> 23 #include <wtf/OwnPtr.h>
23 #include <wtf/PassRefPtr.h>
24 #include <wtf/RefCounted.h>
25 24
26 namespace cc { 25 namespace cc {
27 26
28 class CCLayerSorter; 27 class CCLayerSorter;
29 class CCLayerTreeHostImpl; 28 class CCLayerTreeHostImpl;
30 class CCQuadSink; 29 class CCQuadSink;
31 class CCRenderer; 30 class CCRenderer;
32 class CCScrollbarAnimationController; 31 class CCScrollbarAnimationController;
33 class CCScrollbarLayerImpl; 32 class CCScrollbarLayerImpl;
34 class LayerChromium; 33 class LayerChromium;
35 34
36 struct CCAppendQuadsData; 35 struct CCAppendQuadsData;
37 36
38 class CCLayerImpl : public CCLayerAnimationControllerClient { 37 class CCLayerImpl : public CCLayerAnimationControllerClient {
39 public: 38 public:
40 static PassOwnPtr<CCLayerImpl> create(int id) 39 static scoped_ptr<CCLayerImpl> create(int id)
41 { 40 {
42 return adoptPtr(new CCLayerImpl(id)); 41 return make_scoped_ptr(new CCLayerImpl(id));
43 } 42 }
44 43
45 virtual ~CCLayerImpl(); 44 virtual ~CCLayerImpl();
46 45
47 // CCLayerAnimationControllerClient implementation. 46 // CCLayerAnimationControllerClient implementation.
48 virtual int id() const OVERRIDE; 47 virtual int id() const OVERRIDE;
49 virtual void setOpacityFromAnimation(float) OVERRIDE; 48 virtual void setOpacityFromAnimation(float) OVERRIDE;
50 virtual float opacity() const OVERRIDE; 49 virtual float opacity() const OVERRIDE;
51 virtual void setTransformFromAnimation(const WebKit::WebTransformationMatrix &) OVERRIDE; 50 virtual void setTransformFromAnimation(const WebKit::WebTransformationMatrix &) OVERRIDE;
52 virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE; 51 virtual const WebKit::WebTransformationMatrix& transform() const OVERRIDE;
53 52
54 // Tree structure. 53 // Tree structure.
55 CCLayerImpl* parent() const { return m_parent; } 54 CCLayerImpl* parent() const { return m_parent; }
56 const OwnPtrVector<CCLayerImpl>& children() const { return m_children; } 55 const ScopedPtrVector<CCLayerImpl>& children() const { return m_children; }
57 void addChild(PassOwnPtr<CCLayerImpl>); 56 void addChild(scoped_ptr<CCLayerImpl>);
58 void removeFromParent(); 57 void removeFromParent();
59 void removeAllChildren(); 58 void removeAllChildren();
60 59
61 void setMaskLayer(PassOwnPtr<CCLayerImpl>); 60 void setMaskLayer(scoped_ptr<CCLayerImpl>);
62 CCLayerImpl* maskLayer() const { return m_maskLayer.get(); } 61 CCLayerImpl* maskLayer() const { return m_maskLayer.get(); }
63 62
64 void setReplicaLayer(PassOwnPtr<CCLayerImpl>); 63 void setReplicaLayer(scoped_ptr<CCLayerImpl>);
65 CCLayerImpl* replicaLayer() const { return m_replicaLayer.get(); } 64 CCLayerImpl* replicaLayer() const { return m_replicaLayer.get(); }
66 65
67 bool hasMask() const { return m_maskLayer; } 66 bool hasMask() const { return m_maskLayer; }
68 bool hasReplica() const { return m_replicaLayer; } 67 bool hasReplica() const { return m_replicaLayer; }
69 bool replicaHasMask() const { return m_replicaLayer && (m_maskLayer || m_rep licaLayer->m_maskLayer); } 68 bool replicaHasMask() const { return m_replicaLayer && (m_maskLayer || m_rep licaLayer->m_maskLayer); }
70 69
71 CCLayerTreeHostImpl* layerTreeHostImpl() const { return m_layerTreeHostImpl; } 70 CCLayerTreeHostImpl* layerTreeHostImpl() const { return m_layerTreeHostImpl; }
72 void setLayerTreeHostImpl(CCLayerTreeHostImpl* hostImpl) { m_layerTreeHostIm pl = hostImpl; } 71 void setLayerTreeHostImpl(CCLayerTreeHostImpl* hostImpl) { m_layerTreeHostIm pl = hostImpl; }
73 72
74 scoped_ptr<CCSharedQuadState> createSharedQuadState() const; 73 scoped_ptr<CCSharedQuadState> createSharedQuadState() const;
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 276
278 // Note carefully this does not affect the current layer. 277 // Note carefully this does not affect the current layer.
279 void noteLayerPropertyChangedForDescendants(); 278 void noteLayerPropertyChangedForDescendants();
280 279
281 virtual const char* layerTypeAsString() const; 280 virtual const char* layerTypeAsString() const;
282 281
283 void dumpLayer(std::string*, int indent) const; 282 void dumpLayer(std::string*, int indent) const;
284 283
285 // Properties internal to CCLayerImpl 284 // Properties internal to CCLayerImpl
286 CCLayerImpl* m_parent; 285 CCLayerImpl* m_parent;
287 OwnPtrVector<CCLayerImpl> m_children; 286 ScopedPtrVector<CCLayerImpl> m_children;
288 // m_maskLayer can be temporarily stolen during tree sync, we need this ID t o confirm newly assigned layer is still the previous one 287 // m_maskLayer can be temporarily stolen during tree sync, we need this ID t o confirm newly assigned layer is still the previous one
289 int m_maskLayerId; 288 int m_maskLayerId;
290 OwnPtr<CCLayerImpl> m_maskLayer; 289 scoped_ptr<CCLayerImpl> m_maskLayer;
291 int m_replicaLayerId; // ditto 290 int m_replicaLayerId; // ditto
292 OwnPtr<CCLayerImpl> m_replicaLayer; 291 scoped_ptr<CCLayerImpl> m_replicaLayer;
293 int m_layerId; 292 int m_layerId;
294 CCLayerTreeHostImpl* m_layerTreeHostImpl; 293 CCLayerTreeHostImpl* m_layerTreeHostImpl;
295 294
296 // Properties synchronized from the associated LayerChromium. 295 // Properties synchronized from the associated LayerChromium.
297 FloatPoint m_anchorPoint; 296 FloatPoint m_anchorPoint;
298 float m_anchorPointZ; 297 float m_anchorPointZ;
299 IntSize m_bounds; 298 IntSize m_bounds;
300 IntSize m_contentBounds; 299 IntSize m_contentBounds;
301 IntPoint m_scrollPosition; 300 IntPoint m_scrollPosition;
302 bool m_scrollable; 301 bool m_scrollable;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 390
392 // Manages scrollbars for this layer 391 // Manages scrollbars for this layer
393 OwnPtr<CCScrollbarAnimationController> m_scrollbarAnimationController; 392 OwnPtr<CCScrollbarAnimationController> m_scrollbarAnimationController;
394 }; 393 };
395 394
396 void sortLayers(std::vector<CCLayerImpl*>::iterator first, std::vector<CCLayerIm pl*>::iterator end, CCLayerSorter*); 395 void sortLayers(std::vector<CCLayerImpl*>::iterator first, std::vector<CCLayerIm pl*>::iterator end, CCLayerSorter*);
397 396
398 } 397 }
399 398
400 #endif // CCLayerImpl_h 399 #endif // CCLayerImpl_h
OLDNEW
« no previous file with comments | « cc/CCIOSurfaceLayerImpl.h ('k') | cc/CCLayerImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698