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 SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_MANAGER_H_ | 5 #ifndef SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_MANAGER_H_ |
6 #define SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_MANAGER_H_ | 6 #define SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "cc/ipc/compositor_frame.mojom.h" | 11 #include "cc/ipc/compositor_frame.mojom.h" |
12 #include "cc/output/context_provider.h" | 12 #include "cc/output/context_provider.h" |
13 #include "cc/surfaces/surface_id.h" | 13 #include "cc/surfaces/surface_id.h" |
14 #include "mojo/public/cpp/bindings/binding.h" | 14 #include "mojo/public/cpp/bindings/binding.h" |
15 #include "services/ui/public/interfaces/window_tree.mojom.h" | 15 #include "services/ui/public/interfaces/window_tree.mojom.h" |
16 #include "services/ui/surfaces/surfaces_context_provider.h" | |
17 | 16 |
18 namespace gpu { | 17 namespace gpu { |
19 class GpuMemoryBufferManager; | 18 class GpuMemoryBufferManager; |
20 } | 19 } |
21 | 20 |
22 namespace ui { | 21 namespace ui { |
23 namespace ws { | 22 namespace ws { |
24 | 23 |
25 class GpuCompositorFrameSink; | |
26 class ServerWindow; | 24 class ServerWindow; |
27 class ServerWindowCompositorFrameSink; | 25 class ServerWindowCompositorFrameSink; |
28 class ServerWindowCompositorFrameSinkManagerTestApi; | 26 class ServerWindowCompositorFrameSinkManagerTestApi; |
29 | 27 |
30 struct CompositorFrameSinkData { | 28 struct CompositorFrameSinkData { |
31 CompositorFrameSinkData(); | 29 CompositorFrameSinkData(); |
32 CompositorFrameSinkData(CompositorFrameSinkData&& other); | 30 CompositorFrameSinkData(CompositorFrameSinkData&& other); |
33 ~CompositorFrameSinkData(); | 31 ~CompositorFrameSinkData(); |
34 | 32 |
35 CompositorFrameSinkData& operator=(CompositorFrameSinkData&& other); | 33 CompositorFrameSinkData& operator=(CompositorFrameSinkData&& other); |
36 | 34 |
37 cc::SurfaceId latest_submitted_surface_id; | 35 cc::SurfaceId latest_submitted_surface_id; |
38 gfx::Size latest_submitted_frame_size; | 36 gfx::Size latest_submitted_frame_size; |
39 cc::mojom::MojoCompositorFrameSinkPrivatePtr compositor_frame_sink; | 37 cc::mojom::MojoCompositorFrameSinkPrivatePtr compositor_frame_sink; |
40 cc::mojom::MojoCompositorFrameSinkPrivateRequest | 38 cc::mojom::MojoCompositorFrameSinkPrivateRequest |
41 pending_compositor_frame_sink_request; | 39 pending_compositor_frame_sink_request; |
42 std::unique_ptr<GpuCompositorFrameSink> compositor_frame_sink_impl_; | |
43 }; | 40 }; |
44 | 41 |
45 // ServerWindowCompositorFrameSinkManager tracks the surfaces associated with a | 42 // ServerWindowCompositorFrameSinkManager tracks the surfaces associated with a |
46 // ServerWindow. | 43 // ServerWindow. |
47 // TODO(fsamuel): Delete this once window decorations are managed in the window | 44 // TODO(fsamuel): Delete this once window decorations are managed in the window |
48 // manager. | 45 // manager. |
49 class ServerWindowCompositorFrameSinkManager { | 46 class ServerWindowCompositorFrameSinkManager { |
50 public: | 47 public: |
51 explicit ServerWindowCompositorFrameSinkManager(ServerWindow* window); | 48 explicit ServerWindowCompositorFrameSinkManager(ServerWindow* window); |
52 ~ServerWindowCompositorFrameSinkManager(); | 49 ~ServerWindowCompositorFrameSinkManager(); |
53 | 50 |
54 // Returns true if the CompositorFrameSinks from this manager should be drawn. | 51 // Returns true if the CompositorFrameSinks from this manager should be drawn. |
55 bool ShouldDraw(); | 52 bool ShouldDraw(); |
56 | 53 |
57 // Creates a new CompositorFrameSink of the specified type, replacing the | 54 // Creates a new CompositorFrameSink of the specified type, replacing the |
58 // existing one of the specified type. | 55 // existing one of the specified type. |
59 void CreateCompositorFrameSink( | 56 void CreateCompositorFrameSink( |
60 mojom::CompositorFrameSinkType compositor_frame_sink_type, | 57 mojom::CompositorFrameSinkType compositor_frame_sink_type, |
61 gfx::AcceleratedWidget widget, | 58 gfx::AcceleratedWidget widget, |
62 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | |
63 scoped_refptr<SurfacesContextProvider> context_provider, | |
64 cc::mojom::MojoCompositorFrameSinkRequest request, | 59 cc::mojom::MojoCompositorFrameSinkRequest request, |
65 cc::mojom::MojoCompositorFrameSinkClientPtr client); | 60 cc::mojom::MojoCompositorFrameSinkClientPtr client); |
66 | 61 |
67 // Adds the provided |frame_sink_id| to this ServerWindow's associated | 62 // Adds the provided |frame_sink_id| to this ServerWindow's associated |
68 // CompositorFrameSink if possible. If this ServerWindow does not have | 63 // CompositorFrameSink if possible. If this ServerWindow does not have |
69 // an associated CompositorFrameSink then this method will recursively | 64 // an associated CompositorFrameSink then this method will recursively |
70 // walk up the window hierarchy and register itself with the first ancestor | 65 // walk up the window hierarchy and register itself with the first ancestor |
71 // that has a CompositorFrameSink of the same type. This method returns | 66 // that has a CompositorFrameSink of the same type. This method returns |
72 // the FrameSinkId that is the first composited ancestor of the ServerWindow | 67 // the FrameSinkId that is the first composited ancestor of the ServerWindow |
73 // assocaited with the provided |frame_sink_id|. | 68 // assocaited with the provided |frame_sink_id|. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 // the underlay is not necessarily as big as the window. | 107 // the underlay is not necessarily as big as the window. |
113 bool waiting_for_initial_frames_; | 108 bool waiting_for_initial_frames_; |
114 | 109 |
115 DISALLOW_COPY_AND_ASSIGN(ServerWindowCompositorFrameSinkManager); | 110 DISALLOW_COPY_AND_ASSIGN(ServerWindowCompositorFrameSinkManager); |
116 }; | 111 }; |
117 | 112 |
118 } // namespace ws | 113 } // namespace ws |
119 } // namespace ui | 114 } // namespace ui |
120 | 115 |
121 #endif // SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_MANAGER_H_ | 116 #endif // SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_MANAGER_H_ |
OLD | NEW |