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

Side by Side Diff: content/browser/web_contents/render_view_host_manager.cc

Issue 25434002: Don't leave renderer process frozen when canceling JavaScript dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove WebContentsObserver Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « content/browser/web_contents/render_view_host_manager.h ('k') | content/browser/web_contents/web_contents_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698