OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 CC_LAYERS_DELEGATED_RENDERER_LAYER_H_ | 5 #ifndef CC_LAYERS_DELEGATED_RENDERER_LAYER_H_ |
6 #define CC_LAYERS_DELEGATED_RENDERER_LAYER_H_ | 6 #define CC_LAYERS_DELEGATED_RENDERER_LAYER_H_ |
7 | 7 |
8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "base/synchronization/lock.h" | 11 #include "base/synchronization/lock.h" |
12 #include "cc/base/cc_export.h" | 12 #include "cc/base/cc_export.h" |
13 #include "cc/layers/delegated_frame_provider.h" | 13 #include "cc/layers/delegated_frame_provider.h" |
14 #include "cc/layers/layer.h" | 14 #include "cc/layers/layer.h" |
15 #include "cc/resources/returned_resource.h" | 15 #include "cc/resources/returned_resource.h" |
16 | 16 |
17 namespace cc { | 17 namespace cc { |
18 class BlockingTaskRunner; | 18 class BlockingTaskRunner; |
19 class DelegatedRendererLayerClient; | |
20 | 19 |
21 class CC_EXPORT DelegatedRendererLayer : public Layer { | 20 class CC_EXPORT DelegatedRendererLayer : public Layer { |
22 public: | 21 public: |
23 static scoped_refptr<DelegatedRendererLayer> Create( | 22 static scoped_refptr<DelegatedRendererLayer> Create( |
24 DelegatedRendererLayerClient* client, | |
25 const scoped_refptr<DelegatedFrameProvider>& frame_provider); | 23 const scoped_refptr<DelegatedFrameProvider>& frame_provider); |
26 | 24 |
27 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) | 25 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) |
28 OVERRIDE; | 26 OVERRIDE; |
29 virtual void SetLayerTreeHost(LayerTreeHost* host) OVERRIDE; | 27 virtual void SetLayerTreeHost(LayerTreeHost* host) OVERRIDE; |
30 virtual bool Update(ResourceUpdateQueue* queue, | 28 virtual bool Update(ResourceUpdateQueue* queue, |
31 const OcclusionTracker* occlusion) OVERRIDE; | 29 const OcclusionTracker* occlusion) OVERRIDE; |
32 virtual void PushPropertiesTo(LayerImpl* impl) OVERRIDE; | 30 virtual void PushPropertiesTo(LayerImpl* impl) OVERRIDE; |
33 | 31 |
34 // Set the size at which the frame should be displayed, with the origin at the | 32 // Set the size at which the frame should be displayed, with the origin at the |
35 // layer's origin. This must always contain at least the layer's bounds. A | 33 // layer's origin. This must always contain at least the layer's bounds. A |
36 // value of (0, 0) implies that the frame should be displayed to fit exactly | 34 // value of (0, 0) implies that the frame should be displayed to fit exactly |
37 // in the layer's bounds. | 35 // in the layer's bounds. |
38 void SetDisplaySize(gfx::Size size); | 36 void SetDisplaySize(gfx::Size size); |
39 | 37 |
40 // Called by the DelegatedFrameProvider when a new frame is available to be | 38 // Called by the DelegatedFrameProvider when a new frame is available to be |
41 // picked up. | 39 // picked up. |
42 void ProviderHasNewFrame(); | 40 void ProviderHasNewFrame(); |
43 | 41 |
44 protected: | 42 protected: |
45 DelegatedRendererLayer( | 43 DelegatedRendererLayer( |
46 DelegatedRendererLayerClient* client, | |
47 const scoped_refptr<DelegatedFrameProvider>& frame_provider); | 44 const scoped_refptr<DelegatedFrameProvider>& frame_provider); |
48 virtual ~DelegatedRendererLayer(); | 45 virtual ~DelegatedRendererLayer(); |
49 | 46 |
50 private: | 47 private: |
51 DelegatedRendererLayerClient* client_; | |
52 scoped_refptr<DelegatedFrameProvider> frame_provider_; | 48 scoped_refptr<DelegatedFrameProvider> frame_provider_; |
53 | 49 |
54 bool should_collect_new_frame_; | 50 bool should_collect_new_frame_; |
55 | 51 |
56 DelegatedFrameData* frame_data_; | 52 DelegatedFrameData* frame_data_; |
57 gfx::RectF frame_damage_; | 53 gfx::RectF frame_damage_; |
58 | 54 |
59 gfx::Size display_size_; | 55 gfx::Size display_size_; |
60 | 56 |
61 scoped_refptr<BlockingTaskRunner> main_thread_runner_; | 57 scoped_refptr<BlockingTaskRunner> main_thread_runner_; |
62 base::WeakPtrFactory<DelegatedRendererLayer> weak_ptrs_; | 58 base::WeakPtrFactory<DelegatedRendererLayer> weak_ptrs_; |
63 | 59 |
64 DISALLOW_COPY_AND_ASSIGN(DelegatedRendererLayer); | 60 DISALLOW_COPY_AND_ASSIGN(DelegatedRendererLayer); |
65 }; | 61 }; |
66 | 62 |
67 } // namespace cc | 63 } // namespace cc |
68 | 64 |
69 #endif // CC_LAYERS_DELEGATED_RENDERER_LAYER_H_ | 65 #endif // CC_LAYERS_DELEGATED_RENDERER_LAYER_H_ |
OLD | NEW |