| 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/ipc/display_compositor.mojom.h" |
| 12 #include "cc/output/context_provider.h" | 13 #include "cc/output/context_provider.h" |
| 13 #include "cc/surfaces/surface_id.h" | 14 #include "cc/surfaces/surface_id.h" |
| 14 #include "mojo/public/cpp/bindings/binding.h" | 15 #include "mojo/public/cpp/bindings/binding.h" |
| 15 #include "services/ui/public/interfaces/window_tree.mojom.h" | 16 #include "services/ui/public/interfaces/window_tree.mojom.h" |
| 16 | 17 |
| 17 namespace ui { | 18 namespace ui { |
| 18 namespace ws { | 19 namespace ws { |
| 19 | 20 |
| 20 class ServerWindow; | 21 class ServerWindow; |
| 21 class ServerWindowCompositorFrameSink; | 22 class ServerWindowCompositorFrameSink; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 46 ~ServerWindowCompositorFrameSinkManager(); | 47 ~ServerWindowCompositorFrameSinkManager(); |
| 47 | 48 |
| 48 // Returns true if the CompositorFrameSinks from this manager should be drawn. | 49 // Returns true if the CompositorFrameSinks from this manager should be drawn. |
| 49 bool ShouldDraw(); | 50 bool ShouldDraw(); |
| 50 | 51 |
| 51 // Creates a new CompositorFrameSink of the specified type, replacing the | 52 // Creates a new CompositorFrameSink of the specified type, replacing the |
| 52 // existing one of the specified type. | 53 // existing one of the specified type. |
| 53 void CreateDisplayCompositorFrameSink( | 54 void CreateDisplayCompositorFrameSink( |
| 54 gfx::AcceleratedWidget widget, | 55 gfx::AcceleratedWidget widget, |
| 55 cc::mojom::MojoCompositorFrameSinkRequest request, | 56 cc::mojom::MojoCompositorFrameSinkRequest request, |
| 56 cc::mojom::MojoCompositorFrameSinkClientPtr client); | 57 cc::mojom::MojoCompositorFrameSinkClientPtr client, |
| 58 cc::mojom::DisplayPrivateRequest display_private_request); |
| 57 void CreateOffscreenCompositorFrameSink( | 59 void CreateOffscreenCompositorFrameSink( |
| 58 mojom::CompositorFrameSinkType compositor_frame_sink_type, | 60 mojom::CompositorFrameSinkType compositor_frame_sink_type, |
| 59 cc::mojom::MojoCompositorFrameSinkRequest request, | 61 cc::mojom::MojoCompositorFrameSinkRequest request, |
| 60 cc::mojom::MojoCompositorFrameSinkClientPtr client); | 62 cc::mojom::MojoCompositorFrameSinkClientPtr client); |
| 61 | 63 |
| 62 // Adds the provided |frame_sink_id| to this ServerWindow's associated | 64 // Adds the provided |frame_sink_id| to this ServerWindow's associated |
| 63 // CompositorFrameSink if possible. If this ServerWindow does not have | 65 // CompositorFrameSink if possible. If this ServerWindow does not have |
| 64 // an associated CompositorFrameSink then this method will recursively | 66 // an associated CompositorFrameSink then this method will recursively |
| 65 // walk up the window hierarchy and register itself with the first ancestor | 67 // walk up the window hierarchy and register itself with the first ancestor |
| 66 // that has a CompositorFrameSink of the same type. This method returns | 68 // that has a CompositorFrameSink of the same type. This method returns |
| (...skipping 25 matching lines...) Expand all Loading... |
| 92 | 94 |
| 93 // Returns true if a CompositorFrameSink of |type| has been set and has | 95 // Returns true if a CompositorFrameSink of |type| has been set and has |
| 94 // received a frame that is greater than the size of the window. | 96 // received a frame that is greater than the size of the window. |
| 95 bool IsCompositorFrameSinkReadyAndNonEmpty( | 97 bool IsCompositorFrameSinkReadyAndNonEmpty( |
| 96 mojom::CompositorFrameSinkType type) const; | 98 mojom::CompositorFrameSinkType type) const; |
| 97 | 99 |
| 98 void CreateCompositorFrameSinkInternal( | 100 void CreateCompositorFrameSinkInternal( |
| 99 mojom::CompositorFrameSinkType compositor_frame_sink_type, | 101 mojom::CompositorFrameSinkType compositor_frame_sink_type, |
| 100 gfx::AcceleratedWidget widget, | 102 gfx::AcceleratedWidget widget, |
| 101 cc::mojom::MojoCompositorFrameSinkRequest request, | 103 cc::mojom::MojoCompositorFrameSinkRequest request, |
| 102 cc::mojom::MojoCompositorFrameSinkClientPtr client); | 104 cc::mojom::MojoCompositorFrameSinkClientPtr client, |
| 105 cc::mojom::DisplayPrivateRequest display_private_request); |
| 103 | 106 |
| 104 ServerWindow* window_; | 107 ServerWindow* window_; |
| 105 | 108 |
| 106 using TypeToCompositorFrameSinkMap = | 109 using TypeToCompositorFrameSinkMap = |
| 107 std::map<mojom::CompositorFrameSinkType, CompositorFrameSinkData>; | 110 std::map<mojom::CompositorFrameSinkType, CompositorFrameSinkData>; |
| 108 | 111 |
| 109 TypeToCompositorFrameSinkMap type_to_compositor_frame_sink_map_; | 112 TypeToCompositorFrameSinkMap type_to_compositor_frame_sink_map_; |
| 110 | 113 |
| 111 // While true the window is not drawn. This is initially true if the window | 114 // While true the window is not drawn. This is initially true if the window |
| 112 // has the property |kWaitForUnderlay_Property|. This is set to false once | 115 // has the property |kWaitForUnderlay_Property|. This is set to false once |
| 113 // the underlay and default surface have been set *and* their size is at | 116 // the underlay and default surface have been set *and* their size is at |
| 114 // least that of the window. Ideally we would wait for sizes to match, but | 117 // least that of the window. Ideally we would wait for sizes to match, but |
| 115 // the underlay is not necessarily as big as the window. | 118 // the underlay is not necessarily as big as the window. |
| 116 bool waiting_for_initial_frames_; | 119 bool waiting_for_initial_frames_; |
| 117 | 120 |
| 118 DISALLOW_COPY_AND_ASSIGN(ServerWindowCompositorFrameSinkManager); | 121 DISALLOW_COPY_AND_ASSIGN(ServerWindowCompositorFrameSinkManager); |
| 119 }; | 122 }; |
| 120 | 123 |
| 121 } // namespace ws | 124 } // namespace ws |
| 122 } // namespace ui | 125 } // namespace ui |
| 123 | 126 |
| 124 #endif // SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_MANAGER_H_ | 127 #endif // SERVICES_UI_WS_SERVER_WINDOW_COMPOSITOR_FRAME_SINK_MANAGER_H_ |
| OLD | NEW |