Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ | 5 #ifndef CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ |
| 6 #define CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ | 6 #define CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/threading/non_thread_safe.h" | 9 #include "base/threading/non_thread_safe.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "cc/output/output_surface.h" | 11 #include "cc/output/output_surface.h" |
| 12 #include "content/common/content_export.h" | 12 #include "content/common/content_export.h" |
| 13 #include "ui/compositor/compositor_vsync_manager.h" | |
| 14 | 13 |
| 15 namespace cc { | 14 namespace cc { |
| 16 class SoftwareOutputDevice; | 15 class SoftwareOutputDevice; |
| 17 class SyntheticBeginFrameSource; | |
| 18 } | 16 } |
| 19 | 17 |
| 20 namespace display_compositor { | 18 namespace display_compositor { |
| 21 class CompositorOverlayCandidateValidator; | 19 class CompositorOverlayCandidateValidator; |
| 22 } | 20 } |
| 23 | 21 |
| 24 namespace gfx { | 22 namespace gfx { |
| 25 enum class SwapResult; | 23 enum class SwapResult; |
| 26 } | 24 } |
| 27 | 25 |
| 28 namespace content { | 26 namespace content { |
| 29 class ReflectorImpl; | 27 class ReflectorImpl; |
| 30 | 28 |
| 31 class CONTENT_EXPORT BrowserCompositorOutputSurface | 29 class CONTENT_EXPORT BrowserCompositorOutputSurface |
| 32 : public cc::OutputSurface { | 30 : public cc::OutputSurface { |
| 33 public: | 31 public: |
| 32 using UpdateVSyncParametersCallback = | |
| 33 base::Callback<void(base::TimeTicks timebase, base::TimeDelta interval)>; | |
| 34 | |
| 34 ~BrowserCompositorOutputSurface() override; | 35 ~BrowserCompositorOutputSurface() override; |
| 35 | 36 |
| 36 // cc::OutputSurface implementation. | 37 // cc::OutputSurface implementation. |
| 37 cc::OverlayCandidateValidator* GetOverlayCandidateValidator() const override; | 38 cc::OverlayCandidateValidator* GetOverlayCandidateValidator() const override; |
| 38 bool HasExternalStencilTest() const override; | 39 bool HasExternalStencilTest() const override; |
| 39 void ApplyExternalStencil() override; | 40 void ApplyExternalStencil() override; |
| 40 | 41 |
| 41 void OnUpdateVSyncParametersFromGpu(base::TimeTicks timebase, | 42 void OnUpdateVSyncParametersFromGpu(base::TimeTicks timebase, |
|
danakj
2016/12/02 21:44:14
This should go away?
stanisc
2016/12/02 22:25:20
Right, will do.
stanisc
2016/12/02 22:44:54
Done.
| |
| 42 base::TimeDelta interval); | 43 base::TimeDelta interval); |
| 43 | 44 |
| 44 void SetReflector(ReflectorImpl* reflector); | 45 void SetReflector(ReflectorImpl* reflector); |
| 45 | 46 |
| 46 // Called when |reflector_| was updated. | 47 // Called when |reflector_| was updated. |
| 47 virtual void OnReflectorChanged(); | 48 virtual void OnReflectorChanged(); |
| 48 | 49 |
| 49 #if defined(OS_MACOSX) | 50 #if defined(OS_MACOSX) |
| 50 virtual void SetSurfaceSuspendedForRecycle(bool suspended) = 0; | 51 virtual void SetSurfaceSuspendedForRecycle(bool suspended) = 0; |
| 51 #endif | 52 #endif |
| 52 | 53 |
| 53 protected: | 54 protected: |
| 54 // Constructor used by the accelerated implementation. | 55 // Constructor used by the accelerated implementation. |
| 55 BrowserCompositorOutputSurface( | 56 BrowserCompositorOutputSurface( |
| 56 scoped_refptr<cc::ContextProvider> context, | 57 scoped_refptr<cc::ContextProvider> context, |
| 57 scoped_refptr<ui::CompositorVSyncManager> vsync_manager, | 58 const UpdateVSyncParametersCallback& update_vsync_parameters_callback, |
| 58 cc::SyntheticBeginFrameSource* begin_frame_source, | |
| 59 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> | 59 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> |
| 60 overlay_candidate_validator); | 60 overlay_candidate_validator); |
| 61 | 61 |
| 62 // Constructor used by the software implementation. | 62 // Constructor used by the software implementation. |
| 63 BrowserCompositorOutputSurface( | 63 BrowserCompositorOutputSurface( |
| 64 std::unique_ptr<cc::SoftwareOutputDevice> software_device, | 64 std::unique_ptr<cc::SoftwareOutputDevice> software_device, |
| 65 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager, | 65 const UpdateVSyncParametersCallback& update_vsync_parameters_callback); |
| 66 cc::SyntheticBeginFrameSource* begin_frame_source); | |
| 67 | 66 |
| 68 // Constructor used by the Vulkan implementation. | 67 // Constructor used by the Vulkan implementation. |
| 69 BrowserCompositorOutputSurface( | 68 BrowserCompositorOutputSurface( |
| 70 const scoped_refptr<cc::VulkanContextProvider>& vulkan_context_provider, | 69 const scoped_refptr<cc::VulkanContextProvider>& vulkan_context_provider, |
| 71 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager, | 70 const UpdateVSyncParametersCallback& update_vsync_parameters_callback); |
| 72 cc::SyntheticBeginFrameSource* begin_frame_source); | |
| 73 | 71 |
| 74 scoped_refptr<ui::CompositorVSyncManager> vsync_manager_; | 72 const UpdateVSyncParametersCallback update_vsync_parameters_callback_; |
| 75 cc::SyntheticBeginFrameSource* synthetic_begin_frame_source_; | |
| 76 ReflectorImpl* reflector_; | 73 ReflectorImpl* reflector_; |
| 77 | 74 |
| 78 private: | 75 private: |
| 79 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> | 76 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> |
| 80 overlay_candidate_validator_; | 77 overlay_candidate_validator_; |
| 81 | 78 |
| 82 DISALLOW_COPY_AND_ASSIGN(BrowserCompositorOutputSurface); | 79 DISALLOW_COPY_AND_ASSIGN(BrowserCompositorOutputSurface); |
| 83 }; | 80 }; |
| 84 | 81 |
| 85 } // namespace content | 82 } // namespace content |
| 86 | 83 |
| 87 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ | 84 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ |
| OLD | NEW |