| 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 SERVICES_UI_SURFACES_DIRECT_OUTPUT_SURFACE_H_ | 5 #ifndef SERVICES_UI_SURFACES_DISPLAY_OUTPUT_SURFACE_H_ |
| 6 #define SERVICES_UI_SURFACES_DIRECT_OUTPUT_SURFACE_H_ | 6 #define SERVICES_UI_SURFACES_DISPLAY_OUTPUT_SURFACE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "cc/output/in_process_context_provider.h" | 10 #include "cc/output/in_process_context_provider.h" |
| 11 #include "cc/output/output_surface.h" | 11 #include "cc/output/output_surface.h" |
| 12 | 12 |
| 13 namespace cc { | 13 namespace cc { |
| 14 class CompositorFrame; | |
| 15 class SyntheticBeginFrameSource; | 14 class SyntheticBeginFrameSource; |
| 16 } | 15 } |
| 17 | 16 |
| 18 namespace ui { | 17 namespace ui { |
| 19 | 18 |
| 20 // An OutputSurface implementation that directly draws and | 19 // An OutputSurface implementation that directly draws and |
| 21 // swaps to an actual GL surface. | 20 // swaps to an actual GL surface. |
| 22 class DirectOutputSurface : public cc::OutputSurface { | 21 class DisplayOutputSurface : public cc::OutputSurface { |
| 23 public: | 22 public: |
| 24 DirectOutputSurface( | 23 DisplayOutputSurface( |
| 25 scoped_refptr<cc::InProcessContextProvider> context_provider, | 24 scoped_refptr<cc::InProcessContextProvider> context_provider, |
| 26 cc::SyntheticBeginFrameSource* synthetic_begin_frame_source); | 25 cc::SyntheticBeginFrameSource* synthetic_begin_frame_source); |
| 27 ~DirectOutputSurface() override; | 26 ~DisplayOutputSurface() override; |
| 28 | 27 |
| 29 // cc::OutputSurface implementation | 28 // cc::OutputSurface implementation |
| 30 void BindToClient(cc::OutputSurfaceClient* client) override; | 29 void BindToClient(cc::OutputSurfaceClient* client) override; |
| 31 void EnsureBackbuffer() override; | 30 void EnsureBackbuffer() override; |
| 32 void DiscardBackbuffer() override; | 31 void DiscardBackbuffer() override; |
| 33 void BindFramebuffer() override; | 32 void BindFramebuffer() override; |
| 34 void Reshape(const gfx::Size& size, | 33 void Reshape(const gfx::Size& size, |
| 35 float device_scale_factor, | 34 float device_scale_factor, |
| 36 const gfx::ColorSpace& color_space, | 35 const gfx::ColorSpace& color_space, |
| 37 bool has_alpha) override; | 36 bool has_alpha) override; |
| 38 void SwapBuffers(cc::OutputSurfaceFrame frame) override; | 37 void SwapBuffers(cc::OutputSurfaceFrame frame) override; |
| 39 uint32_t GetFramebufferCopyTextureFormat() override; | 38 uint32_t GetFramebufferCopyTextureFormat() override; |
| 40 cc::OverlayCandidateValidator* GetOverlayCandidateValidator() const override; | 39 cc::OverlayCandidateValidator* GetOverlayCandidateValidator() const override; |
| 41 bool IsDisplayedAsOverlayPlane() const override; | 40 bool IsDisplayedAsOverlayPlane() const override; |
| 42 unsigned GetOverlayTextureId() const override; | 41 unsigned GetOverlayTextureId() const override; |
| 43 bool SurfaceIsSuspendForRecycle() const override; | 42 bool SurfaceIsSuspendForRecycle() const override; |
| 44 bool HasExternalStencilTest() const override; | 43 bool HasExternalStencilTest() const override; |
| 45 void ApplyExternalStencil() override; | 44 void ApplyExternalStencil() override; |
| 46 | 45 |
| 47 | |
| 48 private: | 46 private: |
| 49 // Called when a swap completion is signaled from ImageTransportSurface. | 47 // Called when a swap completion is signaled from ImageTransportSurface. |
| 50 void OnGpuSwapBuffersCompleted( | 48 void OnGpuSwapBuffersCompleted( |
| 51 const std::vector<ui::LatencyInfo>& latency_info, | 49 const std::vector<ui::LatencyInfo>& latency_info, |
| 52 gfx::SwapResult result, | 50 gfx::SwapResult result, |
| 53 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac); | 51 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac); |
| 54 void OnVSyncParametersUpdated(base::TimeTicks timebase, | 52 void OnVSyncParametersUpdated(base::TimeTicks timebase, |
| 55 base::TimeDelta interval); | 53 base::TimeDelta interval); |
| 56 | 54 |
| 57 cc::OutputSurfaceClient* client_ = nullptr; | 55 cc::OutputSurfaceClient* client_ = nullptr; |
| 58 cc::SyntheticBeginFrameSource* const synthetic_begin_frame_source_; | 56 cc::SyntheticBeginFrameSource* const synthetic_begin_frame_source_; |
| 59 | 57 |
| 60 base::WeakPtrFactory<DirectOutputSurface> weak_ptr_factory_; | 58 base::WeakPtrFactory<DisplayOutputSurface> weak_ptr_factory_; |
| 61 }; | 59 }; |
| 62 | 60 |
| 63 } // namespace ui | 61 } // namespace ui |
| 64 | 62 |
| 65 #endif // SERVICES_UI_SURFACES_DIRECT_OUTPUT_SURFACE_H_ | 63 #endif // SERVICES_UI_SURFACES_DISPLAY_OUTPUT_SURFACE_H_ |
| OLD | NEW |