| 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 COMPONENTS_MUS_SURFACES_DIRECT_OUTPUT_SURFACE_H_ | 5 #ifndef COMPONENTS_MUS_SURFACES_DIRECT_OUTPUT_SURFACE_H_ |
| 6 #define COMPONENTS_MUS_SURFACES_DIRECT_OUTPUT_SURFACE_H_ | 6 #define COMPONENTS_MUS_SURFACES_DIRECT_OUTPUT_SURFACE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "cc/output/output_surface.h" | 10 #include "cc/output/output_surface.h" |
| 11 #include "cc/scheduler/begin_frame_source.h" | |
| 12 #include "components/mus/surfaces/surfaces_context_provider.h" | 11 #include "components/mus/surfaces/surfaces_context_provider.h" |
| 13 #include "components/mus/surfaces/surfaces_context_provider_delegate.h" | 12 #include "components/mus/surfaces/surfaces_context_provider_delegate.h" |
| 14 | 13 |
| 14 namespace cc { |
| 15 class CompositorFrame; |
| 16 class SyntheticBeginFrameSource; |
| 17 } |
| 18 |
| 15 namespace mus { | 19 namespace mus { |
| 16 | 20 |
| 17 // An OutputSurface implementation that directly draws and | 21 // An OutputSurface implementation that directly draws and |
| 18 // swaps to an actual GL surface. | 22 // swaps to an actual GL surface. |
| 19 class DirectOutputSurface : public cc::OutputSurface, | 23 class DirectOutputSurface : public cc::OutputSurface, |
| 20 public SurfacesContextProviderDelegate { | 24 public SurfacesContextProviderDelegate { |
| 21 public: | 25 public: |
| 22 explicit DirectOutputSurface( | 26 explicit DirectOutputSurface( |
| 23 scoped_refptr<SurfacesContextProvider> context_provider, | 27 scoped_refptr<SurfacesContextProvider> context_provider, |
| 24 base::SingleThreadTaskRunner* task_runner); | 28 cc::SyntheticBeginFrameSource* synthetic_begin_frame_source); |
| 25 ~DirectOutputSurface() override; | 29 ~DirectOutputSurface() override; |
| 26 | 30 |
| 27 // cc::OutputSurface implementation | 31 // cc::OutputSurface implementation |
| 28 bool BindToClient(cc::OutputSurfaceClient* client) override; | 32 bool BindToClient(cc::OutputSurfaceClient* client) override; |
| 29 void SwapBuffers(cc::CompositorFrame* frame) override; | 33 void SwapBuffers(cc::CompositorFrame* frame) override; |
| 30 | 34 |
| 31 // SurfacesContextProviderDelegate implementation | 35 // SurfacesContextProviderDelegate implementation |
| 32 void OnVSyncParametersUpdated(const base::TimeTicks& timebase, | 36 void OnVSyncParametersUpdated(const base::TimeTicks& timebase, |
| 33 const base::TimeDelta& interval) override; | 37 const base::TimeDelta& interval) override; |
| 34 | 38 |
| 35 private: | 39 private: |
| 36 std::unique_ptr<cc::SyntheticBeginFrameSource> synthetic_begin_frame_source_; | 40 cc::SyntheticBeginFrameSource* const synthetic_begin_frame_source_; |
| 37 base::WeakPtrFactory<DirectOutputSurface> weak_ptr_factory_; | 41 base::WeakPtrFactory<DirectOutputSurface> weak_ptr_factory_; |
| 38 }; | 42 }; |
| 39 | 43 |
| 40 } // namespace mus | 44 } // namespace mus |
| 41 | 45 |
| 42 #endif // COMPONENTS_MUS_SURFACES_DIRECT_OUTPUT_SURFACE_H_ | 46 #endif // COMPONENTS_MUS_SURFACES_DIRECT_OUTPUT_SURFACE_H_ |
| OLD | NEW |