| 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_DIRECT_OUTPUT_SURFACE_H_ |
| 6 #define SERVICES_UI_SURFACES_DIRECT_OUTPUT_SURFACE_H_ | 6 #define SERVICES_UI_SURFACES_DIRECT_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/output_surface.h" | 11 #include "cc/output/output_surface.h" |
| 11 #include "services/ui/surfaces/surfaces_context_provider.h" | |
| 12 #include "services/ui/surfaces/surfaces_context_provider_delegate.h" | |
| 13 | 12 |
| 14 namespace cc { | 13 namespace cc { |
| 15 class CompositorFrame; | 14 class CompositorFrame; |
| 16 class SyntheticBeginFrameSource; | 15 class SyntheticBeginFrameSource; |
| 17 } | 16 } |
| 18 | 17 |
| 19 namespace ui { | 18 namespace ui { |
| 20 | 19 |
| 21 // An OutputSurface implementation that directly draws and | 20 // An OutputSurface implementation that directly draws and |
| 22 // swaps to an actual GL surface. | 21 // swaps to an actual GL surface. |
| 23 class DirectOutputSurface : public cc::OutputSurface, | 22 class DirectOutputSurface : public cc::OutputSurface { |
| 24 public SurfacesContextProviderDelegate { | |
| 25 public: | 23 public: |
| 26 DirectOutputSurface( | 24 DirectOutputSurface( |
| 27 scoped_refptr<SurfacesContextProvider> context_provider, | 25 scoped_refptr<cc::InProcessContextProvider> context_provider, |
| 28 cc::SyntheticBeginFrameSource* synthetic_begin_frame_source); | 26 cc::SyntheticBeginFrameSource* synthetic_begin_frame_source); |
| 29 ~DirectOutputSurface() override; | 27 ~DirectOutputSurface() override; |
| 30 | 28 |
| 31 // cc::OutputSurface implementation | 29 // cc::OutputSurface implementation |
| 32 void BindToClient(cc::OutputSurfaceClient* client) override; | 30 void BindToClient(cc::OutputSurfaceClient* client) override; |
| 33 void EnsureBackbuffer() override; | 31 void EnsureBackbuffer() override; |
| 34 void DiscardBackbuffer() override; | 32 void DiscardBackbuffer() override; |
| 35 void BindFramebuffer() override; | 33 void BindFramebuffer() override; |
| 36 void Reshape(const gfx::Size& size, | 34 void Reshape(const gfx::Size& size, |
| 37 float device_scale_factor, | 35 float device_scale_factor, |
| 38 const gfx::ColorSpace& color_space, | 36 const gfx::ColorSpace& color_space, |
| 39 bool has_alpha) override; | 37 bool has_alpha) override; |
| 40 void SwapBuffers(cc::OutputSurfaceFrame frame) override; | 38 void SwapBuffers(cc::OutputSurfaceFrame frame) override; |
| 41 uint32_t GetFramebufferCopyTextureFormat() override; | 39 uint32_t GetFramebufferCopyTextureFormat() override; |
| 42 cc::OverlayCandidateValidator* GetOverlayCandidateValidator() const override; | 40 cc::OverlayCandidateValidator* GetOverlayCandidateValidator() const override; |
| 43 bool IsDisplayedAsOverlayPlane() const override; | 41 bool IsDisplayedAsOverlayPlane() const override; |
| 44 unsigned GetOverlayTextureId() const override; | 42 unsigned GetOverlayTextureId() const override; |
| 45 bool SurfaceIsSuspendForRecycle() const override; | 43 bool SurfaceIsSuspendForRecycle() const override; |
| 46 bool HasExternalStencilTest() const override; | 44 bool HasExternalStencilTest() const override; |
| 47 void ApplyExternalStencil() override; | 45 void ApplyExternalStencil() override; |
| 48 | 46 |
| 49 // SurfacesContextProviderDelegate implementation | |
| 50 void OnVSyncParametersUpdated(const base::TimeTicks& timebase, | |
| 51 const base::TimeDelta& interval) override; | |
| 52 | 47 |
| 53 private: | 48 private: |
| 54 void OnSwapBuffersComplete(); | 49 void OnSwapBuffersComplete(); |
| 50 void OnVSyncParametersUpdated(const base::TimeTicks& timebase, |
| 51 const base::TimeDelta& interval); |
| 55 | 52 |
| 56 cc::OutputSurfaceClient* client_ = nullptr; | 53 cc::OutputSurfaceClient* client_ = nullptr; |
| 57 cc::SyntheticBeginFrameSource* const synthetic_begin_frame_source_; | 54 cc::SyntheticBeginFrameSource* const synthetic_begin_frame_source_; |
| 58 base::WeakPtrFactory<DirectOutputSurface> weak_ptr_factory_; | 55 base::WeakPtrFactory<DirectOutputSurface> weak_ptr_factory_; |
| 59 }; | 56 }; |
| 60 | 57 |
| 61 } // namespace ui | 58 } // namespace ui |
| 62 | 59 |
| 63 #endif // SERVICES_UI_SURFACES_DIRECT_OUTPUT_SURFACE_H_ | 60 #endif // SERVICES_UI_SURFACES_DIRECT_OUTPUT_SURFACE_H_ |
| OLD | NEW |