| 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 gpu::CommandBufferProxyImpl* GetCommandBufferProxy(); | 67 gpu::CommandBufferProxyImpl* GetCommandBufferProxy(); |
| 61 | 68 |
| 69 // mus::WindowSurfaceClient: |
| 70 void OnResourcesReturned( |
| 71 mus::WindowSurface* surface, |
| 72 mojo::Array<cc::ReturnedResource> resources) override; |
| 73 |
| 62 base::CancelableCallback<void( | 74 base::CancelableCallback<void( |
| 63 const std::vector<ui::LatencyInfo>&, | 75 const std::vector<ui::LatencyInfo>&, |
| 64 gfx::SwapResult, | 76 gfx::SwapResult, |
| 65 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac)> | 77 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac)> |
| 66 swap_buffers_completion_callback_; | 78 swap_buffers_completion_callback_; |
| 67 base::CancelableCallback<void(base::TimeTicks timebase, | 79 base::CancelableCallback<void(base::TimeTicks timebase, |
| 68 base::TimeDelta interval)> | 80 base::TimeDelta interval)> |
| 69 update_vsync_parameters_callback_; | 81 update_vsync_parameters_callback_; |
| 70 | 82 |
| 71 std::unique_ptr<ReflectorTexture> reflector_texture_; | 83 std::unique_ptr<ReflectorTexture> reflector_texture_; |
| 72 | 84 |
| 73 DISALLOW_COPY_AND_ASSIGN(GpuBrowserCompositorOutputSurface); | 85 std::unique_ptr<mus::WindowSurface> mus_window_surface_; |
| 86 |
| 87 DISALLOW_COPY_AND_ASSIGN(MusBrowserCompositorOutputSurface); |
| 74 }; | 88 }; |
| 75 | 89 |
| 76 } // namespace content | 90 } // namespace content |
| 77 | 91 |
| 78 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ | 92 #endif // CONTENT_BROWSER_COMPOSITOR_MUS_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ |
| OLD | NEW |