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

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

Issue 213413005: Ensure RenderViewHost is not shut down until a screenshot of the page is taken. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Implementing review feedback. Created 6 years, 9 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 <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 iter != swapped_out_hosts_.end(); 496 iter != swapped_out_hosts_.end();
497 ++iter) { 497 ++iter) {
498 DCHECK_NE(iter->second->GetSiteInstance(), 498 DCHECK_NE(iter->second->GetSiteInstance(),
499 current_frame_host()->GetSiteInstance()); 499 current_frame_host()->GetSiteInstance());
500 iter->second->render_view_host()->DisownOpener(); 500 iter->second->render_view_host()->DisownOpener();
501 } 501 }
502 } 502 }
503 503
504 void RenderFrameHostManager::RendererProcessClosing( 504 void RenderFrameHostManager::RendererProcessClosing(
505 RenderProcessHost* render_process_host) { 505 RenderProcessHost* render_process_host) {
506 // Remove any swapped out RVHs from this process, so that we don't try to 506 // Remove any swapped out RFHs from this process, so that we don't try to
507 // swap them back in while the process is exiting. Start by finding them, 507 // swap them back in while the process is exiting. Start by finding them,
508 // since there could be more than one. 508 // since there could be more than one.
509 std::list<int> ids_to_remove; 509 std::list<int> ids_to_remove;
510 for (RenderFrameHostMap::iterator iter = swapped_out_hosts_.begin(); 510 for (RenderFrameHostMap::iterator iter = swapped_out_hosts_.begin();
511 iter != swapped_out_hosts_.end(); 511 iter != swapped_out_hosts_.end();
512 ++iter) { 512 ++iter) {
513 if (iter->second->GetProcess() == render_process_host) 513 if (iter->second->GetProcess() == render_process_host)
514 ids_to_remove.push_back(iter->first); 514 ids_to_remove.push_back(iter->first);
515 } 515 }
516 516
517 // Now delete them. 517 // Now delete them.
518 while (!ids_to_remove.empty()) { 518 while (!ids_to_remove.empty()) {
519 delete swapped_out_hosts_[ids_to_remove.back()]; 519 RenderFrameHostImpl* rfh = swapped_out_hosts_[ids_to_remove.back()];
520 // The pending RFH may be on the swapped out list if we started to swap it
521 // back in.
522 if (rfh == pending_render_frame_host_.get())
523 CancelPending();
524 else
525 delete swapped_out_hosts_[ids_to_remove.back()];
520 swapped_out_hosts_.erase(ids_to_remove.back()); 526 swapped_out_hosts_.erase(ids_to_remove.back());
521 ids_to_remove.pop_back(); 527 ids_to_remove.pop_back();
522 } 528 }
523 } 529 }
524 530
525 void RenderFrameHostManager::SwapOutOldPage() { 531 void RenderFrameHostManager::SwapOutOldPage() {
526 // Should only see this while we have a pending renderer or transfer. 532 // Should only see this while we have a pending renderer or transfer.
527 CHECK(cross_navigation_pending_ || pending_nav_params_.get()); 533 CHECK(cross_navigation_pending_ || pending_nav_params_.get());
528 534
529 // Tell the renderer to suppress any further modal dialogs so that we can swap 535 // Tell the renderer to suppress any further modal dialogs so that we can swap
(...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 SiteInstance* instance) const { 1469 SiteInstance* instance) const {
1464 RenderFrameHostMap::const_iterator iter = 1470 RenderFrameHostMap::const_iterator iter =
1465 swapped_out_hosts_.find(instance->GetId()); 1471 swapped_out_hosts_.find(instance->GetId());
1466 if (iter != swapped_out_hosts_.end()) 1472 if (iter != swapped_out_hosts_.end())
1467 return iter->second; 1473 return iter->second;
1468 1474
1469 return NULL; 1475 return NULL;
1470 } 1476 }
1471 1477
1472 } // namespace content 1478 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698