OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 #include "content/renderer/mus/renderer_window_tree_client.h" | 5 #include "content/renderer/mus/renderer_window_tree_client.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 if (!render_frame && !render_view) | 100 if (!render_frame && !render_view) |
101 return nullptr; | 101 return nullptr; |
102 return render_frame ? render_frame->GetRenderWidget() | 102 return render_frame ? render_frame->GetRenderWidget() |
103 : render_view->GetWidget(); | 103 : render_view->GetWidget(); |
104 } | 104 } |
105 | 105 |
106 void RendererWindowTreeClient::DestroySelf() { | 106 void RendererWindowTreeClient::DestroySelf() { |
107 delete this; | 107 delete this; |
108 } | 108 } |
109 | 109 |
110 void RendererWindowTreeClient::OnEmbed(ui::ClientSpecificId client_id, | 110 void RendererWindowTreeClient::OnEmbed( |
111 ui::mojom::WindowDataPtr root, | 111 ui::ClientSpecificId client_id, |
112 ui::mojom::WindowTreePtr tree, | 112 ui::mojom::WindowDataPtr root, |
113 int64_t display_id, | 113 ui::mojom::WindowTreePtr tree, |
114 ui::Id focused_window_id, | 114 int64_t display_id, |
115 bool drawn, | 115 ui::Id focused_window_id, |
116 const cc::FrameSinkId& frame_sink_id) { | 116 bool drawn, |
| 117 const cc::FrameSinkId& frame_sink_id, |
| 118 const base::Optional<cc::LocalSurfaceId>& local_surface_id) { |
117 frame_sink_id_ = frame_sink_id; | 119 frame_sink_id_ = frame_sink_id; |
118 root_window_id_ = root->window_id; | 120 root_window_id_ = root->window_id; |
119 tree_ = std::move(tree); | 121 tree_ = std::move(tree); |
120 if (!pending_compositor_frame_sink_callback_.is_null()) { | 122 if (!pending_compositor_frame_sink_callback_.is_null()) { |
121 RequestCompositorFrameSinkInternal(std::move(pending_context_provider_), | 123 RequestCompositorFrameSinkInternal(std::move(pending_context_provider_), |
122 pending_gpu_memory_buffer_manager_, | 124 pending_gpu_memory_buffer_manager_, |
123 pending_compositor_frame_sink_callback_); | 125 pending_compositor_frame_sink_callback_); |
124 pending_context_provider_ = nullptr; | 126 pending_context_provider_ = nullptr; |
125 pending_gpu_memory_buffer_manager_ = nullptr; | 127 pending_gpu_memory_buffer_manager_ = nullptr; |
126 pending_compositor_frame_sink_callback_.Reset(); | 128 pending_compositor_frame_sink_callback_.Reset(); |
127 } | 129 } |
| 130 if (local_surface_id) { |
| 131 // TODO(fsamuel): Update the RenderWidgetCompositor's LocalSurfaceId. |
| 132 current_local_surface_id_ = *local_surface_id; |
| 133 } |
128 } | 134 } |
129 | 135 |
130 void RendererWindowTreeClient::OnEmbeddedAppDisconnected(ui::Id window_id) { | 136 void RendererWindowTreeClient::OnEmbeddedAppDisconnected(ui::Id window_id) { |
131 // TODO(sad): Embedded mus-client (oopif) is gone. Figure out what to do. | 137 // TODO(sad): Embedded mus-client (oopif) is gone. Figure out what to do. |
132 } | 138 } |
133 | 139 |
134 void RendererWindowTreeClient::OnUnembed(ui::Id window_id) { | 140 void RendererWindowTreeClient::OnUnembed(ui::Id window_id) { |
135 CHECK_EQ(window_id, root_window_id_); | 141 CHECK_EQ(window_id, root_window_id_); |
136 DestroySelf(); | 142 DestroySelf(); |
137 } | 143 } |
138 | 144 |
139 void RendererWindowTreeClient::OnCaptureChanged(ui::Id new_capture_window_id, | 145 void RendererWindowTreeClient::OnCaptureChanged(ui::Id new_capture_window_id, |
140 ui::Id old_capture_window_id) {} | 146 ui::Id old_capture_window_id) {} |
141 | 147 |
142 void RendererWindowTreeClient::OnFrameSinkIdAllocated( | 148 void RendererWindowTreeClient::OnFrameSinkIdAllocated( |
143 ui::Id window_id, | 149 ui::Id window_id, |
144 const cc::FrameSinkId& frame_sink_id) { | 150 const cc::FrameSinkId& frame_sink_id) { |
145 // TODO(fsamuel): OOPIF's |frame_sink_id| is ready. The OOPIF can now be | 151 // TODO(fsamuel): OOPIF's |frame_sink_id| is ready. The OOPIF can now be |
146 // embedded by the parent. | 152 // embedded by the parent. |
147 } | 153 } |
148 | 154 |
149 void RendererWindowTreeClient::OnTopLevelCreated( | 155 void RendererWindowTreeClient::OnTopLevelCreated( |
150 uint32_t change_id, | 156 uint32_t change_id, |
151 ui::mojom::WindowDataPtr data, | 157 ui::mojom::WindowDataPtr data, |
152 int64_t display_id, | 158 int64_t display_id, |
153 bool drawn, | 159 bool drawn, |
154 const cc::FrameSinkId& frame_sink_id) { | 160 const cc::FrameSinkId& frame_sink_id, |
| 161 const base::Optional<cc::LocalSurfaceId>& local_surface_id) { |
155 NOTREACHED(); | 162 NOTREACHED(); |
156 } | 163 } |
157 | 164 |
158 void RendererWindowTreeClient::OnWindowBoundsChanged( | 165 void RendererWindowTreeClient::OnWindowBoundsChanged( |
159 ui::Id window_id, | 166 ui::Id window_id, |
160 const gfx::Rect& old_bounds, | 167 const gfx::Rect& old_bounds, |
161 const gfx::Rect& new_bounds, | 168 const gfx::Rect& new_bounds, |
162 const base::Optional<cc::LocalSurfaceId>& local_surface_id) { | 169 const base::Optional<cc::LocalSurfaceId>& local_surface_id) { |
163 if (!enable_surface_synchronization_) | 170 if (!enable_surface_synchronization_ || !local_surface_id) |
164 return; | 171 return; |
165 current_local_surface_id_ = *local_surface_id; | 172 current_local_surface_id_ = *local_surface_id; |
166 RenderWidget* widget = GetRenderWidgetFromRoutingId(routing_id_); | 173 RenderWidget* widget = GetRenderWidgetFromRoutingId(routing_id_); |
167 if (!widget) | 174 if (!widget) |
168 return; | 175 return; |
169 // TODO(fsamuel): This isn't quite correct. The resize arrives from the | 176 // TODO(fsamuel): This isn't quite correct. The resize arrives from the |
170 // browser and so it might not synchronize with the LocalSurfaceId. | 177 // browser and so it might not synchronize with the LocalSurfaceId. |
171 widget->compositor()->SetLocalSurfaceId(*local_surface_id); | 178 widget->compositor()->SetLocalSurfaceId(*local_surface_id); |
172 } | 179 } |
173 | 180 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 bool success) {} | 288 bool success) {} |
282 | 289 |
283 void RendererWindowTreeClient::RequestClose(uint32_t window_id) {} | 290 void RendererWindowTreeClient::RequestClose(uint32_t window_id) {} |
284 | 291 |
285 void RendererWindowTreeClient::GetWindowManager( | 292 void RendererWindowTreeClient::GetWindowManager( |
286 mojo::AssociatedInterfaceRequest<ui::mojom::WindowManager> internal) { | 293 mojo::AssociatedInterfaceRequest<ui::mojom::WindowManager> internal) { |
287 NOTREACHED(); | 294 NOTREACHED(); |
288 } | 295 } |
289 | 296 |
290 } // namespace content | 297 } // namespace content |
OLD | NEW |