OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 UI_COMPOSITOR_LAYER_H_ | 5 #ifndef UI_COMPOSITOR_LAYER_H_ |
6 #define UI_COMPOSITOR_LAYER_H_ | 6 #define UI_COMPOSITOR_LAYER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "cc/animation/animation_events.h" | 15 #include "cc/animation/animation_events.h" |
16 #include "cc/animation/layer_animation_event_observer.h" | 16 #include "cc/animation/layer_animation_event_observer.h" |
17 #include "cc/base/scoped_ptr_vector.h" | 17 #include "cc/base/scoped_ptr_vector.h" |
18 #include "cc/layers/content_layer_client.h" | 18 #include "cc/layers/content_layer_client.h" |
| 19 #include "cc/layers/layer_client.h" |
19 #include "cc/layers/texture_layer_client.h" | 20 #include "cc/layers/texture_layer_client.h" |
20 #include "cc/resources/texture_mailbox.h" | 21 #include "cc/resources/texture_mailbox.h" |
21 #include "third_party/skia/include/core/SkColor.h" | 22 #include "third_party/skia/include/core/SkColor.h" |
22 #include "third_party/skia/include/core/SkRegion.h" | 23 #include "third_party/skia/include/core/SkRegion.h" |
23 #include "ui/compositor/compositor.h" | 24 #include "ui/compositor/compositor.h" |
24 #include "ui/compositor/layer_animation_delegate.h" | 25 #include "ui/compositor/layer_animation_delegate.h" |
25 #include "ui/compositor/layer_delegate.h" | 26 #include "ui/compositor/layer_delegate.h" |
26 #include "ui/compositor/layer_type.h" | 27 #include "ui/compositor/layer_type.h" |
27 #include "ui/gfx/rect.h" | 28 #include "ui/gfx/rect.h" |
28 #include "ui/gfx/transform.h" | 29 #include "ui/gfx/transform.h" |
(...skipping 26 matching lines...) Expand all Loading... |
55 // Coordinate system used in layers is DIP (Density Independent Pixel) | 56 // Coordinate system used in layers is DIP (Density Independent Pixel) |
56 // coordinates unless explicitly mentioned as pixel coordinates. | 57 // coordinates unless explicitly mentioned as pixel coordinates. |
57 // | 58 // |
58 // NOTE: unlike Views, each Layer does *not* own its children views. If you | 59 // NOTE: unlike Views, each Layer does *not* own its children views. If you |
59 // delete a Layer and it has children, the parent of each child layer is set to | 60 // delete a Layer and it has children, the parent of each child layer is set to |
60 // NULL, but the children are not deleted. | 61 // NULL, but the children are not deleted. |
61 class COMPOSITOR_EXPORT Layer | 62 class COMPOSITOR_EXPORT Layer |
62 : public LayerAnimationDelegate, | 63 : public LayerAnimationDelegate, |
63 NON_EXPORTED_BASE(public cc::ContentLayerClient), | 64 NON_EXPORTED_BASE(public cc::ContentLayerClient), |
64 NON_EXPORTED_BASE(public cc::TextureLayerClient), | 65 NON_EXPORTED_BASE(public cc::TextureLayerClient), |
| 66 NON_EXPORTED_BASE(public cc::LayerClient), |
65 NON_EXPORTED_BASE(public cc::LayerAnimationEventObserver) { | 67 NON_EXPORTED_BASE(public cc::LayerAnimationEventObserver) { |
66 public: | 68 public: |
67 Layer(); | 69 Layer(); |
68 explicit Layer(LayerType type); | 70 explicit Layer(LayerType type); |
69 virtual ~Layer(); | 71 virtual ~Layer(); |
70 | 72 |
71 // Retrieves the Layer's compositor. The Layer will walk up its parent chain | 73 // Retrieves the Layer's compositor. The Layer will walk up its parent chain |
72 // to locate it. Returns NULL if the Layer is not attached to a compositor. | 74 // to locate it. Returns NULL if the Layer is not attached to a compositor. |
73 Compositor* GetCompositor(); | 75 Compositor* GetCompositor(); |
74 | 76 |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 virtual bool PrepareTextureMailbox(cc::TextureMailbox* mailbox, | 325 virtual bool PrepareTextureMailbox(cc::TextureMailbox* mailbox, |
324 bool use_shared_memory) OVERRIDE; | 326 bool use_shared_memory) OVERRIDE; |
325 | 327 |
326 float device_scale_factor() const { return device_scale_factor_; } | 328 float device_scale_factor() const { return device_scale_factor_; } |
327 | 329 |
328 // Forces a render surface to be used on this layer. This has no positive | 330 // Forces a render surface to be used on this layer. This has no positive |
329 // impact, and is only used for benchmarking/testing purpose. | 331 // impact, and is only used for benchmarking/testing purpose. |
330 void SetForceRenderSurface(bool force); | 332 void SetForceRenderSurface(bool force); |
331 bool force_render_surface() const { return force_render_surface_; } | 333 bool force_render_surface() const { return force_render_surface_; } |
332 | 334 |
| 335 // LayerClient |
| 336 virtual std::string DebugName() OVERRIDE; |
| 337 |
333 // LayerAnimationEventObserver | 338 // LayerAnimationEventObserver |
334 virtual void OnAnimationStarted(const cc::AnimationEvent& event) OVERRIDE; | 339 virtual void OnAnimationStarted(const cc::AnimationEvent& event) OVERRIDE; |
335 | 340 |
336 // Whether this layer has animations waiting to get sent to its cc::Layer. | 341 // Whether this layer has animations waiting to get sent to its cc::Layer. |
337 bool HasPendingThreadedAnimations() { | 342 bool HasPendingThreadedAnimations() { |
338 return pending_threaded_animations_.size() != 0; | 343 return pending_threaded_animations_.size() != 0; |
339 } | 344 } |
340 | 345 |
341 // Triggers a call to SwitchToLayer. | 346 // Triggers a call to SwitchToLayer. |
342 void SwitchCCLayerForTest(); | 347 void SwitchCCLayerForTest(); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 // The size of the delegated frame in DIP, set when SetDelegatedFrame was | 491 // The size of the delegated frame in DIP, set when SetDelegatedFrame was |
487 // called. | 492 // called. |
488 gfx::Size delegated_frame_size_in_dip_; | 493 gfx::Size delegated_frame_size_in_dip_; |
489 | 494 |
490 DISALLOW_COPY_AND_ASSIGN(Layer); | 495 DISALLOW_COPY_AND_ASSIGN(Layer); |
491 }; | 496 }; |
492 | 497 |
493 } // namespace ui | 498 } // namespace ui |
494 | 499 |
495 #endif // UI_COMPOSITOR_LAYER_H_ | 500 #endif // UI_COMPOSITOR_LAYER_H_ |
OLD | NEW |