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" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 class ServerWindowCompositorFrameSinkManager { | 42 class ServerWindowCompositorFrameSinkManager { |
43 public: | 43 public: |
44 explicit ServerWindowCompositorFrameSinkManager(ServerWindow* window); | 44 explicit ServerWindowCompositorFrameSinkManager(ServerWindow* window); |
45 ~ServerWindowCompositorFrameSinkManager(); | 45 ~ServerWindowCompositorFrameSinkManager(); |
46 | 46 |
47 // Returns true if the CompositorFrameSinks from this manager should be drawn. | 47 // Returns true if the CompositorFrameSinks from this manager should be drawn. |
48 bool ShouldDraw(); | 48 bool ShouldDraw(); |
49 | 49 |
50 // Creates a new CompositorFrameSink of the specified type, replacing the | 50 // Creates a new CompositorFrameSink of the specified type, replacing the |
51 // existing one of the specified type. | 51 // existing one of the specified type. |
52 void CreateCompositorFrameSink( | 52 void CreateDisplayCompositorFrameSink( |
| 53 gfx::AcceleratedWidget widget, |
| 54 cc::mojom::MojoCompositorFrameSinkRequest request, |
| 55 cc::mojom::MojoCompositorFrameSinkClientPtr client); |
| 56 void CreateOffscreenCompositorFrameSink( |
53 mojom::CompositorFrameSinkType compositor_frame_sink_type, | 57 mojom::CompositorFrameSinkType compositor_frame_sink_type, |
54 gfx::AcceleratedWidget widget, | |
55 cc::mojom::MojoCompositorFrameSinkRequest request, | 58 cc::mojom::MojoCompositorFrameSinkRequest request, |
56 cc::mojom::MojoCompositorFrameSinkClientPtr client); | 59 cc::mojom::MojoCompositorFrameSinkClientPtr client); |
57 | 60 |
58 // Adds the provided |frame_sink_id| to this ServerWindow's associated | 61 // Adds the provided |frame_sink_id| to this ServerWindow's associated |
59 // CompositorFrameSink if possible. If this ServerWindow does not have | 62 // CompositorFrameSink if possible. If this ServerWindow does not have |
60 // an associated CompositorFrameSink then this method will recursively | 63 // an associated CompositorFrameSink then this method will recursively |
61 // walk up the window hierarchy and register itself with the first ancestor | 64 // walk up the window hierarchy and register itself with the first ancestor |
62 // that has a CompositorFrameSink of the same type. This method returns | 65 // that has a CompositorFrameSink of the same type. This method returns |
63 // the FrameSinkId that is the first composited ancestor of the ServerWindow | 66 // the FrameSinkId that is the first composited ancestor of the ServerWindow |
64 // assocaited with the provided |frame_sink_id|. | 67 // assocaited with the provided |frame_sink_id|. |
(...skipping 17 matching lines...) Expand all Loading... |
82 | 85 |
83 private: | 86 private: |
84 friend class ServerWindowCompositorFrameSinkManagerTestApi; | 87 friend class ServerWindowCompositorFrameSinkManagerTestApi; |
85 friend class ServerWindowCompositorFrameSink; | 88 friend class ServerWindowCompositorFrameSink; |
86 | 89 |
87 // Returns true if a CompositorFrameSink of |type| has been set and has | 90 // Returns true if a CompositorFrameSink of |type| has been set and has |
88 // received a frame that is greater than the size of the window. | 91 // received a frame that is greater than the size of the window. |
89 bool IsCompositorFrameSinkReadyAndNonEmpty( | 92 bool IsCompositorFrameSinkReadyAndNonEmpty( |
90 mojom::CompositorFrameSinkType type) const; | 93 mojom::CompositorFrameSinkType type) const; |
91 | 94 |
| 95 void CreateCompositorFrameSinkInternal( |
| 96 mojom::CompositorFrameSinkType compositor_frame_sink_type, |
| 97 gfx::AcceleratedWidget widget, |
| 98 cc::mojom::MojoCompositorFrameSinkRequest request, |
| 99 cc::mojom::MojoCompositorFrameSinkClientPtr client); |
| 100 |
92 ServerWindow* window_; | 101 ServerWindow* window_; |
93 | 102 |
94 using TypeToCompositorFrameSinkMap = | 103 using TypeToCompositorFrameSinkMap = |
95 std::map<mojom::CompositorFrameSinkType, CompositorFrameSinkData>; | 104 std::map<mojom::CompositorFrameSinkType, CompositorFrameSinkData>; |
96 | 105 |
97 TypeToCompositorFrameSinkMap type_to_compositor_frame_sink_map_; | 106 TypeToCompositorFrameSinkMap type_to_compositor_frame_sink_map_; |
98 | 107 |
99 // While true the window is not drawn. This is initially true if the window | 108 // While true the window is not drawn. This is initially true if the window |
100 // has the property |kWaitForUnderlay_Property|. This is set to false once | 109 // has the property |kWaitForUnderlay_Property|. This is set to false once |
101 // the underlay and default surface have been set *and* their size is at | 110 // the underlay and default surface have been set *and* their size is at |
102 // least that of the window. Ideally we would wait for sizes to match, but | 111 // least that of the window. Ideally we would wait for sizes to match, but |
103 // the underlay is not necessarily as big as the window. | 112 // the underlay is not necessarily as big as the window. |
104 bool waiting_for_initial_frames_; | 113 bool waiting_for_initial_frames_; |
105 | 114 |
106 DISALLOW_COPY_AND_ASSIGN(ServerWindowCompositorFrameSinkManager); | 115 DISALLOW_COPY_AND_ASSIGN(ServerWindowCompositorFrameSinkManager); |
107 }; | 116 }; |
108 | 117 |
109 } // namespace ws | 118 } // namespace ws |
110 } // namespace ui | 119 } // namespace ui |
111 | 120 |
112 #endif // SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_MANAGER_H_ | 121 #endif // SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_MANAGER_H_ |
OLD | NEW |