OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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_LAYERS_LAYER_H_ | 5 #ifndef CC_LAYERS_LAYER_H_ |
6 #define CC_LAYERS_LAYER_H_ | 6 #define CC_LAYERS_LAYER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 class LayerAnimationEventObserver; | 40 class LayerAnimationEventObserver; |
41 class LayerImpl; | 41 class LayerImpl; |
42 class LayerTreeHost; | 42 class LayerTreeHost; |
43 class LayerTreeImpl; | 43 class LayerTreeImpl; |
44 class PriorityCalculator; | 44 class PriorityCalculator; |
45 class RenderingStatsInstrumentation; | 45 class RenderingStatsInstrumentation; |
46 class ResourceUpdateQueue; | 46 class ResourceUpdateQueue; |
47 class ScrollbarLayer; | 47 class ScrollbarLayer; |
48 struct AnimationEvent; | 48 struct AnimationEvent; |
49 | 49 |
| 50 class CC_EXPORT LayerClient { |
| 51 public: |
| 52 virtual std::string DebugName() = 0; |
| 53 protected: |
| 54 virtual ~LayerClient() {} |
| 55 }; |
| 56 |
50 // Base class for composited layers. Special layer types are derived from | 57 // Base class for composited layers. Special layer types are derived from |
51 // this class. | 58 // this class. |
52 class CC_EXPORT Layer : public base::RefCounted<Layer>, | 59 class CC_EXPORT Layer : public base::RefCounted<Layer>, |
53 public LayerAnimationValueObserver { | 60 public LayerAnimationValueObserver { |
54 public: | 61 public: |
55 enum LayerIdLabels { | 62 enum LayerIdLabels { |
56 INVALID_ID = -1, | 63 INVALID_ID = -1, |
57 }; | 64 }; |
58 | 65 |
59 static scoped_refptr<Layer> Create(); | 66 static scoped_refptr<Layer> Create(); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 virtual bool DrawsContent() const; | 293 virtual bool DrawsContent() const; |
287 virtual void SavePaintProperties(); | 294 virtual void SavePaintProperties(); |
288 // Returns true iff any resources were updated that need to be committed. | 295 // Returns true iff any resources were updated that need to be committed. |
289 virtual bool Update(ResourceUpdateQueue* queue, | 296 virtual bool Update(ResourceUpdateQueue* queue, |
290 const OcclusionTracker* occlusion); | 297 const OcclusionTracker* occlusion); |
291 virtual bool NeedMoreUpdates(); | 298 virtual bool NeedMoreUpdates(); |
292 virtual void SetIsMask(bool is_mask) {} | 299 virtual void SetIsMask(bool is_mask) {} |
293 virtual void ReduceMemoryUsage() {} | 300 virtual void ReduceMemoryUsage() {} |
294 | 301 |
295 void SetDebugName(const std::string& debug_name); | 302 void SetDebugName(const std::string& debug_name); |
| 303 virtual std::string DebugName(); |
| 304 |
| 305 void SetLayerClient(LayerClient* client) { client_ = client; } |
| 306 |
296 void SetCompositingReasons(CompositingReasons reasons); | 307 void SetCompositingReasons(CompositingReasons reasons); |
297 | 308 |
298 virtual void PushPropertiesTo(LayerImpl* layer); | 309 virtual void PushPropertiesTo(LayerImpl* layer); |
299 | 310 |
300 void CreateRenderSurface(); | 311 void CreateRenderSurface(); |
301 void ClearRenderSurface(); | 312 void ClearRenderSurface(); |
302 | 313 |
303 // The contents scale converts from logical, non-page-scaled pixels to target | 314 // The contents scale converts from logical, non-page-scaled pixels to target |
304 // pixels. The contents scale is 1 for the root layer as it is already in | 315 // pixels. The contents scale is 1 for the root layer as it is already in |
305 // physical pixels. By default contents scale is forced to be 1 except for | 316 // physical pixels. By default contents scale is forced to be 1 except for |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
507 | 518 |
508 gfx::Transform transform_; | 519 gfx::Transform transform_; |
509 gfx::Transform sublayer_transform_; | 520 gfx::Transform sublayer_transform_; |
510 | 521 |
511 // Replica layer used for reflections. | 522 // Replica layer used for reflections. |
512 scoped_refptr<Layer> replica_layer_; | 523 scoped_refptr<Layer> replica_layer_; |
513 | 524 |
514 // Transient properties. | 525 // Transient properties. |
515 float raster_scale_; | 526 float raster_scale_; |
516 | 527 |
| 528 LayerClient* client_; |
| 529 |
517 ScopedPtrVector<CopyOutputRequest> copy_requests_; | 530 ScopedPtrVector<CopyOutputRequest> copy_requests_; |
518 | 531 |
519 base::Closure did_scroll_callback_; | 532 base::Closure did_scroll_callback_; |
520 | 533 |
521 DrawProperties<Layer, RenderSurface> draw_properties_; | 534 DrawProperties<Layer, RenderSurface> draw_properties_; |
522 | 535 |
523 PaintProperties paint_properties_; | 536 PaintProperties paint_properties_; |
524 | 537 |
525 DISALLOW_COPY_AND_ASSIGN(Layer); | 538 DISALLOW_COPY_AND_ASSIGN(Layer); |
526 }; | 539 }; |
527 | 540 |
528 } // namespace cc | 541 } // namespace cc |
529 | 542 |
530 #endif // CC_LAYERS_LAYER_H_ | 543 #endif // CC_LAYERS_LAYER_H_ |
OLD | NEW |