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_OUTPUT_COMPOSITOR_FRAME_SINK_H_ | 5 #ifndef CC_OUTPUT_COMPOSITOR_FRAME_SINK_H_ |
6 #define CC_OUTPUT_COMPOSITOR_FRAME_SINK_H_ | 6 #define CC_OUTPUT_COMPOSITOR_FRAME_SINK_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 // which will compose frames from multiple CompositorFrameSinks to show | 34 // which will compose frames from multiple CompositorFrameSinks to show |
35 // on screen to the user. | 35 // on screen to the user. |
36 // If a context_provider() is present, frames should be submitted with | 36 // If a context_provider() is present, frames should be submitted with |
37 // OpenGL resources (created with the context_provider()). If not, then | 37 // OpenGL resources (created with the context_provider()). If not, then |
38 // SharedBitmap resources should be used. | 38 // SharedBitmap resources should be used. |
39 class CC_EXPORT CompositorFrameSink { | 39 class CC_EXPORT CompositorFrameSink { |
40 public: | 40 public: |
41 struct Capabilities { | 41 struct Capabilities { |
42 Capabilities() = default; | 42 Capabilities() = default; |
43 | 43 |
44 // Whether ForceReclaimResources can be called to reclaim all resources | 44 // True if we must always swap, even if there is no damage to the frame. |
45 // from the CompositorFrameSink. | 45 // Needed for both the browser compositor as well as layout tests. |
46 bool can_force_reclaim_resources = false; | 46 // TODO(ericrk): This should be test-only for layout tests, but tab |
| 47 // capture has issues capturing offscreen tabs whithout this. We should |
| 48 // remove this dependency. crbug.com/680196 |
| 49 bool must_always_swap = false; |
| 50 |
47 // True if sync points for resources are needed when swapping delegated | 51 // True if sync points for resources are needed when swapping delegated |
48 // frames. | 52 // frames. |
49 bool delegated_sync_points_required = true; | 53 bool delegated_sync_points_required = true; |
50 }; | 54 }; |
51 | 55 |
52 // Constructor for GL-based and/or software resources. | 56 // Constructor for GL-based and/or software resources. |
53 // gpu_memory_buffer_manager and shared_bitmap_manager must outlive the | 57 // gpu_memory_buffer_manager and shared_bitmap_manager must outlive the |
54 // CompositorFrameSink. | 58 // CompositorFrameSink. |
55 // shared_bitmap_manager is optional (won't be used) if context_provider is | 59 // shared_bitmap_manager is optional (won't be used) if context_provider is |
56 // present. | 60 // present. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 VulkanContextProvider* vulkan_context_provider() const { | 99 VulkanContextProvider* vulkan_context_provider() const { |
96 return vulkan_context_provider_.get(); | 100 return vulkan_context_provider_.get(); |
97 } | 101 } |
98 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager() const { | 102 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager() const { |
99 return gpu_memory_buffer_manager_; | 103 return gpu_memory_buffer_manager_; |
100 } | 104 } |
101 SharedBitmapManager* shared_bitmap_manager() const { | 105 SharedBitmapManager* shared_bitmap_manager() const { |
102 return shared_bitmap_manager_; | 106 return shared_bitmap_manager_; |
103 } | 107 } |
104 | 108 |
105 // If supported, this causes a ReclaimResources for all resources that are | |
106 // currently in use. | |
107 virtual void ForceReclaimResources() {} | |
108 | |
109 // If supported, this sets the LocalSurfaceId the CompositorFrameSink will use | 109 // If supported, this sets the LocalSurfaceId the CompositorFrameSink will use |
110 // to submit a CompositorFrame. | 110 // to submit a CompositorFrame. |
111 virtual void SetLocalSurfaceId(const LocalSurfaceId& local_surface_id) {} | 111 virtual void SetLocalSurfaceId(const LocalSurfaceId& local_surface_id) {} |
112 | 112 |
113 // Support for a pull-model where draws are requested by the output surface. | 113 // Support for a pull-model where draws are requested by the output surface. |
114 // | 114 // |
115 // CompositorFrameSink::Invalidate is called by the compositor to notify that | 115 // CompositorFrameSink::Invalidate is called by the compositor to notify that |
116 // there's new content. | 116 // there's new content. |
117 virtual void Invalidate() {} | 117 virtual void Invalidate() {} |
118 | 118 |
(...skipping 16 matching lines...) Expand all Loading... |
135 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; | 135 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager_; |
136 SharedBitmapManager* shared_bitmap_manager_; | 136 SharedBitmapManager* shared_bitmap_manager_; |
137 | 137 |
138 private: | 138 private: |
139 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSink); | 139 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSink); |
140 }; | 140 }; |
141 | 141 |
142 } // namespace cc | 142 } // namespace cc |
143 | 143 |
144 #endif // CC_OUTPUT_COMPOSITOR_FRAME_SINK_H_ | 144 #endif // CC_OUTPUT_COMPOSITOR_FRAME_SINK_H_ |
OLD | NEW |