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