| 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 | |
| 44 // from the CompositorFrameSink. | |
| 45 bool can_force_reclaim_resources = false; | |
| 46 // True if sync points for resources are needed when swapping delegated | 43 // True if sync points for resources are needed when swapping delegated |
| 47 // frames. | 44 // frames. |
| 48 bool delegated_sync_points_required = true; | 45 bool delegated_sync_points_required = true; |
| 49 }; | 46 }; |
| 50 | 47 |
| 51 // Constructor for GL-based and/or software resources. | 48 // Constructor for GL-based and/or software resources. |
| 52 // gpu_memory_buffer_manager and shared_bitmap_manager must outlive the | 49 // gpu_memory_buffer_manager and shared_bitmap_manager must outlive the |
| 53 // CompositorFrameSink. | 50 // CompositorFrameSink. |
| 54 // shared_bitmap_manager is optional (won't be used) if context_provider is | 51 // shared_bitmap_manager is optional (won't be used) if context_provider is |
| 55 // present. | 52 // present. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 VulkanContextProvider* vulkan_context_provider() const { | 91 VulkanContextProvider* vulkan_context_provider() const { |
| 95 return vulkan_context_provider_.get(); | 92 return vulkan_context_provider_.get(); |
| 96 } | 93 } |
| 97 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager() const { | 94 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager() const { |
| 98 return gpu_memory_buffer_manager_; | 95 return gpu_memory_buffer_manager_; |
| 99 } | 96 } |
| 100 SharedBitmapManager* shared_bitmap_manager() const { | 97 SharedBitmapManager* shared_bitmap_manager() const { |
| 101 return shared_bitmap_manager_; | 98 return shared_bitmap_manager_; |
| 102 } | 99 } |
| 103 | 100 |
| 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. | 101 // Support for a pull-model where draws are requested by the output surface. |
| 109 // | 102 // |
| 110 // CompositorFrameSink::Invalidate is called by the compositor to notify that | 103 // CompositorFrameSink::Invalidate is called by the compositor to notify that |
| 111 // there's new content. | 104 // there's new content. |
| 112 virtual void Invalidate() {} | 105 virtual void Invalidate() {} |
| 113 | 106 |
| 114 // For successful swaps, the implementation must call | 107 // For successful swaps, the implementation must call |
| 115 // DidReceiveCompositorFrameAck() asynchronously when the frame has been | 108 // DidReceiveCompositorFrameAck() asynchronously when the frame has been |
| 116 // processed in order to unthrottle the next frame. | 109 // processed in order to unthrottle the next frame. |
| 117 virtual void SubmitCompositorFrame(CompositorFrame frame) = 0; | 110 virtual void SubmitCompositorFrame(CompositorFrame frame) = 0; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 131 SharedBitmapManager* shared_bitmap_manager_; | 124 SharedBitmapManager* shared_bitmap_manager_; |
| 132 base::ThreadChecker client_thread_checker_; | 125 base::ThreadChecker client_thread_checker_; |
| 133 | 126 |
| 134 private: | 127 private: |
| 135 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSink); | 128 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSink); |
| 136 }; | 129 }; |
| 137 | 130 |
| 138 } // namespace cc | 131 } // namespace cc |
| 139 | 132 |
| 140 #endif // CC_OUTPUT_COMPOSITOR_FRAME_SINK_H_ | 133 #endif // CC_OUTPUT_COMPOSITOR_FRAME_SINK_H_ |
| OLD | NEW |