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