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