OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/renderer_host/render_widget_host_impl.h" | 5 #include "content/browser/renderer_host/render_widget_host_impl.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
302 view_weak_.reset(); | 302 view_weak_.reset(); |
303 view_ = view; | 303 view_ = view; |
304 | 304 |
305 // If the renderer has not yet been initialized, then the surface ID | 305 // If the renderer has not yet been initialized, then the surface ID |
306 // namespace will be sent during initialization. | 306 // namespace will be sent during initialization. |
307 if (view_ && renderer_initialized_) { | 307 if (view_ && renderer_initialized_) { |
308 Send(new ViewMsg_SetSurfaceIdNamespace(routing_id_, | 308 Send(new ViewMsg_SetSurfaceIdNamespace(routing_id_, |
309 view_->GetSurfaceIdNamespace())); | 309 view_->GetSurfaceIdNamespace())); |
310 } | 310 } |
311 | 311 |
312 GpuSurfaceTracker::Get()->SetSurfaceHandle( | |
313 surface_id_, GetCompositingSurface()); | |
314 | |
315 synthetic_gesture_controller_.reset(); | 312 synthetic_gesture_controller_.reset(); |
316 } | 313 } |
317 | 314 |
318 RenderProcessHost* RenderWidgetHostImpl::GetProcess() const { | 315 RenderProcessHost* RenderWidgetHostImpl::GetProcess() const { |
319 return process_; | 316 return process_; |
320 } | 317 } |
321 | 318 |
322 int RenderWidgetHostImpl::GetRoutingID() const { | 319 int RenderWidgetHostImpl::GetRoutingID() const { |
323 return routing_id_; | 320 return routing_id_; |
324 } | 321 } |
325 | 322 |
326 RenderWidgetHostView* RenderWidgetHostImpl::GetView() const { | 323 RenderWidgetHostView* RenderWidgetHostImpl::GetView() const { |
327 return view_; | 324 return view_; |
328 } | 325 } |
329 | 326 |
330 RenderWidgetHostImpl* RenderWidgetHostImpl::AsRenderWidgetHostImpl() { | 327 RenderWidgetHostImpl* RenderWidgetHostImpl::AsRenderWidgetHostImpl() { |
331 return this; | 328 return this; |
332 } | 329 } |
333 | 330 |
334 gfx::NativeViewId RenderWidgetHostImpl::GetNativeViewId() const { | 331 gfx::NativeViewId RenderWidgetHostImpl::GetNativeViewId() const { |
335 if (view_) | 332 if (view_) |
336 return view_->GetNativeViewId(); | 333 return view_->GetNativeViewId(); |
337 return 0; | 334 return 0; |
338 } | 335 } |
339 | 336 |
340 gfx::GLSurfaceHandle RenderWidgetHostImpl::GetCompositingSurface() { | |
341 if (view_) | |
342 return view_->GetCompositingSurface(); | |
343 return gfx::GLSurfaceHandle(); | |
344 } | |
345 | |
346 void RenderWidgetHostImpl::ResetSizeAndRepaintPendingFlags() { | 337 void RenderWidgetHostImpl::ResetSizeAndRepaintPendingFlags() { |
347 resize_ack_pending_ = false; | 338 resize_ack_pending_ = false; |
348 if (repaint_ack_pending_) { | 339 if (repaint_ack_pending_) { |
349 TRACE_EVENT_ASYNC_END0( | 340 TRACE_EVENT_ASYNC_END0( |
350 "renderer_host", "RenderWidgetHostImpl::repaint_ack_pending_", this); | 341 "renderer_host", "RenderWidgetHostImpl::repaint_ack_pending_", this); |
351 } | 342 } |
352 repaint_ack_pending_ = false; | 343 repaint_ack_pending_ = false; |
353 if (old_resize_params_) | 344 if (old_resize_params_) |
354 old_resize_params_->new_size = gfx::Size(); | 345 old_resize_params_->new_size = gfx::Size(); |
355 } | 346 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
389 void RenderWidgetHostImpl::SetNeedsFlush() { | 380 void RenderWidgetHostImpl::SetNeedsFlush() { |
390 if (view_) | 381 if (view_) |
391 view_->OnSetNeedsFlushInput(); | 382 view_->OnSetNeedsFlushInput(); |
392 } | 383 } |
393 | 384 |
394 void RenderWidgetHostImpl::Init() { | 385 void RenderWidgetHostImpl::Init() { |
395 DCHECK(process_->HasConnection()); | 386 DCHECK(process_->HasConnection()); |
396 | 387 |
397 renderer_initialized_ = true; | 388 renderer_initialized_ = true; |
398 | 389 |
399 GpuSurfaceTracker::Get()->SetSurfaceHandle( | |
400 surface_id_, GetCompositingSurface()); | |
no sievers
2015/09/23 21:53:21
It looks to me like removing this would possibly a
piman
2015/09/23 23:33:37
Added a TODO and filed a bug. I thought we still r
| |
401 | |
402 // Send the ack along with the information on placement. | 390 // Send the ack along with the information on placement. |
403 Send(new ViewMsg_CreatingNew_ACK(routing_id_)); | 391 Send(new ViewMsg_CreatingNew_ACK(routing_id_)); |
404 GetProcess()->ResumeRequestsForView(routing_id_); | 392 GetProcess()->ResumeRequestsForView(routing_id_); |
405 | 393 |
406 // If the RWHV has not yet been set, the surface ID namespace will get | 394 // If the RWHV has not yet been set, the surface ID namespace will get |
407 // passed down by the call to SetView(). | 395 // passed down by the call to SetView(). |
408 if (view_) { | 396 if (view_) { |
409 Send(new ViewMsg_SetSurfaceIdNamespace(routing_id_, | 397 Send(new ViewMsg_SetSurfaceIdNamespace(routing_id_, |
410 view_->GetSurfaceIdNamespace())); | 398 view_->GetSurfaceIdNamespace())); |
411 } | 399 } |
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1266 if (!is_hidden_) { | 1254 if (!is_hidden_) { |
1267 process_->WidgetHidden(); | 1255 process_->WidgetHidden(); |
1268 is_hidden_ = true; | 1256 is_hidden_ = true; |
1269 } | 1257 } |
1270 | 1258 |
1271 // Reset this to ensure the hung renderer mechanism is working properly. | 1259 // Reset this to ensure the hung renderer mechanism is working properly. |
1272 in_flight_event_count_ = 0; | 1260 in_flight_event_count_ = 0; |
1273 StopHangMonitorTimeout(); | 1261 StopHangMonitorTimeout(); |
1274 | 1262 |
1275 if (view_) { | 1263 if (view_) { |
1276 GpuSurfaceTracker::Get()->SetSurfaceHandle(surface_id_, | |
1277 gfx::GLSurfaceHandle()); | |
1278 view_->RenderProcessGone(status, exit_code); | 1264 view_->RenderProcessGone(status, exit_code); |
1279 view_ = nullptr; // The View should be deleted by RenderProcessGone. | 1265 view_ = nullptr; // The View should be deleted by RenderProcessGone. |
1280 view_weak_.reset(); | 1266 view_weak_.reset(); |
1281 } | 1267 } |
1282 | 1268 |
1283 // Reconstruct the input router to ensure that it has fresh state for a new | 1269 // Reconstruct the input router to ensure that it has fresh state for a new |
1284 // renderer. Otherwise it may be stuck waiting for the old renderer to ack an | 1270 // renderer. Otherwise it may be stuck waiting for the old renderer to ack an |
1285 // event. (In particular, the above call to view_->RenderProcessGone will | 1271 // event. (In particular, the above call to view_->RenderProcessGone will |
1286 // destroy the aura window, which may dispatch a synthetic mouse move.) | 1272 // destroy the aura window, which may dispatch a synthetic mouse move.) |
1287 input_router_.reset(new InputRouterImpl( | 1273 input_router_.reset(new InputRouterImpl( |
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2159 } | 2145 } |
2160 | 2146 |
2161 #if defined(OS_WIN) | 2147 #if defined(OS_WIN) |
2162 gfx::NativeViewAccessible | 2148 gfx::NativeViewAccessible |
2163 RenderWidgetHostImpl::GetParentNativeViewAccessible() { | 2149 RenderWidgetHostImpl::GetParentNativeViewAccessible() { |
2164 return delegate_ ? delegate_->GetParentNativeViewAccessible() : NULL; | 2150 return delegate_ ? delegate_->GetParentNativeViewAccessible() : NULL; |
2165 } | 2151 } |
2166 #endif | 2152 #endif |
2167 | 2153 |
2168 } // namespace content | 2154 } // namespace content |
OLD | NEW |