OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_OZONE_H_ | 5 #ifndef COMPONENTS_MUS_SURFACES_DIRECT_OUTPUT_SURFACE_OZONE_H_ |
6 #define COMPONENTS_MUS_SURFACES_DIRECT_OUTPUT_SURFACE_OZONE_H_ | 6 #define COMPONENTS_MUS_SURFACES_DIRECT_OUTPUT_SURFACE_OZONE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "cc/output/context_provider.h" | 11 #include "cc/output/context_provider.h" |
12 #include "cc/output/output_surface.h" | 12 #include "cc/output/output_surface.h" |
| 13 #include "cc/scheduler/begin_frame_source.h" |
13 #include "ui/gfx/geometry/size.h" | 14 #include "ui/gfx/geometry/size.h" |
14 #include "ui/gfx/native_widget_types.h" | 15 #include "ui/gfx/native_widget_types.h" |
15 #include "ui/gfx/swap_result.h" | 16 #include "ui/gfx/swap_result.h" |
16 #include "ui/gl/gl_surface.h" | 17 #include "ui/gl/gl_surface.h" |
17 | 18 |
18 namespace ui { | 19 namespace ui { |
19 class LatencyInfo; | 20 class LatencyInfo; |
20 } // namespace ui | 21 } // namespace ui |
21 | 22 |
22 namespace cc { | 23 namespace cc { |
23 class CompositorFrame; | 24 class CompositorFrame; |
24 } // namespace cc | 25 } // namespace cc |
25 | 26 |
26 namespace mus { | 27 namespace mus { |
27 | 28 |
28 class BufferQueue; | 29 class BufferQueue; |
29 class SurfacesContextProvider; | 30 class SurfacesContextProvider; |
30 | 31 |
31 // An OutputSurface implementation that directly draws and swap to a GL | 32 // An OutputSurface implementation that directly draws and swap to a GL |
32 // "surfaceless" surface (aka one backed by a buffer managed explicitly in | 33 // "surfaceless" surface (aka one backed by a buffer managed explicitly in |
33 // mus/ozone. This class is adapted from | 34 // mus/ozone. This class is adapted from |
34 // GpuSurfacelessBrowserCompositorOutputSurface. | 35 // GpuSurfacelessBrowserCompositorOutputSurface. |
35 class DirectOutputSurfaceOzone : public cc::OutputSurface { | 36 class DirectOutputSurfaceOzone : public cc::OutputSurface { |
36 public: | 37 public: |
37 DirectOutputSurfaceOzone( | 38 DirectOutputSurfaceOzone( |
38 const scoped_refptr<SurfacesContextProvider>& context_provider, | 39 const scoped_refptr<SurfacesContextProvider>& context_provider, |
39 gfx::AcceleratedWidget widget, | 40 gfx::AcceleratedWidget widget, |
| 41 base::SingleThreadTaskRunner* task_runner, |
40 uint32_t target, | 42 uint32_t target, |
41 uint32_t internalformat); | 43 uint32_t internalformat); |
42 | 44 |
43 ~DirectOutputSurfaceOzone() override; | 45 ~DirectOutputSurfaceOzone() override; |
44 | 46 |
45 // TODO(rjkroege): Implement the equivalent of Reflector. | 47 // TODO(rjkroege): Implement the equivalent of Reflector. |
46 | 48 |
47 private: | 49 private: |
48 // cc::OutputSurface implementation. | 50 // cc::OutputSurface implementation. |
49 void SwapBuffers(cc::CompositorFrame* frame) override; | 51 void SwapBuffers(cc::CompositorFrame* frame) override; |
50 void BindFramebuffer() override; | 52 void BindFramebuffer() override; |
51 void Reshape(const gfx::Size& size, float scale_factor, bool alpha) override; | 53 void Reshape(const gfx::Size& size, float scale_factor, bool alpha) override; |
52 bool IsDisplayedAsOverlayPlane() const override; | 54 bool IsDisplayedAsOverlayPlane() const override; |
53 unsigned GetOverlayTextureId() const override; | 55 unsigned GetOverlayTextureId() const override; |
54 bool BindToClient(cc::OutputSurfaceClient* client) override; | 56 bool BindToClient(cc::OutputSurfaceClient* client) override; |
55 | 57 |
56 // Taken from BrowserCompositor specific API. | 58 // Taken from BrowserCompositor specific API. |
57 void OnUpdateVSyncParametersFromGpu(base::TimeTicks timebase, | 59 void OnUpdateVSyncParametersFromGpu(base::TimeTicks timebase, |
58 base::TimeDelta interval); | 60 base::TimeDelta interval); |
59 | 61 |
60 // Called when a swap completion is sent from the GPU process. | 62 // Called when a swap completion is sent from the GPU process. |
61 void OnGpuSwapBuffersCompleted(gfx::SwapResult result); | 63 void OnGpuSwapBuffersCompleted(gfx::SwapResult result); |
62 | 64 |
63 std::unique_ptr<BufferQueue> output_surface_; | 65 std::unique_ptr<BufferQueue> output_surface_; |
| 66 std::unique_ptr<cc::SyntheticBeginFrameSource> synthetic_begin_frame_source_; |
64 | 67 |
65 base::WeakPtrFactory<DirectOutputSurfaceOzone> weak_ptr_factory_; | 68 base::WeakPtrFactory<DirectOutputSurfaceOzone> weak_ptr_factory_; |
66 }; | 69 }; |
67 | 70 |
68 } // namespace mus | 71 } // namespace mus |
69 | 72 |
70 #endif // COMPONENTS_MUS_SURFACES_DIRECT_OUTPUT_SURFACE_OZONE_H_ | 73 #endif // COMPONENTS_MUS_SURFACES_DIRECT_OUTPUT_SURFACE_OZONE_H_ |
OLD | NEW |