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 SwapBuffers(cc::OutputSurfaceFrame frame) override; | 67 void SwapBuffers(cc::OutputSurfaceFrame frame) override; |
63 uint32_t GetFramebufferCopyTextureFormat() override; | 68 uint32_t GetFramebufferCopyTextureFormat() override; |
64 bool IsDisplayedAsOverlayPlane() const override; | 69 bool IsDisplayedAsOverlayPlane() const override; |
65 unsigned GetOverlayTextureId() const override; | 70 unsigned GetOverlayTextureId() const override; |
66 bool SurfaceIsSuspendForRecycle() const override; | 71 bool SurfaceIsSuspendForRecycle() const override; |
67 | 72 |
| 73 protected: |
68 gpu::CommandBufferProxyImpl* GetCommandBufferProxy(); | 74 gpu::CommandBufferProxyImpl* GetCommandBufferProxy(); |
69 | 75 |
70 base::CancelableCallback<void( | |
71 const std::vector<ui::LatencyInfo>&, | |
72 gfx::SwapResult, | |
73 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac)> | |
74 swap_buffers_completion_callback_; | |
75 base::CancelableCallback<void(base::TimeTicks timebase, | |
76 base::TimeDelta interval)> | |
77 update_vsync_parameters_callback_; | |
78 | |
79 std::unique_ptr<ReflectorTexture> reflector_texture_; | 76 std::unique_ptr<ReflectorTexture> reflector_texture_; |
| 77 base::WeakPtrFactory<GpuBrowserCompositorOutputSurface> weak_ptr_factory_; |
80 | 78 |
81 private: | 79 private: |
82 DISALLOW_COPY_AND_ASSIGN(GpuBrowserCompositorOutputSurface); | 80 DISALLOW_COPY_AND_ASSIGN(GpuBrowserCompositorOutputSurface); |
83 }; | 81 }; |
84 | 82 |
85 } // namespace content | 83 } // namespace content |
86 | 84 |
87 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ | 85 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ |
OLD | NEW |