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_DISPLAY_COMPOSITOR_H_ | 5 #ifndef COMPONENTS_MUS_SURFACES_DISPLAY_COMPOSITOR_H_ |
6 #define COMPONENTS_MUS_SURFACES_DISPLAY_COMPOSITOR_H_ | 6 #define COMPONENTS_MUS_SURFACES_DISPLAY_COMPOSITOR_H_ |
7 | 7 |
| 8 #include "cc/surfaces/display_client.h" |
8 #include "cc/surfaces/surface.h" | 9 #include "cc/surfaces/surface.h" |
9 #include "cc/surfaces/surface_factory.h" | 10 #include "cc/surfaces/surface_factory.h" |
10 #include "cc/surfaces/surface_factory_client.h" | 11 #include "cc/surfaces/surface_factory_client.h" |
11 #include "cc/surfaces/surface_id_allocator.h" | 12 #include "cc/surfaces/surface_id_allocator.h" |
12 #include "components/mus/gles2/gpu_state.h" | 13 #include "components/mus/gles2/gpu_state.h" |
13 #include "components/mus/surfaces/surfaces_state.h" | 14 #include "components/mus/surfaces/surfaces_state.h" |
14 #include "ui/gfx/native_widget_types.h" | 15 #include "ui/gfx/native_widget_types.h" |
15 | 16 |
| 17 namespace cc { |
| 18 class Display; |
| 19 } |
| 20 |
16 namespace mus { | 21 namespace mus { |
17 | 22 |
18 class TopLevelDisplayClient; | |
19 | |
20 // TODO(fsamuel): This should become a mojo interface for the mus-gpu split. | 23 // TODO(fsamuel): This should become a mojo interface for the mus-gpu split. |
21 // TODO(fsamuel): This should not be a SurfaceFactoryClient. | 24 // TODO(fsamuel): This should not be a SurfaceFactoryClient. |
22 // The DisplayCompositor receives CompositorFrames from all sources, | 25 // The DisplayCompositor receives CompositorFrames from all sources, |
23 // creates a top-level CompositorFrame once per tick, and generates graphical | 26 // creates a top-level CompositorFrame once per tick, and generates graphical |
24 // output. | 27 // output. |
25 class DisplayCompositor : public cc::SurfaceFactoryClient { | 28 class DisplayCompositor : public cc::SurfaceFactoryClient, |
| 29 public cc::DisplayClient { |
26 public: | 30 public: |
27 DisplayCompositor(scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 31 DisplayCompositor(scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
28 gfx::AcceleratedWidget widget, | 32 gfx::AcceleratedWidget widget, |
29 const scoped_refptr<GpuState>& gpu_state, | 33 const scoped_refptr<GpuState>& gpu_state, |
30 const scoped_refptr<SurfacesState>& surfaces_state); | 34 const scoped_refptr<SurfacesState>& surfaces_state); |
31 ~DisplayCompositor() override; | 35 ~DisplayCompositor() override; |
32 | 36 |
33 // DisplayCompositor embedders submit a CompositorFrame when content on the | 37 // DisplayCompositor embedders submit a CompositorFrame when content on the |
34 // display should be changed. A well-behaving embedder should only submit | 38 // display should be changed. A well-behaving embedder should only submit |
35 // a CompositorFrame once per BeginFrame tick. The callback is called the | 39 // a CompositorFrame once per BeginFrame tick. The callback is called the |
(...skipping 13 matching lines...) Expand all Loading... |
49 | 53 |
50 // TODO(fsamuel): Invent an async way to create a SurfaceNamespace | 54 // TODO(fsamuel): Invent an async way to create a SurfaceNamespace |
51 // A SurfaceNamespace can create CompositorFrameSinks where the client can | 55 // A SurfaceNamespace can create CompositorFrameSinks where the client can |
52 // make up the ID. | 56 // make up the ID. |
53 | 57 |
54 private: | 58 private: |
55 // SurfaceFactoryClient implementation. | 59 // SurfaceFactoryClient implementation. |
56 void ReturnResources(const cc::ReturnedResourceArray& resources) override; | 60 void ReturnResources(const cc::ReturnedResourceArray& resources) override; |
57 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; | 61 void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; |
58 | 62 |
| 63 // DisplayClient implementation. |
| 64 void DisplayOutputSurfaceLost() override; |
| 65 void DisplaySetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override; |
| 66 |
59 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 67 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
60 scoped_refptr<SurfacesState> surfaces_state_; | 68 scoped_refptr<SurfacesState> surfaces_state_; |
61 cc::SurfaceFactory factory_; | 69 cc::SurfaceFactory factory_; |
62 cc::SurfaceIdAllocator allocator_; | 70 cc::SurfaceIdAllocator allocator_; |
63 cc::SurfaceId surface_id_; | 71 cc::SurfaceId surface_id_; |
64 | 72 |
65 gfx::Size display_size_; | 73 gfx::Size display_size_; |
66 std::unique_ptr<TopLevelDisplayClient> display_client_; | 74 std::unique_ptr<cc::Display> display_; |
67 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor); | 75 DISALLOW_COPY_AND_ASSIGN(DisplayCompositor); |
68 }; | 76 }; |
69 | 77 |
70 } // namespace mus | 78 } // namespace mus |
71 | 79 |
72 #endif // COMPONENTS_MUS_SURFACES_DISPLAY_COMPOSITOR_H_ | 80 #endif // COMPONENTS_MUS_SURFACES_DISPLAY_COMPOSITOR_H_ |
OLD | NEW |