| 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 SERVICES_UI_SURFACES_DIRECT_OUTPUT_SURFACE_OZONE_H_ | 5 #ifndef SERVICES_UI_SURFACES_DISPLAY_OUTPUT_SURFACE_OZONE_H_ |
| 6 #define SERVICES_UI_SURFACES_DIRECT_OUTPUT_SURFACE_OZONE_H_ | 6 #define SERVICES_UI_SURFACES_DISPLAY_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/in_process_context_provider.h" | 12 #include "cc/output/in_process_context_provider.h" |
| 13 #include "cc/output/output_surface.h" | 13 #include "cc/output/output_surface.h" |
| 14 #include "components/display_compositor/gl_helper.h" | 14 #include "components/display_compositor/gl_helper.h" |
| 15 #include "ui/gfx/geometry/size.h" | 15 #include "ui/gfx/geometry/size.h" |
| 16 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
| 17 #include "ui/gfx/swap_result.h" | 17 #include "ui/gfx/swap_result.h" |
| 18 #include "ui/gl/gl_surface.h" | 18 #include "ui/gl/gl_surface.h" |
| 19 | 19 |
| 20 namespace cc { | 20 namespace cc { |
| 21 class CompositorFrame; | |
| 22 class SyntheticBeginFrameSource; | 21 class SyntheticBeginFrameSource; |
| 23 } | 22 } |
| 24 | 23 |
| 25 namespace display_compositor { | 24 namespace display_compositor { |
| 26 class BufferQueue; | 25 class BufferQueue; |
| 27 } | 26 } |
| 28 | 27 |
| 29 namespace gpu { | 28 namespace gpu { |
| 30 class GpuMemoryBufferManager; | 29 class GpuMemoryBufferManager; |
| 31 } | 30 } |
| 32 | 31 |
| 33 namespace ui { | 32 namespace ui { |
| 34 | 33 |
| 35 // An OutputSurface implementation that directly draws and swap to a GL | 34 // An OutputSurface implementation that directly draws and swap to a GL |
| 36 // "surfaceless" surface (aka one backed by a buffer managed explicitly in | 35 // "surfaceless" surface (aka one backed by a buffer managed explicitly in |
| 37 // mus/ozone. This class is adapted from | 36 // mus/ozone. This class is adapted from |
| 38 // GpuSurfacelessBrowserCompositorOutputSurface. | 37 // GpuSurfacelessBrowserCompositorOutputSurface. |
| 39 class DirectOutputSurfaceOzone : public cc::OutputSurface { | 38 class DisplayOutputSurfaceOzone : public cc::OutputSurface { |
| 40 public: | 39 public: |
| 41 DirectOutputSurfaceOzone( | 40 DisplayOutputSurfaceOzone( |
| 42 scoped_refptr<cc::InProcessContextProvider> context_provider, | 41 scoped_refptr<cc::InProcessContextProvider> context_provider, |
| 43 gfx::AcceleratedWidget widget, | 42 gfx::AcceleratedWidget widget, |
| 44 cc::SyntheticBeginFrameSource* synthetic_begin_frame_source, | 43 cc::SyntheticBeginFrameSource* synthetic_begin_frame_source, |
| 45 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 44 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 46 uint32_t target, | 45 uint32_t target, |
| 47 uint32_t internalformat); | 46 uint32_t internalformat); |
| 48 | 47 |
| 49 ~DirectOutputSurfaceOzone() override; | 48 ~DisplayOutputSurfaceOzone() override; |
| 50 | 49 |
| 51 // TODO(rjkroege): Implement the equivalent of Reflector. | 50 // TODO(rjkroege): Implement the equivalent of Reflector. |
| 52 | 51 |
| 53 private: | 52 private: |
| 54 // cc::OutputSurface implementation. | 53 // cc::OutputSurface implementation. |
| 55 void BindToClient(cc::OutputSurfaceClient* client) override; | 54 void BindToClient(cc::OutputSurfaceClient* client) override; |
| 56 void EnsureBackbuffer() override; | 55 void EnsureBackbuffer() override; |
| 57 void DiscardBackbuffer() override; | 56 void DiscardBackbuffer() override; |
| 58 void BindFramebuffer() override; | 57 void BindFramebuffer() override; |
| 59 void Reshape(const gfx::Size& size, | 58 void Reshape(const gfx::Size& size, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 79 | 78 |
| 80 cc::OutputSurfaceClient* client_ = nullptr; | 79 cc::OutputSurfaceClient* client_ = nullptr; |
| 81 | 80 |
| 82 display_compositor::GLHelper gl_helper_; | 81 display_compositor::GLHelper gl_helper_; |
| 83 std::unique_ptr<display_compositor::BufferQueue> buffer_queue_; | 82 std::unique_ptr<display_compositor::BufferQueue> buffer_queue_; |
| 84 cc::SyntheticBeginFrameSource* const synthetic_begin_frame_source_; | 83 cc::SyntheticBeginFrameSource* const synthetic_begin_frame_source_; |
| 85 | 84 |
| 86 gfx::Size reshape_size_; | 85 gfx::Size reshape_size_; |
| 87 gfx::Size swap_size_; | 86 gfx::Size swap_size_; |
| 88 | 87 |
| 89 base::WeakPtrFactory<DirectOutputSurfaceOzone> weak_ptr_factory_; | 88 base::WeakPtrFactory<DisplayOutputSurfaceOzone> weak_ptr_factory_; |
| 90 }; | 89 }; |
| 91 | 90 |
| 92 } // namespace ui | 91 } // namespace ui |
| 93 | 92 |
| 94 #endif // SERVICES_UI_SURFACES_DIRECT_OUTPUT_SURFACE_OZONE_H_ | 93 #endif // SERVICES_UI_SURFACES_DISPLAY_OUTPUT_SURFACE_OZONE_H_ |
| OLD | NEW |