Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(441)

Side by Side Diff: content/browser/frame_host/render_frame_host_manager.cc

Issue 1308623003: Assume crashed RenderWidgetHost to be invisible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Apply the change to all platforms Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/frame_host/render_frame_host_manager.h" 5 #include "content/browser/frame_host/render_frame_host_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 if (dest_render_frame_host != render_frame_host_ && 398 if (dest_render_frame_host != render_frame_host_ &&
399 !render_frame_host_->IsRenderFrameLive()) { 399 !render_frame_host_->IsRenderFrameLive()) {
400 // Note: we don't call InitRenderView here because we are navigating away 400 // Note: we don't call InitRenderView here because we are navigating away
401 // soon anyway, and we don't have the NavigationEntry for this host. 401 // soon anyway, and we don't have the NavigationEntry for this host.
402 delegate_->CreateRenderViewForRenderManager( 402 delegate_->CreateRenderViewForRenderManager(
403 render_frame_host_->render_view_host(), MSG_ROUTING_NONE, 403 render_frame_host_->render_view_host(), MSG_ROUTING_NONE,
404 MSG_ROUTING_NONE, frame_tree_node_->current_replication_state(), 404 MSG_ROUTING_NONE, frame_tree_node_->current_replication_state(),
405 frame_tree_node_->IsMainFrame()); 405 frame_tree_node_->IsMainFrame());
406 } 406 }
407 407
408 // If the renderer crashed, then try to create a new one to satisfy this 408 // If the renderer isn't live, then try to create a new one to satisfy this
409 // navigation request. 409 // navigation request.
410 if (!dest_render_frame_host->IsRenderFrameLive()) { 410 if (!dest_render_frame_host->IsRenderFrameLive()) {
411 // Instruct the destination render frame host to set up a Mojo connection 411 // Instruct the destination render frame host to set up a Mojo connection
412 // with the new render frame if necessary. Note that this call needs to 412 // with the new render frame if necessary. Note that this call needs to
413 // occur before initializing the RenderView; the flow of creating the 413 // occur before initializing the RenderView; the flow of creating the
414 // RenderView can cause browser-side code to execute that expects the this 414 // RenderView can cause browser-side code to execute that expects the this
415 // RFH's ServiceRegistry to be initialized (e.g., if the site is a WebUI 415 // RFH's ServiceRegistry to be initialized (e.g., if the site is a WebUI
416 // site that is handled via Mojo, then Mojo WebUI code in //chrome will 416 // site that is handled via Mojo, then Mojo WebUI code in //chrome will
417 // add a service to this RFH's ServiceRegistry). 417 // add a service to this RFH's ServiceRegistry).
418 dest_render_frame_host->SetUpMojoIfNeeded(); 418 dest_render_frame_host->SetUpMojoIfNeeded();
419 419
420 // Recreate the opener chain. 420 // Recreate the opener chain.
421 CreateOpenerProxies(dest_render_frame_host->GetSiteInstance(), 421 CreateOpenerProxies(dest_render_frame_host->GetSiteInstance(),
422 frame_tree_node_); 422 frame_tree_node_);
423 if (!InitRenderView(dest_render_frame_host->render_view_host(), 423 if (!InitRenderView(dest_render_frame_host->render_view_host(),
424 MSG_ROUTING_NONE, 424 MSG_ROUTING_NONE,
425 frame_tree_node_->IsMainFrame())) 425 frame_tree_node_->IsMainFrame()))
426 return nullptr; 426 return nullptr;
427 427
428 // Now that we've created a new renderer, be sure to hide it if it isn't 428 // Now that we've created a new renderer, be sure to hide it if it isn't
429 // our primary one. Otherwise, we might crash if we try to call Show() 429 // our primary one. Otherwise, we might crash if we try to call Show()
430 // on it later. 430 // on it later.
431 if (dest_render_frame_host != render_frame_host_) { 431 if (dest_render_frame_host != render_frame_host_) {
432 if (dest_render_frame_host->GetView()) 432 if (dest_render_frame_host->GetView())
433 dest_render_frame_host->GetView()->Hide(); 433 dest_render_frame_host->GetView()->Hide();
434 } else { 434 } else {
435 if (dest_render_frame_host->GetView() &&
no sievers 2015/09/08 19:56:34 Can you put a comment saying that after a renderer
Jaekyun Seok (inactive) 2015/09/08 23:03:55 Done.
436 dest_render_frame_host->GetView()->IsShowing() ==
437 delegate_->IsHidden()) {
438 if (delegate_->IsHidden()) {
439 dest_render_frame_host->GetView()->Hide();
440 } else {
441 dest_render_frame_host->GetView()->Show();
442 }
443 }
444
435 // TODO(nasko): This is a very ugly hack. The Chrome extensions process 445 // TODO(nasko): This is a very ugly hack. The Chrome extensions process
436 // manager still uses NotificationService and expects to see a 446 // manager still uses NotificationService and expects to see a
437 // RenderViewHost changed notification after WebContents and 447 // RenderViewHost changed notification after WebContents and
438 // RenderFrameHostManager are completely initialized. This should be 448 // RenderFrameHostManager are completely initialized. This should be
439 // removed once the process manager moves away from NotificationService. 449 // removed once the process manager moves away from NotificationService.
440 // See https://crbug.com/462682. 450 // See https://crbug.com/462682.
441 delegate_->NotifyMainFrameSwappedFromRenderManager( 451 delegate_->NotifyMainFrameSwappedFromRenderManager(
442 nullptr, render_frame_host_->render_view_host()); 452 nullptr, render_frame_host_->render_view_host());
443 } 453 }
444 } 454 }
(...skipping 2130 matching lines...) Expand 10 before | Expand all | Expand 10 after
2575 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) { 2585 int RenderFrameHostManager::GetOpenerRoutingID(SiteInstance* instance) {
2576 if (!frame_tree_node_->opener()) 2586 if (!frame_tree_node_->opener())
2577 return MSG_ROUTING_NONE; 2587 return MSG_ROUTING_NONE;
2578 2588
2579 return frame_tree_node_->opener() 2589 return frame_tree_node_->opener()
2580 ->render_manager() 2590 ->render_manager()
2581 ->GetRoutingIdForSiteInstance(instance); 2591 ->GetRoutingIdForSiteInstance(instance);
2582 } 2592 }
2583 2593
2584 } // namespace content 2594 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698