Chromium Code Reviews| 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/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.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 "content/browser/compositor/gpu_vsync_begin_frame_source.h" | |
| 14 #include "ui/gfx/swap_result.h" | 15 #include "ui/gfx/swap_result.h" |
| 15 | 16 |
| 16 namespace display_compositor { | 17 namespace display_compositor { |
| 17 class CompositorOverlayCandidateValidator; | 18 class CompositorOverlayCandidateValidator; |
| 18 } | 19 } |
| 19 | 20 |
| 20 namespace gpu { | 21 namespace gpu { |
| 21 class CommandBufferProxyImpl; | 22 class CommandBufferProxyImpl; |
| 22 struct GpuProcessHostedCALayerTreeParamsMac; | 23 struct GpuProcessHostedCALayerTreeParamsMac; |
| 23 } | 24 } |
| 24 | 25 |
| 25 namespace ui { | 26 namespace ui { |
| 26 class ContextProviderCommandBuffer; | 27 class ContextProviderCommandBuffer; |
| 27 class LatencyInfo; | 28 class LatencyInfo; |
| 28 } | 29 } |
| 29 | 30 |
| 30 namespace content { | 31 namespace content { |
| 31 class ReflectorTexture; | 32 class ReflectorTexture; |
| 32 | 33 |
| 33 // Adapts a WebGraphicsContext3DCommandBufferImpl into a | 34 // Adapts a WebGraphicsContext3DCommandBufferImpl into a |
| 34 // cc::OutputSurface that also handles vsync parameter updates | 35 // cc::OutputSurface that also handles vsync parameter updates |
| 35 // arriving from the GPU process. | 36 // arriving from the GPU process. |
| 36 class GpuBrowserCompositorOutputSurface | 37 class GpuBrowserCompositorOutputSurface : public BrowserCompositorOutputSurface, |
| 37 : public BrowserCompositorOutputSurface { | 38 public GpuVSyncControl { |
| 38 public: | 39 public: |
| 39 GpuBrowserCompositorOutputSurface( | 40 GpuBrowserCompositorOutputSurface( |
| 40 scoped_refptr<ui::ContextProviderCommandBuffer> context, | 41 scoped_refptr<ui::ContextProviderCommandBuffer> context, |
| 41 const UpdateVSyncParametersCallback& update_vsync_parameters_callback, | 42 const UpdateVSyncParametersCallback& update_vsync_parameters_callback, |
| 42 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> | 43 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> |
| 43 overlay_candidate_validator); | 44 overlay_candidate_validator); |
| 44 | 45 |
| 45 ~GpuBrowserCompositorOutputSurface() override; | 46 ~GpuBrowserCompositorOutputSurface() override; |
| 46 | 47 |
| 47 // Called when a swap completion is sent from the GPU process. | 48 // Called when a swap completion is sent from the GPU process. |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 68 void Reshape(const gfx::Size& size, | 69 void Reshape(const gfx::Size& size, |
| 69 float device_scale_factor, | 70 float device_scale_factor, |
| 70 const gfx::ColorSpace& color_space, | 71 const gfx::ColorSpace& color_space, |
| 71 bool has_alpha) override; | 72 bool has_alpha) override; |
| 72 void SwapBuffers(cc::OutputSurfaceFrame frame) override; | 73 void SwapBuffers(cc::OutputSurfaceFrame frame) override; |
| 73 uint32_t GetFramebufferCopyTextureFormat() override; | 74 uint32_t GetFramebufferCopyTextureFormat() override; |
| 74 bool IsDisplayedAsOverlayPlane() const override; | 75 bool IsDisplayedAsOverlayPlane() const override; |
| 75 unsigned GetOverlayTextureId() const override; | 76 unsigned GetOverlayTextureId() const override; |
| 76 bool SurfaceIsSuspendForRecycle() const override; | 77 bool SurfaceIsSuspendForRecycle() const override; |
| 77 | 78 |
| 79 GpuVSyncControl* GetVSyncControl() override; | |
|
enne (OOO)
2017/01/13 21:14:11
I don't know that this really needs to be part of
stanisc
2017/01/14 00:32:20
This was my attempt to simplify the logic in the f
stanisc
2017/01/24 21:23:25
OK, I've removed this function.
| |
| 80 | |
| 81 // GpuVSyncControl | |
| 82 void EnableVSync(bool enabled) override; | |
|
enne (OOO)
2017/01/13 21:14:11
Similarly, EnableVSync doesn't need to be virtual
stanisc
2017/01/14 00:32:20
Well, I guess if GpuBrowserCompositorOutputSurface
stanisc
2017/01/24 21:23:25
I've kept this as virtual for now, mostly for the
| |
| 83 | |
| 78 protected: | 84 protected: |
| 79 gpu::CommandBufferProxyImpl* GetCommandBufferProxy(); | 85 gpu::CommandBufferProxyImpl* GetCommandBufferProxy(); |
| 80 | 86 |
| 81 cc::OutputSurfaceClient* client_ = nullptr; | 87 cc::OutputSurfaceClient* client_ = nullptr; |
| 82 std::unique_ptr<ReflectorTexture> reflector_texture_; | 88 std::unique_ptr<ReflectorTexture> reflector_texture_; |
| 83 base::WeakPtrFactory<GpuBrowserCompositorOutputSurface> weak_ptr_factory_; | 89 base::WeakPtrFactory<GpuBrowserCompositorOutputSurface> weak_ptr_factory_; |
| 84 | 90 |
| 85 private: | 91 private: |
| 86 DISALLOW_COPY_AND_ASSIGN(GpuBrowserCompositorOutputSurface); | 92 DISALLOW_COPY_AND_ASSIGN(GpuBrowserCompositorOutputSurface); |
| 87 }; | 93 }; |
| 88 | 94 |
| 89 } // namespace content | 95 } // namespace content |
| 90 | 96 |
| 91 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ | 97 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ |
| OLD | NEW |