| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_TOP_LEVEL_DISPLAY_CLIENT_H_ | 5 #ifndef COMPONENTS_MUS_SURFACES_TOP_LEVEL_DISPLAY_CLIENT_H_ |
| 6 #define COMPONENTS_MUS_SURFACES_TOP_LEVEL_DISPLAY_CLIENT_H_ | 6 #define COMPONENTS_MUS_SURFACES_TOP_LEVEL_DISPLAY_CLIENT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include "cc/surfaces/display_client.h" |
| 9 | 9 |
| 10 #include <memory> | |
| 11 | |
| 12 #include "base/macros.h" | |
| 13 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 14 #include "cc/surfaces/display_client.h" | 11 #include "base/single_thread_task_runner.h" |
| 15 #include "cc/surfaces/surface_factory.h" | |
| 16 #include "cc/surfaces/surface_factory_client.h" | |
| 17 #include "components/mus/gles2/gpu_state.h" | |
| 18 #include "components/mus/public/interfaces/window_manager.mojom.h" | |
| 19 #include "components/mus/surfaces/surfaces_state.h" | |
| 20 #include "mojo/public/cpp/bindings/strong_binding.h" | |
| 21 #include "ui/gfx/native_widget_types.h" | |
| 22 | 12 |
| 23 namespace cc { | 13 namespace cc { |
| 24 class CopyOutputResult; | |
| 25 class Display; | 14 class Display; |
| 26 class DisplayScheduler; | 15 class OutputSurface; |
| 27 class SurfaceFactory; | 16 class RendererSettings; |
| 17 class SharedBitmapManager; |
| 18 class SurfaceManager; |
| 19 } |
| 20 |
| 21 namespace gpu { |
| 22 class GpuMemoryBufferManager; |
| 28 } | 23 } |
| 29 | 24 |
| 30 namespace mus { | 25 namespace mus { |
| 31 | 26 |
| 32 class DisplayDelegate; | 27 class TopLevelDisplayClient : public cc::DisplayClient { |
| 33 class SurfacesState; | |
| 34 | |
| 35 // A TopLevelDisplayClient manages the top level surface that is rendered into a | |
| 36 // provided AcceleratedWidget. Frames are submitted here. New frames are | |
| 37 // scheduled to be generated here based on VSync. | |
| 38 class TopLevelDisplayClient : public cc::DisplayClient, | |
| 39 public cc::SurfaceFactoryClient { | |
| 40 public: | 28 public: |
| 41 TopLevelDisplayClient(gfx::AcceleratedWidget widget, | 29 TopLevelDisplayClient(std::unique_ptr<cc::OutputSurface> output_surface, |
| 42 const scoped_refptr<GpuState>& gpu_state, | 30 cc::SurfaceManager* surface_manager, |
| 43 const scoped_refptr<SurfacesState>& surfaces_state); | 31 cc::SharedBitmapManager* bitmap_manager, |
| 32 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
| 33 const cc::RendererSettings& settings, |
| 34 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 35 uint32_t compositor_surface_namespace); |
| 44 ~TopLevelDisplayClient() override; | 36 ~TopLevelDisplayClient() override; |
| 45 | 37 |
| 46 void SubmitCompositorFrame(std::unique_ptr<cc::CompositorFrame> frame, | 38 bool Initialize(); |
| 47 const base::Closure& callback); | |
| 48 const cc::SurfaceId& surface_id() const { return cc_id_; } | |
| 49 | 39 |
| 50 void RequestCopyOfOutput( | 40 cc::Display* display() { return display_.get(); } |
| 51 std::unique_ptr<cc::CopyOutputRequest> output_request); | |
| 52 | 41 |
| 53 private: | 42 private: |
| 54 // DisplayClient implementation. | 43 // DisplayClient implementation. |
| 55 void OutputSurfaceLost() override; | 44 void OutputSurfaceLost() override; |
| 56 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override; | 45 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override; |
| 57 | 46 |
| 58 // SurfaceFactoryClient implementation. | 47 std::unique_ptr<cc::OutputSurface> output_surface_; |
| 59 void ReturnResources(const cc::ReturnedResourceArray& resources) override; | |
| 60 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; | |
| 61 | |
| 62 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 48 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 63 scoped_refptr<SurfacesState> surfaces_state_; | |
| 64 cc::SurfaceFactory factory_; | |
| 65 cc::SurfaceId cc_id_; | |
| 66 | |
| 67 gfx::Size last_submitted_frame_size_; | |
| 68 std::unique_ptr<cc::CompositorFrame> pending_frame_; | |
| 69 | |
| 70 std::unique_ptr<cc::Display> display_; | 49 std::unique_ptr<cc::Display> display_; |
| 71 | 50 |
| 72 DISALLOW_COPY_AND_ASSIGN(TopLevelDisplayClient); | 51 DISALLOW_COPY_AND_ASSIGN(TopLevelDisplayClient); |
| 73 }; | 52 }; |
| 74 | 53 |
| 75 } // namespace mus | 54 } // namespace mus |
| 76 | 55 |
| 77 #endif // COMPONENTS_MUS_SURFACES_TOP_LEVEL_DISPLAY_CLIENT_H_ | 56 #endif // COMPONENTS_MUS_SURFACES_TOP_LEVEL_DISPLAY_CLIENT_H_ |
| OLD | NEW |