| 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 | 10 |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
| 15 #include "cc/base/cc_export.h" | 15 #include "cc/base/cc_export.h" |
| 16 #include "cc/output/context_provider.h" | 16 #include "cc/output/context_provider.h" |
| 17 #include "cc/output/overlay_candidate_validator.h" | 17 #include "cc/output/overlay_candidate_validator.h" |
| 18 #include "cc/output/software_output_device.h" | 18 #include "cc/output/software_output_device.h" |
| 19 | 19 |
| 20 #if defined(ENABLE_VULKAN) | 20 #if defined(ENABLE_VULKAN) |
| 21 #include "cc/output/vulkan_context_provider.h" | 21 #include "cc/output/vulkan_context_provider.h" |
| 22 #endif | 22 #endif |
| (...skipping 24 matching lines...) Expand all Loading... |
| 47 // From here on, it will only be used on the compositor thread. | 47 // From here on, it will only be used on the compositor thread. |
| 48 // 3. If the 3D context is lost, then the compositor will delete the output | 48 // 3. If the 3D context is lost, then the compositor will delete the output |
| 49 // surface (on the compositor thread) and go back to step 1. | 49 // surface (on the compositor thread) and go back to step 1. |
| 50 class CC_EXPORT OutputSurface : public base::trace_event::MemoryDumpProvider { | 50 class CC_EXPORT OutputSurface : public base::trace_event::MemoryDumpProvider { |
| 51 public: | 51 public: |
| 52 OutputSurface(scoped_refptr<ContextProvider> context_provider, | 52 OutputSurface(scoped_refptr<ContextProvider> context_provider, |
| 53 scoped_refptr<ContextProvider> worker_context_provider, | 53 scoped_refptr<ContextProvider> worker_context_provider, |
| 54 #if defined(ENABLE_VULKAN) | 54 #if defined(ENABLE_VULKAN) |
| 55 scoped_refptr<VulkanContextProvider> vulkan_context_provider, | 55 scoped_refptr<VulkanContextProvider> vulkan_context_provider, |
| 56 #endif | 56 #endif |
| 57 scoped_ptr<SoftwareOutputDevice> software_device); | 57 std::unique_ptr<SoftwareOutputDevice> software_device); |
| 58 OutputSurface(scoped_refptr<ContextProvider> context_provider, | 58 OutputSurface(scoped_refptr<ContextProvider> context_provider, |
| 59 scoped_refptr<ContextProvider> worker_context_provider); | 59 scoped_refptr<ContextProvider> worker_context_provider); |
| 60 explicit OutputSurface(scoped_refptr<ContextProvider> context_provider); | 60 explicit OutputSurface(scoped_refptr<ContextProvider> context_provider); |
| 61 #if defined(ENABLE_VULKAN) | 61 #if defined(ENABLE_VULKAN) |
| 62 explicit OutputSurface( | 62 explicit OutputSurface( |
| 63 scoped_refptr<VulkanContextProvider> vulkan_context_provider); | 63 scoped_refptr<VulkanContextProvider> vulkan_context_provider); |
| 64 #endif | 64 #endif |
| 65 explicit OutputSurface(scoped_ptr<SoftwareOutputDevice> software_device); | 65 explicit OutputSurface(std::unique_ptr<SoftwareOutputDevice> software_device); |
| 66 | 66 |
| 67 OutputSurface(scoped_refptr<ContextProvider> context_provider, | 67 OutputSurface(scoped_refptr<ContextProvider> context_provider, |
| 68 scoped_ptr<SoftwareOutputDevice> software_device); | 68 std::unique_ptr<SoftwareOutputDevice> software_device); |
| 69 | 69 |
| 70 ~OutputSurface() override; | 70 ~OutputSurface() override; |
| 71 | 71 |
| 72 struct Capabilities { | 72 struct Capabilities { |
| 73 Capabilities() | 73 Capabilities() |
| 74 : delegated_rendering(false), | 74 : delegated_rendering(false), |
| 75 max_frames_pending(1), | 75 max_frames_pending(1), |
| 76 adjust_deadline_for_parent(true), | 76 adjust_deadline_for_parent(true), |
| 77 uses_default_gl_framebuffer(true), | 77 uses_default_gl_framebuffer(true), |
| 78 flipped_output_surface(false), | 78 flipped_output_surface(false), |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 OutputSurfaceClient* client_; | 186 OutputSurfaceClient* client_; |
| 187 | 187 |
| 188 void PostSwapBuffersComplete(); | 188 void PostSwapBuffersComplete(); |
| 189 | 189 |
| 190 struct OutputSurface::Capabilities capabilities_; | 190 struct OutputSurface::Capabilities capabilities_; |
| 191 scoped_refptr<ContextProvider> context_provider_; | 191 scoped_refptr<ContextProvider> context_provider_; |
| 192 scoped_refptr<ContextProvider> worker_context_provider_; | 192 scoped_refptr<ContextProvider> worker_context_provider_; |
| 193 #if defined(ENABLE_VULKAN) | 193 #if defined(ENABLE_VULKAN) |
| 194 scoped_refptr<VulkanContextProvider> vulkan_context_provider_; | 194 scoped_refptr<VulkanContextProvider> vulkan_context_provider_; |
| 195 #endif | 195 #endif |
| 196 scoped_ptr<SoftwareOutputDevice> software_device_; | 196 std::unique_ptr<SoftwareOutputDevice> software_device_; |
| 197 gfx::Size surface_size_; | 197 gfx::Size surface_size_; |
| 198 float device_scale_factor_; | 198 float device_scale_factor_; |
| 199 bool has_alpha_; | 199 bool has_alpha_; |
| 200 base::ThreadChecker client_thread_checker_; | 200 base::ThreadChecker client_thread_checker_; |
| 201 | 201 |
| 202 void CommitVSyncParameters(base::TimeTicks timebase, | 202 void CommitVSyncParameters(base::TimeTicks timebase, |
| 203 base::TimeDelta interval); | 203 base::TimeDelta interval); |
| 204 | 204 |
| 205 void SetNeedsRedrawRect(const gfx::Rect& damage_rect); | 205 void SetNeedsRedrawRect(const gfx::Rect& damage_rect); |
| 206 void ReclaimResources(const CompositorFrameAck* ack); | 206 void ReclaimResources(const CompositorFrameAck* ack); |
| 207 void SetExternalStencilTest(bool enabled); | 207 void SetExternalStencilTest(bool enabled); |
| 208 void DetachFromClientInternal(); | 208 void DetachFromClientInternal(); |
| 209 | 209 |
| 210 private: | 210 private: |
| 211 bool external_stencil_test_enabled_; | 211 bool external_stencil_test_enabled_; |
| 212 | 212 |
| 213 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; | 213 base::WeakPtrFactory<OutputSurface> weak_ptr_factory_; |
| 214 | 214 |
| 215 DISALLOW_COPY_AND_ASSIGN(OutputSurface); | 215 DISALLOW_COPY_AND_ASSIGN(OutputSurface); |
| 216 }; | 216 }; |
| 217 | 217 |
| 218 } // namespace cc | 218 } // namespace cc |
| 219 | 219 |
| 220 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ | 220 #endif // CC_OUTPUT_OUTPUT_SURFACE_H_ |
| OLD | NEW |