| 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/web_contents/render_view_host_manager.h" | 5 #include "content/browser/web_contents/render_view_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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 // Run the unload handler of the current page. | 380 // Run the unload handler of the current page. |
| 381 SwapOutOldPage(); | 381 SwapOutOldPage(); |
| 382 } | 382 } |
| 383 | 383 |
| 384 void RenderViewHostManager::SwapOutOldPage() { | 384 void RenderViewHostManager::SwapOutOldPage() { |
| 385 // Should only see this while we have a pending renderer. | 385 // Should only see this while we have a pending renderer. |
| 386 if (!cross_navigation_pending_) | 386 if (!cross_navigation_pending_) |
| 387 return; | 387 return; |
| 388 DCHECK(pending_render_view_host_); | 388 DCHECK(pending_render_view_host_); |
| 389 | 389 |
| 390 // First close any modal dialogs that would prevent us from swapping out. |
| 391 delegate_->CancelModalDialogsForRenderManager(); |
| 392 |
| 390 // Tell the old renderer it is being swapped out. This will fire the unload | 393 // Tell the old renderer it is being swapped out. This will fire the unload |
| 391 // handler (without firing the beforeunload handler a second time). When the | 394 // handler (without firing the beforeunload handler a second time). When the |
| 392 // unload handler finishes and the navigation completes, we will send a | 395 // unload handler finishes and the navigation completes, we will send a |
| 393 // message to the ResourceDispatcherHost, allowing the pending RVH's response | 396 // message to the ResourceDispatcherHost, allowing the pending RVH's response |
| 394 // to resume. | 397 // to resume. |
| 395 render_view_host_->SwapOut(); | 398 render_view_host_->SwapOut(); |
| 396 | 399 |
| 397 // ResourceDispatcherHost has told us to run the onunload handler, which | 400 // ResourceDispatcherHost has told us to run the onunload handler, which |
| 398 // means it is not a download or unsafe page, and we are going to perform the | 401 // means it is not a download or unsafe page, and we are going to perform the |
| 399 // navigation. Thus, we no longer need to remember that the RenderViewHost | 402 // navigation. Thus, we no longer need to remember that the RenderViewHost |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1045 RenderViewHostImpl* RenderViewHostManager::GetSwappedOutRenderViewHost( | 1048 RenderViewHostImpl* RenderViewHostManager::GetSwappedOutRenderViewHost( |
| 1046 SiteInstance* instance) { | 1049 SiteInstance* instance) { |
| 1047 RenderViewHostMap::iterator iter = swapped_out_hosts_.find(instance->GetId()); | 1050 RenderViewHostMap::iterator iter = swapped_out_hosts_.find(instance->GetId()); |
| 1048 if (iter != swapped_out_hosts_.end()) | 1051 if (iter != swapped_out_hosts_.end()) |
| 1049 return iter->second; | 1052 return iter->second; |
| 1050 | 1053 |
| 1051 return NULL; | 1054 return NULL; |
| 1052 } | 1055 } |
| 1053 | 1056 |
| 1054 } // namespace content | 1057 } // namespace content |
| OLD | NEW |