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_GPU_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ | 5 #ifndef CONTENT_BROWSER_COMPOSITOR_GPU_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ |
6 #define CONTENT_BROWSER_COMPOSITOR_GPU_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ | 6 #define CONTENT_BROWSER_COMPOSITOR_GPU_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/cancelable_callback.h" | |
11 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
13 #include "content/browser/compositor/browser_compositor_output_surface.h" | 13 #include "content/browser/compositor/browser_compositor_output_surface.h" |
14 #include "ui/gfx/swap_result.h" | 14 #include "ui/gfx/swap_result.h" |
15 | 15 |
16 namespace display_compositor { | 16 namespace display_compositor { |
17 class CompositorOverlayCandidateValidator; | 17 class CompositorOverlayCandidateValidator; |
18 } | 18 } |
19 | 19 |
20 namespace gpu { | 20 namespace gpu { |
21 class CommandBufferProxyImpl; | 21 class CommandBufferProxyImpl; |
(...skipping 14 matching lines...) Expand all Loading... |
36 public: | 36 public: |
37 GpuBrowserCompositorOutputSurface( | 37 GpuBrowserCompositorOutputSurface( |
38 scoped_refptr<ContextProviderCommandBuffer> context, | 38 scoped_refptr<ContextProviderCommandBuffer> context, |
39 scoped_refptr<ui::CompositorVSyncManager> vsync_manager, | 39 scoped_refptr<ui::CompositorVSyncManager> vsync_manager, |
40 cc::SyntheticBeginFrameSource* begin_frame_source, | 40 cc::SyntheticBeginFrameSource* begin_frame_source, |
41 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> | 41 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> |
42 overlay_candidate_validator); | 42 overlay_candidate_validator); |
43 | 43 |
44 ~GpuBrowserCompositorOutputSurface() override; | 44 ~GpuBrowserCompositorOutputSurface() override; |
45 | 45 |
46 protected: | 46 // Called when a swap completion is sent from the GPU process. |
47 // BrowserCompositorOutputSurface: | 47 // The argument |params_mac| is used to communicate parameters needed on Mac |
48 void OnReflectorChanged() override; | 48 // to display the CALayer for the swap in the browser process. |
49 void OnGpuSwapBuffersCompleted( | 49 // TODO(ccameron): Remove |params_mac| when the CALayer tree is hosted in the |
| 50 // browser process. |
| 51 virtual void OnGpuSwapBuffersCompleted( |
50 const std::vector<ui::LatencyInfo>& latency_info, | 52 const std::vector<ui::LatencyInfo>& latency_info, |
51 gfx::SwapResult result, | 53 gfx::SwapResult result, |
52 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) override; | 54 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac); |
| 55 |
| 56 // BrowserCompositorOutputSurface implementation. |
| 57 void OnReflectorChanged() override; |
53 #if defined(OS_MACOSX) | 58 #if defined(OS_MACOSX) |
54 void SetSurfaceSuspendedForRecycle(bool suspended) override; | 59 void SetSurfaceSuspendedForRecycle(bool suspended) override; |
55 #endif | 60 #endif |
56 | 61 |
57 // cc::OutputSurface implementation. | 62 // cc::OutputSurface implementation. |
58 bool BindToClient(cc::OutputSurfaceClient* client) override; | 63 bool BindToClient(cc::OutputSurfaceClient* client) override; |
59 void EnsureBackbuffer() override; | 64 void EnsureBackbuffer() override; |
60 void DiscardBackbuffer() override; | 65 void DiscardBackbuffer() override; |
61 void BindFramebuffer() override; | 66 void BindFramebuffer() override; |
62 void Reshape(const gfx::Size& size, | 67 void Reshape(const gfx::Size& size, |
63 float device_scale_factor, | 68 float device_scale_factor, |
64 const gfx::ColorSpace& color_space, | 69 const gfx::ColorSpace& color_space, |
65 bool has_alpha) override; | 70 bool has_alpha) override; |
66 void SwapBuffers(cc::OutputSurfaceFrame frame) override; | 71 void SwapBuffers(cc::OutputSurfaceFrame frame) override; |
67 uint32_t GetFramebufferCopyTextureFormat() override; | 72 uint32_t GetFramebufferCopyTextureFormat() override; |
68 bool IsDisplayedAsOverlayPlane() const override; | 73 bool IsDisplayedAsOverlayPlane() const override; |
69 unsigned GetOverlayTextureId() const override; | 74 unsigned GetOverlayTextureId() const override; |
70 bool SurfaceIsSuspendForRecycle() const override; | 75 bool SurfaceIsSuspendForRecycle() const override; |
71 | 76 |
| 77 protected: |
72 gpu::CommandBufferProxyImpl* GetCommandBufferProxy(); | 78 gpu::CommandBufferProxyImpl* GetCommandBufferProxy(); |
73 | 79 |
74 base::CancelableCallback<void( | |
75 const std::vector<ui::LatencyInfo>&, | |
76 gfx::SwapResult, | |
77 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac)> | |
78 swap_buffers_completion_callback_; | |
79 base::CancelableCallback<void(base::TimeTicks timebase, | |
80 base::TimeDelta interval)> | |
81 update_vsync_parameters_callback_; | |
82 | |
83 std::unique_ptr<ReflectorTexture> reflector_texture_; | 80 std::unique_ptr<ReflectorTexture> reflector_texture_; |
| 81 base::WeakPtrFactory<GpuBrowserCompositorOutputSurface> weak_ptr_factory_; |
84 | 82 |
85 private: | 83 private: |
86 DISALLOW_COPY_AND_ASSIGN(GpuBrowserCompositorOutputSurface); | 84 DISALLOW_COPY_AND_ASSIGN(GpuBrowserCompositorOutputSurface); |
87 }; | 85 }; |
88 | 86 |
89 } // namespace content | 87 } // namespace content |
90 | 88 |
91 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ | 89 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ |
OLD | NEW |