OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_MUS_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ |
6 #define CONTENT_BROWSER_COMPOSITOR_GPU_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ | 6 #define CONTENT_BROWSER_COMPOSITOR_MUS_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/cancelable_callback.h" | 10 #include "base/cancelable_callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 #include "components/mus/public/cpp/window_surface_client.h" |
13 #include "content/browser/compositor/browser_compositor_output_surface.h" | 14 #include "content/browser/compositor/browser_compositor_output_surface.h" |
| 15 #include "gpu/ipc/common/surface_handle.h" |
14 #include "ui/gfx/swap_result.h" | 16 #include "ui/gfx/swap_result.h" |
15 | 17 |
16 namespace display_compositor { | 18 namespace display_compositor { |
17 class CompositorOverlayCandidateValidator; | 19 class CompositorOverlayCandidateValidator; |
18 } | 20 } |
19 | 21 |
20 namespace gpu { | 22 namespace gpu { |
21 class CommandBufferProxyImpl; | 23 class CommandBufferProxyImpl; |
22 } | 24 } |
23 | 25 |
| 26 namespace mus { |
| 27 class WindowSurface; |
| 28 } |
| 29 |
24 namespace ui { | 30 namespace ui { |
25 class CompositorVSyncManager; | 31 class CompositorVSyncManager; |
26 } | 32 } |
27 | 33 |
28 namespace content { | 34 namespace content { |
29 class ReflectorTexture; | 35 class ReflectorTexture; |
30 | 36 |
31 // Adapts a WebGraphicsContext3DCommandBufferImpl into a | 37 // Adapts a WebGraphicsContext3DCommandBufferImpl into a |
32 // cc::OutputSurface that also handles vsync parameter updates | 38 // cc::OutputSurface that also handles vsync parameter updates |
33 // arriving from the GPU process. | 39 // arriving from the GPU process. |
34 class GpuBrowserCompositorOutputSurface | 40 class MusBrowserCompositorOutputSurface : public BrowserCompositorOutputSurface, |
35 : public BrowserCompositorOutputSurface { | 41 public mus::WindowSurfaceClient { |
36 public: | 42 public: |
37 GpuBrowserCompositorOutputSurface( | 43 MusBrowserCompositorOutputSurface( |
| 44 gpu::SurfaceHandle surface_handle, |
38 scoped_refptr<ContextProviderCommandBuffer> context, | 45 scoped_refptr<ContextProviderCommandBuffer> context, |
39 scoped_refptr<ui::CompositorVSyncManager> vsync_manager, | 46 scoped_refptr<ui::CompositorVSyncManager> vsync_manager, |
40 cc::SyntheticBeginFrameSource* begin_frame_source, | 47 cc::SyntheticBeginFrameSource* begin_frame_source, |
41 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> | 48 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> |
42 overlay_candidate_validator); | 49 overlay_candidate_validator); |
43 | 50 |
44 ~GpuBrowserCompositorOutputSurface() override; | 51 ~MusBrowserCompositorOutputSurface() override; |
45 | 52 |
46 protected: | 53 protected: |
47 // BrowserCompositorOutputSurface: | 54 // BrowserCompositorOutputSurface: |
48 void OnReflectorChanged() override; | 55 void OnReflectorChanged() override; |
49 void OnGpuSwapBuffersCompleted( | 56 void OnGpuSwapBuffersCompleted( |
50 const std::vector<ui::LatencyInfo>& latency_info, | 57 const std::vector<ui::LatencyInfo>& latency_info, |
51 gfx::SwapResult result, | 58 gfx::SwapResult result, |
52 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) override; | 59 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) override; |
53 #if defined(OS_MACOSX) | 60 #if defined(OS_MACOSX) |
54 void SetSurfaceSuspendedForRecycle(bool suspended) override; | 61 void SetSurfaceSuspendedForRecycle(bool suspended) override; |
55 #endif | 62 #endif |
56 | 63 |
57 // cc::OutputSurface implementation. | 64 // cc::OutputSurface implementation. |
58 void SwapBuffers(cc::CompositorFrame frame) override; | 65 void SwapBuffers(cc::CompositorFrame frame) override; |
59 bool BindToClient(cc::OutputSurfaceClient* client) override; | 66 bool BindToClient(cc::OutputSurfaceClient* client) override; |
60 uint32_t GetFramebufferCopyTextureFormat() override; | 67 uint32_t GetFramebufferCopyTextureFormat() override; |
61 | 68 |
| 69 // mus::WindowSurfaceClient: |
| 70 void OnResourcesReturned( |
| 71 mus::WindowSurface* surface, |
| 72 mojo::Array<cc::ReturnedResource> resources) override; |
| 73 |
62 gpu::CommandBufferProxyImpl* GetCommandBufferProxy(); | 74 gpu::CommandBufferProxyImpl* GetCommandBufferProxy(); |
63 | 75 |
64 base::CancelableCallback<void( | 76 base::CancelableCallback<void( |
65 const std::vector<ui::LatencyInfo>&, | 77 const std::vector<ui::LatencyInfo>&, |
66 gfx::SwapResult, | 78 gfx::SwapResult, |
67 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac)> | 79 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac)> |
68 swap_buffers_completion_callback_; | 80 swap_buffers_completion_callback_; |
69 base::CancelableCallback<void(base::TimeTicks timebase, | 81 base::CancelableCallback<void(base::TimeTicks timebase, |
70 base::TimeDelta interval)> | 82 base::TimeDelta interval)> |
71 update_vsync_parameters_callback_; | 83 update_vsync_parameters_callback_; |
72 | 84 |
73 std::unique_ptr<ReflectorTexture> reflector_texture_; | 85 std::unique_ptr<ReflectorTexture> reflector_texture_; |
74 | 86 |
75 DISALLOW_COPY_AND_ASSIGN(GpuBrowserCompositorOutputSurface); | 87 std::unique_ptr<mus::WindowSurface> mus_window_surface_; |
| 88 |
| 89 DISALLOW_COPY_AND_ASSIGN(MusBrowserCompositorOutputSurface); |
76 }; | 90 }; |
77 | 91 |
78 } // namespace content | 92 } // namespace content |
79 | 93 |
80 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ | 94 #endif // CONTENT_BROWSER_COMPOSITOR_MUS_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ |
OLD | NEW |