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/memory/ref_counted.h" |
| 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/synchronization/lock.h" |
8 #include "cc/base/cc_export.h" | 11 #include "cc/base/cc_export.h" |
9 #include "cc/layers/layer.h" | 12 #include "cc/layers/layer.h" |
10 #include "cc/resources/returned_resource.h" | 13 #include "cc/resources/returned_resource.h" |
11 | 14 |
12 namespace cc { | 15 namespace cc { |
13 | 16 class BlockingTaskRunner; |
14 class DelegatedFrameData; | 17 class DelegatedFrameData; |
15 class DelegatedRendererLayerClient; | 18 class DelegatedRendererLayerClient; |
16 | 19 |
17 class CC_EXPORT DelegatedRendererLayer : public Layer { | 20 class CC_EXPORT DelegatedRendererLayer : public Layer { |
18 public: | 21 public: |
19 static scoped_refptr<DelegatedRendererLayer> Create( | 22 static scoped_refptr<DelegatedRendererLayer> Create( |
20 DelegatedRendererLayerClient* client); | 23 DelegatedRendererLayerClient* client); |
21 | 24 |
22 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) | 25 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) |
23 OVERRIDE; | 26 OVERRIDE; |
(...skipping 11 matching lines...) Expand all Loading... |
35 | 38 |
36 // Passes ownership of any unused resources that had been given by the child | 39 // Passes ownership of any unused resources that had been given by the child |
37 // compositor to the given array, so they can be given back to the child. | 40 // compositor to the given array, so they can be given back to the child. |
38 void TakeUnusedResourcesForChildCompositor(ReturnedResourceArray* array); | 41 void TakeUnusedResourcesForChildCompositor(ReturnedResourceArray* array); |
39 | 42 |
40 protected: | 43 protected: |
41 explicit DelegatedRendererLayer(DelegatedRendererLayerClient* client); | 44 explicit DelegatedRendererLayer(DelegatedRendererLayerClient* client); |
42 virtual ~DelegatedRendererLayer(); | 45 virtual ~DelegatedRendererLayer(); |
43 | 46 |
44 private: | 47 private: |
| 48 void ReceiveUnusedResources(const ReturnedResourceArray& unused); |
| 49 static void ReceiveUnusedResourcesOnImplThread( |
| 50 scoped_refptr<BlockingTaskRunner> task_runner, |
| 51 base::WeakPtr<DelegatedRendererLayer> self, |
| 52 const ReturnedResourceArray& unused); |
| 53 |
45 scoped_ptr<DelegatedFrameData> frame_data_; | 54 scoped_ptr<DelegatedFrameData> frame_data_; |
46 gfx::RectF damage_in_frame_; | 55 gfx::RectF damage_in_frame_; |
47 gfx::Size frame_size_; | 56 gfx::Size frame_size_; |
48 gfx::Size display_size_; | 57 gfx::Size display_size_; |
49 ReturnedResourceArray unused_resources_for_child_compositor_; | |
50 | 58 |
51 DelegatedRendererLayerClient* client_; | 59 DelegatedRendererLayerClient* client_; |
52 bool needs_filter_context_; | 60 bool needs_filter_context_; |
53 | 61 |
| 62 ReturnedResourceArray unused_resources_for_child_compositor_; |
| 63 scoped_refptr<BlockingTaskRunner> main_thread_runner_; |
| 64 base::WeakPtrFactory<DelegatedRendererLayer> weak_ptrs_; |
| 65 |
54 DISALLOW_COPY_AND_ASSIGN(DelegatedRendererLayer); | 66 DISALLOW_COPY_AND_ASSIGN(DelegatedRendererLayer); |
55 }; | 67 }; |
56 | 68 |
57 } // namespace cc | 69 } // namespace cc |
| 70 |
58 #endif // CC_LAYERS_DELEGATED_RENDERER_LAYER_H_ | 71 #endif // CC_LAYERS_DELEGATED_RENDERER_LAYER_H_ |
OLD | NEW |