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

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

Issue 196133032: Add test for filtering of IPC messages when RenderFrameHost is swapped out. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unit tests for cross-site navigation and SwapOut. 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 | Annotate | Revision Log
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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 // Even when there is no pending RVH, there may be a pending Web UI. 461 // Even when there is no pending RVH, there may be a pending Web UI.
462 if (pending_web_ui()) 462 if (pending_web_ui())
463 CommitPending(); 463 CommitPending();
464 return; 464 return;
465 } 465 }
466 466
467 if (render_view_host == pending_render_frame_host_->render_view_host()) { 467 if (render_view_host == pending_render_frame_host_->render_view_host()) {
468 // The pending cross-site navigation completed, so show the renderer. 468 // The pending cross-site navigation completed, so show the renderer.
469 // If it committed without sending network requests (e.g., data URLs), 469 // If it committed without sending network requests (e.g., data URLs),
470 // then we still need to swap out the old RFH first and run its unload 470 // then we still need to swap out the old RFH first and run its unload
471 // handler. OK for that to happen in the background. 471 // handler. OK for that to happen in the background, only if it hasn't
472 // happened yet.
Charlie Reis 2014/03/21 21:35:13 Please move "if it hasn't happened yet" to the end
nasko 2014/03/24 17:48:11 Done.
472 if (pending_render_frame_host_->render_view_host()-> 473 if (pending_render_frame_host_->render_view_host()->
473 HasPendingCrossSiteRequest()) 474 HasPendingCrossSiteRequest() &&
475 pending_render_frame_host_->render_view_host()->rvh_state() !=
476 RenderViewHostImpl::STATE_WAITING_FOR_COMMIT) {
Charlie Reis 2014/03/21 21:35:13 What if it were STATE_WAITING_FOR_UNLOAD_ACK? Tha
nasko 2014/03/24 17:48:11 Done.
474 SwapOutOldPage(); 477 SwapOutOldPage();
478 }
475 479
476 CommitPending(); 480 CommitPending();
477 cross_navigation_pending_ = false; 481 cross_navigation_pending_ = false;
478 } else if (render_view_host == render_frame_host_->render_view_host()) { 482 } else if (render_view_host == render_frame_host_->render_view_host()) {
479 // A navigation in the original page has taken place. Cancel the pending 483 // A navigation in the original page has taken place. Cancel the pending
480 // one. 484 // one.
481 CancelPending(); 485 CancelPending();
482 cross_navigation_pending_ = false; 486 cross_navigation_pending_ = false;
483 } else { 487 } else {
484 // No one else should be sending us DidNavigate in this state. 488 // No one else should be sending us DidNavigate in this state.
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 SiteInstance* instance) const { 1467 SiteInstance* instance) const {
1464 RenderFrameHostMap::const_iterator iter = 1468 RenderFrameHostMap::const_iterator iter =
1465 swapped_out_hosts_.find(instance->GetId()); 1469 swapped_out_hosts_.find(instance->GetId());
1466 if (iter != swapped_out_hosts_.end()) 1470 if (iter != swapped_out_hosts_.end())
1467 return iter->second; 1471 return iter->second;
1468 1472
1469 return NULL; 1473 return NULL;
1470 } 1474 }
1471 1475
1472 } // namespace content 1476 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698