| OLD | NEW |
| 1 // Copyright 2016 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_OUTPUT_SURFACE_MAC_H_ | 5 #ifndef CONTENT_BROWSER_COMPOSITOR_GPU_OUTPUT_SURFACE_MAC_H_ |
| 6 #define CONTENT_BROWSER_COMPOSITOR_GPU_OUTPUT_SURFACE_MAC_H_ | 6 #define CONTENT_BROWSER_COMPOSITOR_GPU_OUTPUT_SURFACE_MAC_H_ |
| 7 | 7 |
| 8 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s
urface.h" | 8 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s
urface.h" |
| 9 | 9 |
| 10 namespace ui { |
| 11 class CALayerTreeCoordinator; |
| 12 } |
| 13 |
| 10 namespace content { | 14 namespace content { |
| 11 | 15 |
| 12 class GpuOutputSurfaceMac | 16 class GpuOutputSurfaceMac |
| 13 : public GpuSurfacelessBrowserCompositorOutputSurface { | 17 : public GpuSurfacelessBrowserCompositorOutputSurface { |
| 14 public: | 18 public: |
| 15 GpuOutputSurfaceMac( | 19 GpuOutputSurfaceMac( |
| 16 scoped_refptr<ContextProviderCommandBuffer> context, | 20 scoped_refptr<ContextProviderCommandBuffer> context, |
| 17 gpu::SurfaceHandle surface_handle, | 21 gpu::SurfaceHandle surface_handle, |
| 18 scoped_refptr<ui::CompositorVSyncManager> vsync_manager, | 22 scoped_refptr<ui::CompositorVSyncManager> vsync_manager, |
| 19 base::SingleThreadTaskRunner* task_runner, | 23 base::SingleThreadTaskRunner* task_runner, |
| 20 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> | 24 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> |
| 21 overlay_candidate_validator, | 25 overlay_candidate_validator, |
| 22 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager); | 26 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager); |
| 23 ~GpuOutputSurfaceMac() override; | 27 ~GpuOutputSurfaceMac() override; |
| 24 | 28 |
| 25 // cc::OutputSurface implementation. | 29 // cc::OutputSurface implementation. |
| 30 void Reshape(const gfx::Size& size, float scale_factor, bool alpha) override; |
| 26 void SwapBuffers(cc::CompositorFrame* frame) override; | 31 void SwapBuffers(cc::CompositorFrame* frame) override; |
| 27 bool SurfaceIsSuspendForRecycle() const override; | 32 bool SurfaceIsSuspendForRecycle() const override; |
| 33 void ProcessCALayers(const cc::CALayerOverlayList& ca_layer_overlays) override
; |
| 28 | 34 |
| 29 // BrowserCompositorOutputSurface implementation. | 35 // BrowserCompositorOutputSurface implementation. |
| 30 void OnGpuSwapBuffersCompleted( | 36 void OnGpuSwapBuffersCompleted( |
| 31 const std::vector<ui::LatencyInfo>& latency_info, | 37 const std::vector<ui::LatencyInfo>& latency_info, |
| 32 gfx::SwapResult result, | 38 gfx::SwapResult result, |
| 33 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) override; | 39 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) override; |
| 34 void SetSurfaceSuspendedForRecycle(bool suspended) override; | 40 void SetSurfaceSuspendedForRecycle(bool suspended) override; |
| 35 | 41 |
| 36 private: | 42 private: |
| 37 // Store remote layers in a separate structure, so that non-Objective-C files | 43 // Store remote layers in a separate structure, so that non-Objective-C files |
| 38 // may include this header. | 44 // may include this header. |
| 39 struct RemoteLayers; | 45 struct RemoteLayers; |
| 40 std::unique_ptr<RemoteLayers> remote_layers_; | 46 std::unique_ptr<RemoteLayers> remote_layers_; |
| 41 | 47 |
| 48 std::unique_ptr<ui::CALayerTreeCoordinator> ca_layer_tree_coordinator_; |
| 49 |
| 42 enum ShouldShowFramesState { | 50 enum ShouldShowFramesState { |
| 43 // Frames that come from the GPU process should appear on-screen. | 51 // Frames that come from the GPU process should appear on-screen. |
| 44 SHOULD_SHOW_FRAMES, | 52 SHOULD_SHOW_FRAMES, |
| 45 // The compositor has been suspended. Any frames that come from the GPU | 53 // The compositor has been suspended. Any frames that come from the GPU |
| 46 // process are for the pre-suspend content and should not be displayed. | 54 // process are for the pre-suspend content and should not be displayed. |
| 47 SHOULD_NOT_SHOW_FRAMES_SUSPENDED, | 55 SHOULD_NOT_SHOW_FRAMES_SUSPENDED, |
| 48 // The compositor has been un-suspended, but has not yet issued a swap | 56 // The compositor has been un-suspended, but has not yet issued a swap |
| 49 // since being un-suspended, so any frames that come from the GPU process | 57 // since being un-suspended, so any frames that come from the GPU process |
| 50 // are for pre-suspend content and should not be displayed. | 58 // are for pre-suspend content and should not be displayed. |
| 51 SHOULD_NOT_SHOW_FRAMES_NO_SWAP_AFTER_SUSPENDED, | 59 SHOULD_NOT_SHOW_FRAMES_NO_SWAP_AFTER_SUSPENDED, |
| 52 }; | 60 }; |
| 53 ShouldShowFramesState should_show_frames_state_ = SHOULD_SHOW_FRAMES; | 61 ShouldShowFramesState should_show_frames_state_ = SHOULD_SHOW_FRAMES; |
| 54 | 62 |
| 55 DISALLOW_COPY_AND_ASSIGN(GpuOutputSurfaceMac); | 63 DISALLOW_COPY_AND_ASSIGN(GpuOutputSurfaceMac); |
| 56 }; | 64 }; |
| 57 | 65 |
| 58 } // namespace content | 66 } // namespace content |
| 59 | 67 |
| 60 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_OUTPUT_SURFACE_MAC_H_ | 68 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_OUTPUT_SURFACE_MAC_H_ |
| OLD | NEW |