| 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" | |
| 15 #include "ui/gfx/swap_result.h" | 14 #include "ui/gfx/swap_result.h" |
| 16 | 15 |
| 17 namespace display_compositor { | 16 namespace display_compositor { |
| 18 class CompositorOverlayCandidateValidator; | 17 class CompositorOverlayCandidateValidator; |
| 19 } | 18 } |
| 20 | 19 |
| 21 namespace gpu { | 20 namespace gpu { |
| 22 class CommandBufferProxyImpl; | 21 class CommandBufferProxyImpl; |
| 23 struct GpuProcessHostedCALayerTreeParamsMac; | 22 struct GpuProcessHostedCALayerTreeParamsMac; |
| 24 } | 23 } |
| 25 | 24 |
| 26 namespace ui { | 25 namespace ui { |
| 27 class ContextProviderCommandBuffer; | 26 class ContextProviderCommandBuffer; |
| 28 class LatencyInfo; | 27 class LatencyInfo; |
| 29 } | 28 } |
| 30 | 29 |
| 31 namespace content { | 30 namespace content { |
| 32 class ReflectorTexture; | 31 class ReflectorTexture; |
| 33 | 32 |
| 34 // Adapts a WebGraphicsContext3DCommandBufferImpl into a | 33 // Adapts a WebGraphicsContext3DCommandBufferImpl into a |
| 35 // cc::OutputSurface that also handles vsync parameter updates | 34 // cc::OutputSurface that also handles vsync parameter updates |
| 36 // arriving from the GPU process. | 35 // arriving from the GPU process. |
| 37 class GpuBrowserCompositorOutputSurface : public BrowserCompositorOutputSurface, | 36 class GpuBrowserCompositorOutputSurface |
| 38 public GpuVSyncControl { | 37 : public BrowserCompositorOutputSurface { |
| 39 public: | 38 public: |
| 40 GpuBrowserCompositorOutputSurface( | 39 GpuBrowserCompositorOutputSurface( |
| 41 scoped_refptr<ui::ContextProviderCommandBuffer> context, | 40 scoped_refptr<ui::ContextProviderCommandBuffer> context, |
| 42 const UpdateVSyncParametersCallback& update_vsync_parameters_callback, | 41 const UpdateVSyncParametersCallback& update_vsync_parameters_callback, |
| 43 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> | 42 std::unique_ptr<display_compositor::CompositorOverlayCandidateValidator> |
| 44 overlay_candidate_validator); | 43 overlay_candidate_validator); |
| 45 | 44 |
| 46 ~GpuBrowserCompositorOutputSurface() override; | 45 ~GpuBrowserCompositorOutputSurface() override; |
| 47 | 46 |
| 48 // Called when a swap completion is sent from the GPU process. | 47 // Called when a swap completion is sent from the GPU process. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 71 const gfx::ColorSpace& color_space, | 70 const gfx::ColorSpace& color_space, |
| 72 bool has_alpha, | 71 bool has_alpha, |
| 73 bool use_stencil) override; | 72 bool use_stencil) override; |
| 74 void SwapBuffers(cc::OutputSurfaceFrame frame) override; | 73 void SwapBuffers(cc::OutputSurfaceFrame frame) override; |
| 75 uint32_t GetFramebufferCopyTextureFormat() override; | 74 uint32_t GetFramebufferCopyTextureFormat() override; |
| 76 bool IsDisplayedAsOverlayPlane() const override; | 75 bool IsDisplayedAsOverlayPlane() const override; |
| 77 unsigned GetOverlayTextureId() const override; | 76 unsigned GetOverlayTextureId() const override; |
| 78 bool SurfaceIsSuspendForRecycle() const override; | 77 bool SurfaceIsSuspendForRecycle() const override; |
| 79 void SetDrawRectangle(const gfx::Rect& rect) override; | 78 void SetDrawRectangle(const gfx::Rect& rect) override; |
| 80 | 79 |
| 81 // GpuVSyncControl implementation. | |
| 82 void SetNeedsVSync(bool needs_vsync) override; | |
| 83 | |
| 84 protected: | 80 protected: |
| 85 gpu::CommandBufferProxyImpl* GetCommandBufferProxy(); | 81 gpu::CommandBufferProxyImpl* GetCommandBufferProxy(); |
| 86 | 82 |
| 87 cc::OutputSurfaceClient* client_ = nullptr; | 83 cc::OutputSurfaceClient* client_ = nullptr; |
| 88 std::unique_ptr<ReflectorTexture> reflector_texture_; | 84 std::unique_ptr<ReflectorTexture> reflector_texture_; |
| 89 bool set_draw_rectangle_for_frame_ = false; | 85 bool set_draw_rectangle_for_frame_ = false; |
| 90 // True if the draw rectangle has been set at all since the last resize. | 86 // True if the draw rectangle has been set at all since the last resize. |
| 91 bool has_set_draw_rectangle_since_last_resize_ = false; | 87 bool has_set_draw_rectangle_since_last_resize_ = false; |
| 92 gfx::Size size_; | 88 gfx::Size size_; |
| 93 base::WeakPtrFactory<GpuBrowserCompositorOutputSurface> weak_ptr_factory_; | 89 base::WeakPtrFactory<GpuBrowserCompositorOutputSurface> weak_ptr_factory_; |
| 94 | 90 |
| 95 private: | 91 private: |
| 96 DISALLOW_COPY_AND_ASSIGN(GpuBrowserCompositorOutputSurface); | 92 DISALLOW_COPY_AND_ASSIGN(GpuBrowserCompositorOutputSurface); |
| 97 }; | 93 }; |
| 98 | 94 |
| 99 } // namespace content | 95 } // namespace content |
| 100 | 96 |
| 101 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ | 97 #endif // CONTENT_BROWSER_COMPOSITOR_GPU_BROWSER_COMPOSITOR_OUTPUT_SURFACE_H_ |
| OLD | NEW |