Chromium Code Reviews| 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 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 | 39 |
| 40 // Represents the output surface for a compositor. The compositor owns | 40 // Represents the output surface for a compositor. The compositor owns |
| 41 // and manages its destruction. Its lifetime is: | 41 // and manages its destruction. Its lifetime is: |
| 42 // 1. Created on the main thread by the LayerTreeHost through its client. | 42 // 1. Created on the main thread by the LayerTreeHost through its client. |
| 43 // 2. Passed to the compositor thread and bound to a client via BindToClient. | 43 // 2. Passed to the compositor thread and bound to a client via BindToClient. |
| 44 // From here on, it will only be used on the compositor thread. | 44 // From here on, it will only be used on the compositor thread. |
| 45 // 3. If the 3D context is lost, then the compositor will delete the output | 45 // 3. If the 3D context is lost, then the compositor will delete the output |
| 46 // surface (on the compositor thread) and go back to step 1. | 46 // surface (on the compositor thread) and go back to step 1. |
| 47 class CC_EXPORT OutputSurface : public base::trace_event::MemoryDumpProvider { | 47 class CC_EXPORT OutputSurface : public base::trace_event::MemoryDumpProvider { |
| 48 public: | 48 public: |
| 49 // Constructor for GL-based and/or software compositing. | |
| 49 OutputSurface(scoped_refptr<ContextProvider> context_provider, | 50 OutputSurface(scoped_refptr<ContextProvider> context_provider, |
| 50 scoped_refptr<ContextProvider> worker_context_provider, | 51 scoped_refptr<ContextProvider> worker_context_provider, |
| 51 scoped_refptr<VulkanContextProvider> vulkan_context_provider, | |
| 52 std::unique_ptr<SoftwareOutputDevice> software_device); | 52 std::unique_ptr<SoftwareOutputDevice> software_device); |
| 53 OutputSurface(scoped_refptr<ContextProvider> context_provider, | |
| 54 scoped_refptr<ContextProvider> worker_context_provider); | |
| 55 explicit OutputSurface(scoped_refptr<ContextProvider> context_provider); | |
| 56 explicit OutputSurface(std::unique_ptr<SoftwareOutputDevice> software_device); | |
| 57 | 53 |
| 58 OutputSurface(scoped_refptr<ContextProvider> context_provider, | 54 // Constructor for Vulkan-based and/or software compositing. |
|
piman
2016/05/23 22:23:51
nit: For software compositing, we would use the ab
danakj
2016/05/23 22:28:55
Ya, kinda, until Webview uses vulkan and then we n
| |
| 55 OutputSurface(scoped_refptr<VulkanContextProvider> vulkan_context_provider, | |
| 59 std::unique_ptr<SoftwareOutputDevice> software_device); | 56 std::unique_ptr<SoftwareOutputDevice> software_device); |
| 60 | 57 |
| 61 ~OutputSurface() override; | 58 ~OutputSurface() override; |
| 62 | 59 |
| 63 struct Capabilities { | 60 struct Capabilities { |
| 64 Capabilities() | 61 Capabilities() |
| 65 : delegated_rendering(false), | 62 : delegated_rendering(false), |
| 66 max_frames_pending(1), | 63 max_frames_pending(1), |
| 67 adjust_deadline_for_parent(true), | 64 adjust_deadline_for_parent(true), |
| 68 uses_default_gl_framebuffer(true), | 65 uses_default_gl_framebuffer(true), |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 virtual void SetWorkerContextShouldAggressivelyFreeResources(bool is_visible); | 162 virtual void SetWorkerContextShouldAggressivelyFreeResources(bool is_visible); |
| 166 | 163 |
| 167 // If this returns true, then the surface will not attempt to draw. | 164 // If this returns true, then the surface will not attempt to draw. |
| 168 virtual bool SurfaceIsSuspendForRecycle() const; | 165 virtual bool SurfaceIsSuspendForRecycle() const; |
| 169 | 166 |
| 170 // base::trace_event::MemoryDumpProvider implementation. | 167 // base::trace_event::MemoryDumpProvider implementation. |
| 171 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, | 168 bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args, |
| 172 base::trace_event::ProcessMemoryDump* pmd) override; | 169 base::trace_event::ProcessMemoryDump* pmd) override; |
| 173 | 170 |
| 174 protected: | 171 protected: |
| 175 OutputSurfaceClient* client_; | 172 void PostSwapBuffersComplete(); |
| 176 | 173 |
| 177 void PostSwapBuffersComplete(); | 174 OutputSurfaceClient* client_ = nullptr; |
| 178 | 175 |
| 179 struct OutputSurface::Capabilities capabilities_; | 176 struct OutputSurface::Capabilities capabilities_; |
| 180 scoped_refptr<ContextProvider> context_provider_; | 177 scoped_refptr<ContextProvider> context_provider_; |
| 181 scoped_refptr<ContextProvider> worker_context_provider_; | 178 scoped_refptr<ContextProvider> worker_context_provider_; |
| 182 scoped_refptr<VulkanContextProvider> vulkan_context_provider_; | 179 scoped_refptr<VulkanContextProvider> vulkan_context_provider_; |
| 183 std::unique_ptr<SoftwareOutputDevice> software_device_; | 180 std::unique_ptr<SoftwareOutputDevice> software_device_; |
| 184 gfx::Size surface_size_; | 181 gfx::Size surface_size_; |
| 185 float device_scale_factor_; | 182 float device_scale_factor_ = -1; |
| 186 bool has_alpha_; | 183 bool has_alpha_ = true; |
| 187 base::ThreadChecker client_thread_checker_; | 184 base::ThreadChecker client_thread_checker_; |
| 188 | 185 |
| 189 void SetNeedsRedrawRect(const gfx::Rect& damage_rect); | 186 void SetNeedsRedrawRect(const gfx::Rect& damage_rect); |
| 190 void ReclaimResources(const CompositorFrameAck* ack); | 187 void ReclaimResources(const CompositorFrameAck* ack); |
| 191 void SetExternalStencilTest(bool enabled); | 188 void SetExternalStencilTest(bool enabled); |
| 192 void DetachFromClientInternal(); | 189 void DetachFromClientInternal(); |
| 193 | 190 |
| 194 private: | 191 private: |
| 195 bool external_stencil_test_enabled_; | 192 bool external_stencil_test_enabled_ = false; |
| 196 | 193 |
| 197 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; | 194 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; |
| 198 | 195 |
| 199 DISALLOW_COPY_AND_ASSIGN(OutputSurface); | 196 DISALLOW_COPY_AND_ASSIGN(OutputSurface); |
| 200 }; | 197 }; |
| 201 | 198 |
| 202 } // namespace cc | 199 } // namespace cc |
| 203 | 200 |
| 204 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ | 201 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ |
| OLD | NEW |