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 base::TimeDelta interval); | |
43 | |
44 void SetReflector(ReflectorImpl* reflector); | 42 void SetReflector(ReflectorImpl* reflector); |
45 | 43 |
46 // Called when |reflector_| was updated. | 44 // Called when |reflector_| was updated. |
47 virtual void OnReflectorChanged(); | 45 virtual void OnReflectorChanged(); |
48 | 46 |
49 #if defined(OS_MACOSX) | 47 #if defined(OS_MACOSX) |
50 virtual void SetSurfaceSuspendedForRecycle(bool suspended) = 0; | 48 virtual void SetSurfaceSuspendedForRecycle(bool suspended) = 0; |
51 #endif | 49 #endif |
52 | 50 |
53 protected: | 51 protected: |
54 // Constructor used by the accelerated implementation. | 52 // Constructor used by the accelerated implementation. |
55 BrowserCompositorOutputSurface( | 53 BrowserCompositorOutputSurface( |
56 scoped_refptr<cc::ContextProvider> context, | 54 scoped_refptr<cc::ContextProvider> context, |
57 scoped_refptr<ui::CompositorVSyncManager> vsync_manager, | 55 const UpdateVSyncParametersCallback& update_vsync_parameters_callback, |
58 cc::SyntheticBeginFrameSource* begin_frame_source, | |
59 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> | 56 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> |
60 overlay_candidate_validator); | 57 overlay_candidate_validator); |
61 | 58 |
62 // Constructor used by the software implementation. | 59 // Constructor used by the software implementation. |
63 BrowserCompositorOutputSurface( | 60 BrowserCompositorOutputSurface( |
64 std::unique_ptr<cc::SoftwareOutputDevice> software_device, | 61 std::unique_ptr<cc::SoftwareOutputDevice> software_device, |
65 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager, | 62 const UpdateVSyncParametersCallback& update_vsync_parameters_callback); |
66 cc::SyntheticBeginFrameSource* begin_frame_source); | |
67 | 63 |
68 // Constructor used by the Vulkan implementation. | 64 // Constructor used by the Vulkan implementation. |
69 BrowserCompositorOutputSurface( | 65 BrowserCompositorOutputSurface( |
70 const scoped_refptr<cc::VulkanContextProvider>& vulkan_context_provider, | 66 const scoped_refptr<cc::VulkanContextProvider>& vulkan_context_provider, |
71 const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager, | 67 const UpdateVSyncParametersCallback& update_vsync_parameters_callback); |
72 cc::SyntheticBeginFrameSource* begin_frame_source); | |
73 | 68 |
74 scoped_refptr<ui::CompositorVSyncManager> vsync_manager_; | 69 const UpdateVSyncParametersCallback update_vsync_parameters_callback_; |
75 cc::SyntheticBeginFrameSource* synthetic_begin_frame_source_; | |
76 ReflectorImpl* reflector_; | 70 ReflectorImpl* reflector_; |
77 | 71 |
78 private: | 72 private: |
79 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> | 73 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> |
80 overlay_candidate_validator_; | 74 overlay_candidate_validator_; |
81 | 75 |
82 DISALLOW_COPY_AND_ASSIGN(BrowserCompositorOutputSurface); | 76 DISALLOW_COPY_AND_ASSIGN(BrowserCompositorOutputSurface); |
83 }; | 77 }; |
84 | 78 |
85 } // namespace content | 79 } // namespace content |
86 | 80 |
87 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ | 81 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ |
OLD | NEW |