| 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 mojom::CompositorFrameSinkType compositor_frame_sink_type, | 53 mojom::CompositorFrameSinkType compositor_frame_sink_type, |
| 54 gfx::AcceleratedWidget widget, | 54 gfx::AcceleratedWidget widget, |
| 55 cc::mojom::MojoCompositorFrameSinkRequest request, | 55 cc::mojom::MojoCompositorFrameSinkRequest request, |
| 56 cc::mojom::MojoCompositorFrameSinkClientPtr client); | 56 cc::mojom::MojoCompositorFrameSinkClientPtr client); |
| 57 void CreateOffscreenCompositorFrameSink( |
| 58 mojom::CompositorFrameSinkType compositor_frame_sink_type, |
| 59 cc::mojom::MojoCompositorFrameSinkRequest request, |
| 60 cc::mojom::MojoCompositorFrameSinkClientPtr client); |
| 57 | 61 |
| 58 // Adds the provided |frame_sink_id| to this ServerWindow's associated | 62 // Adds the provided |frame_sink_id| to this ServerWindow's associated |
| 59 // CompositorFrameSink if possible. If this ServerWindow does not have | 63 // CompositorFrameSink if possible. If this ServerWindow does not have |
| 60 // an associated CompositorFrameSink then this method will recursively | 64 // an associated CompositorFrameSink then this method will recursively |
| 61 // 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 |
| 62 // that has a CompositorFrameSink of the same type. This method returns | 66 // that has a CompositorFrameSink of the same type. This method returns |
| 63 // the FrameSinkId that is the first composited ancestor of the ServerWindow | 67 // the FrameSinkId that is the first composited ancestor of the ServerWindow |
| 64 // assocaited with the provided |frame_sink_id|. | 68 // assocaited with the provided |frame_sink_id|. |
| 65 void AddChildFrameSinkId( | 69 void AddChildFrameSinkId( |
| 66 mojom::CompositorFrameSinkType compositor_frame_sink_type, | 70 mojom::CompositorFrameSinkType compositor_frame_sink_type, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 82 | 86 |
| 83 private: | 87 private: |
| 84 friend class ServerWindowCompositorFrameSinkManagerTestApi; | 88 friend class ServerWindowCompositorFrameSinkManagerTestApi; |
| 85 friend class ServerWindowCompositorFrameSink; | 89 friend class ServerWindowCompositorFrameSink; |
| 86 | 90 |
| 87 // Returns true if a CompositorFrameSink of |type| has been set and has | 91 // 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. | 92 // received a frame that is greater than the size of the window. |
| 89 bool IsCompositorFrameSinkReadyAndNonEmpty( | 93 bool IsCompositorFrameSinkReadyAndNonEmpty( |
| 90 mojom::CompositorFrameSinkType type) const; | 94 mojom::CompositorFrameSinkType type) const; |
| 91 | 95 |
| 96 void CreateCompositorFrameSinkInternal( |
| 97 mojom::CompositorFrameSinkType compositor_frame_sink_type, |
| 98 gfx::AcceleratedWidget widget, |
| 99 cc::mojom::MojoCompositorFrameSinkRequest request, |
| 100 cc::mojom::MojoCompositorFrameSinkClientPtr client); |
| 101 |
| 92 ServerWindow* window_; | 102 ServerWindow* window_; |
| 93 | 103 |
| 94 using TypeToCompositorFrameSinkMap = | 104 using TypeToCompositorFrameSinkMap = |
| 95 std::map<mojom::CompositorFrameSinkType, CompositorFrameSinkData>; | 105 std::map<mojom::CompositorFrameSinkType, CompositorFrameSinkData>; |
| 96 | 106 |
| 97 TypeToCompositorFrameSinkMap type_to_compositor_frame_sink_map_; | 107 TypeToCompositorFrameSinkMap type_to_compositor_frame_sink_map_; |
| 98 | 108 |
| 99 // While true the window is not drawn. This is initially true if the window | 109 // 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 | 110 // 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 | 111 // 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 | 112 // 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. | 113 // the underlay is not necessarily as big as the window. |
| 104 bool waiting_for_initial_frames_; | 114 bool waiting_for_initial_frames_; |
| 105 | 115 |
| 106 DISALLOW_COPY_AND_ASSIGN(ServerWindowCompositorFrameSinkManager); | 116 DISALLOW_COPY_AND_ASSIGN(ServerWindowCompositorFrameSinkManager); |
| 107 }; | 117 }; |
| 108 | 118 |
| 109 } // namespace ws | 119 } // namespace ws |
| 110 } // namespace ui | 120 } // namespace ui |
| 111 | 121 |
| 112 #endif // SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_MANAGER_H_ | 122 #endif // SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_MANAGER_H_ |
| OLD | NEW |