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_OUTPUT_SURFACE_H_ | 5 #ifndef CC_OUTPUT_OUTPUT_SURFACE_H_ |
6 #define CC_OUTPUT_OUTPUT_SURFACE_H_ | 6 #define CC_OUTPUT_OUTPUT_SURFACE_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/weak_ptr.h" | |
14 #include "base/threading/thread_checker.h" | 13 #include "base/threading/thread_checker.h" |
15 #include "cc/base/cc_export.h" | 14 #include "cc/base/cc_export.h" |
16 #include "cc/output/context_provider.h" | 15 #include "cc/output/context_provider.h" |
17 #include "cc/output/overlay_candidate_validator.h" | 16 #include "cc/output/overlay_candidate_validator.h" |
18 #include "cc/output/software_output_device.h" | 17 #include "cc/output/software_output_device.h" |
19 #include "cc/output/vulkan_context_provider.h" | 18 #include "cc/output/vulkan_context_provider.h" |
20 #include "cc/resources/returned_resource.h" | 19 #include "cc/resources/returned_resource.h" |
21 #include "gpu/command_buffer/common/texture_in_use_response.h" | 20 #include "gpu/command_buffer/common/texture_in_use_response.h" |
22 #include "ui/gfx/color_space.h" | 21 #include "ui/gfx/color_space.h" |
23 | 22 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // when the framebuffer is bound via BindFramebuffer(). | 121 // when the framebuffer is bound via BindFramebuffer(). |
123 virtual uint32_t GetFramebufferCopyTextureFormat() = 0; | 122 virtual uint32_t GetFramebufferCopyTextureFormat() = 0; |
124 | 123 |
125 // The implementation may destroy or steal the contents of the CompositorFrame | 124 // The implementation may destroy or steal the contents of the CompositorFrame |
126 // passed in (though it will not take ownership of the CompositorFrame | 125 // passed in (though it will not take ownership of the CompositorFrame |
127 // itself). For successful swaps, the implementation must call | 126 // itself). For successful swaps, the implementation must call |
128 // OutputSurfaceClient::DidSwapBuffersComplete() eventually. | 127 // OutputSurfaceClient::DidSwapBuffersComplete() eventually. |
129 virtual void SwapBuffers(OutputSurfaceFrame frame) = 0; | 128 virtual void SwapBuffers(OutputSurfaceFrame frame) = 0; |
130 | 129 |
131 protected: | 130 protected: |
132 void PostSwapBuffersComplete(); | |
133 | |
134 // Used internally for the context provider to inform the client about loss, | 131 // Used internally for the context provider to inform the client about loss, |
135 // and can be overridden to change behaviour instead of informing the client. | 132 // and can be overridden to change behaviour instead of informing the client. |
136 virtual void DidLoseOutputSurface(); | 133 virtual void DidLoseOutputSurface(); |
137 | 134 |
138 OutputSurfaceClient* client_ = nullptr; | 135 OutputSurfaceClient* client_ = nullptr; |
139 | 136 |
140 struct OutputSurface::Capabilities capabilities_; | 137 struct OutputSurface::Capabilities capabilities_; |
141 scoped_refptr<ContextProvider> context_provider_; | 138 scoped_refptr<ContextProvider> context_provider_; |
142 scoped_refptr<VulkanContextProvider> vulkan_context_provider_; | 139 scoped_refptr<VulkanContextProvider> vulkan_context_provider_; |
143 std::unique_ptr<SoftwareOutputDevice> software_device_; | 140 std::unique_ptr<SoftwareOutputDevice> software_device_; |
144 base::ThreadChecker thread_checker_; | 141 base::ThreadChecker thread_checker_; |
145 | 142 |
146 private: | 143 private: |
147 void OnSwapBuffersComplete(); | |
148 | |
149 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; | |
150 | |
151 DISALLOW_COPY_AND_ASSIGN(OutputSurface); | 144 DISALLOW_COPY_AND_ASSIGN(OutputSurface); |
152 }; | 145 }; |
153 | 146 |
154 } // namespace cc | 147 } // namespace cc |
155 | 148 |
156 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ | 149 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ |
OLD | NEW |