OLD | NEW |
---|---|
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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
493 iter != swapped_out_hosts_.end(); | 493 iter != swapped_out_hosts_.end(); |
494 ++iter) { | 494 ++iter) { |
495 DCHECK_NE(iter->second->render_view_host()->GetSiteInstance(), | 495 DCHECK_NE(iter->second->render_view_host()->GetSiteInstance(), |
496 current_host()->GetSiteInstance()); | 496 current_host()->GetSiteInstance()); |
497 iter->second->render_view_host()->DisownOpener(); | 497 iter->second->render_view_host()->DisownOpener(); |
498 } | 498 } |
499 } | 499 } |
500 | 500 |
501 void RenderFrameHostManager::RendererProcessClosing( | 501 void RenderFrameHostManager::RendererProcessClosing( |
502 RenderProcessHost* render_process_host) { | 502 RenderProcessHost* render_process_host) { |
503 // Remove any swapped out RVHs from this process, so that we don't try to | 503 // Remove any swapped out RFHs from this process, so that we don't try to |
504 // swap them back in while the process is exiting. Start by finding them, | 504 // swap them back in while the process is exiting. Start by finding them, |
505 // since there could be more than one. | 505 // since there could be more than one. |
506 std::list<int> ids_to_remove; | 506 std::list<int> ids_to_remove; |
507 for (RenderFrameHostMap::iterator iter = swapped_out_hosts_.begin(); | 507 for (RenderFrameHostMap::iterator iter = swapped_out_hosts_.begin(); |
508 iter != swapped_out_hosts_.end(); | 508 iter != swapped_out_hosts_.end(); |
509 ++iter) { | 509 ++iter) { |
510 if (iter->second->GetProcess() == render_process_host) | 510 if (iter->second->GetProcess() == render_process_host) |
511 ids_to_remove.push_back(iter->first); | 511 ids_to_remove.push_back(iter->first); |
512 } | 512 } |
513 | 513 |
514 // Now delete them. | 514 // Now delete them. |
515 while (!ids_to_remove.empty()) { | 515 while (!ids_to_remove.empty()) { |
516 delete swapped_out_hosts_[ids_to_remove.back()]; | 516 RenderFrameHostImpl* rfh = swapped_out_hosts_[ids_to_remove.back()]; |
517 // The pending RFH may be on the swapped out list if we started to swap it | |
518 // back in. | |
519 if (rfh == pending_render_frame_host_.get()) { | |
520 CancelPending(); | |
mfomitchev
2014/03/26 18:59:30
I had to add this code because without it one of t
nasko
2014/03/26 22:48:27
Can you share which test that was?
mfomitchev
2014/03/27 21:51:34
IsolatedAppTest.CrossProcessClientRedirect. At the
| |
521 //pending_render_frame_host_.reset(); | |
nasko
2014/03/26 22:48:27
You don't need a reset here, CancelPending will ta
mfomitchev
2014/03/27 21:51:34
Done.
| |
522 } else { | |
523 delete swapped_out_hosts_[ids_to_remove.back()]; | |
524 } | |
517 swapped_out_hosts_.erase(ids_to_remove.back()); | 525 swapped_out_hosts_.erase(ids_to_remove.back()); |
518 ids_to_remove.pop_back(); | 526 ids_to_remove.pop_back(); |
519 } | 527 } |
520 } | 528 } |
521 | 529 |
522 void RenderFrameHostManager::SwapOutOldPage() { | 530 void RenderFrameHostManager::SwapOutOldPage() { |
523 // Should only see this while we have a pending renderer or transfer. | 531 // Should only see this while we have a pending renderer or transfer. |
524 CHECK(cross_navigation_pending_ || pending_nav_params_.get()); | 532 CHECK(cross_navigation_pending_ || pending_nav_params_.get()); |
525 | 533 |
526 // Tell the renderer to suppress any further modal dialogs so that we can swap | 534 // Tell the renderer to suppress any further modal dialogs so that we can swap |
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1463 SiteInstance* instance) const { | 1471 SiteInstance* instance) const { |
1464 RenderFrameHostMap::const_iterator iter = | 1472 RenderFrameHostMap::const_iterator iter = |
1465 swapped_out_hosts_.find(instance->GetId()); | 1473 swapped_out_hosts_.find(instance->GetId()); |
1466 if (iter != swapped_out_hosts_.end()) | 1474 if (iter != swapped_out_hosts_.end()) |
1467 return iter->second; | 1475 return iter->second; |
1468 | 1476 |
1469 return NULL; | 1477 return NULL; |
1470 } | 1478 } |
1471 | 1479 |
1472 } // namespace content | 1480 } // namespace content |
OLD | NEW |