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

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

Issue 1036243003: PlzNavigate: Improvements to RFHM commit logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updates from CR comments. Created 5 years, 8 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/logging.h" 10 #include "base/logging.h"
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 } 453 }
454 454
455 void RenderFrameHostManager::CommitPendingIfNecessary( 455 void RenderFrameHostManager::CommitPendingIfNecessary(
456 RenderFrameHostImpl* render_frame_host, 456 RenderFrameHostImpl* render_frame_host,
457 bool was_caused_by_user_gesture) { 457 bool was_caused_by_user_gesture) {
458 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 458 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
459 switches::kEnableBrowserSideNavigation)) { 459 switches::kEnableBrowserSideNavigation)) {
460 if (render_frame_host == speculative_render_frame_host_.get()) { 460 if (render_frame_host == speculative_render_frame_host_.get()) {
461 CommitPending(); 461 CommitPending();
462 } else if (render_frame_host == render_frame_host_.get()) { 462 } else if (render_frame_host == render_frame_host_.get()) {
463 // TODO(carlosk): this code doesn't properly handle in-page navigation or 463 DCHECK(!should_reuse_web_ui_ || web_ui_);
464 // interwoven navigation requests. 464 // When the current RenderFrameHost is committing there's still the
465 DCHECK(!speculative_render_frame_host_); 465 // possibility that there is a speculative WebUI to be made active.
466 // But if there's also a speculative RenderFrameHost set it means the
467 // WebUI was not meant for the current one.
clamy 2015/03/31 15:54:10 The last sentence is not true. The speculative web
carlosk 2015/04/01 14:54:07 If both the speculative RFH *and* WebUI are set th
468 // TODO(carlosk): this code might not handle interwoven navigation
469 // requests properly.
470 if (speculative_web_ui_ && !speculative_render_frame_host_) {
471 CommitPending();
472 } else {
473 CleanUpNavigation();
474 }
466 } else { 475 } else {
467 // No one else should be sending us a DidNavigate in this state. 476 // No one else should be sending us a DidNavigate in this state.
468 DCHECK(false); 477 DCHECK(false);
469 } 478 }
470 DCHECK(!speculative_render_frame_host_); 479 DCHECK(!speculative_render_frame_host_);
471 return; 480 return;
472 } 481 }
473 482
474 if (!cross_navigation_pending_) { 483 if (!cross_navigation_pending_) {
475 DCHECK(!pending_render_frame_host_); 484 DCHECK(!pending_render_frame_host_);
(...skipping 1154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1630 if (pending_web_ui_) { 1639 if (pending_web_ui_) {
1631 web_ui_.reset(pending_web_ui_.release()); 1640 web_ui_.reset(pending_web_ui_.release());
1632 } else if (!pending_and_current_web_ui_.get()) { 1641 } else if (!pending_and_current_web_ui_.get()) {
1633 web_ui_.reset(); 1642 web_ui_.reset();
1634 } else { 1643 } else {
1635 DCHECK_EQ(pending_and_current_web_ui_.get(), web_ui_.get()); 1644 DCHECK_EQ(pending_and_current_web_ui_.get(), web_ui_.get());
1636 pending_and_current_web_ui_.reset(); 1645 pending_and_current_web_ui_.reset();
1637 } 1646 }
1638 } else { 1647 } else {
1639 // PlzNavigate 1648 // PlzNavigate
1640 if (!should_reuse_web_ui_) 1649 if (speculative_web_ui_) {
1650 DCHECK(!should_reuse_web_ui_);
1641 web_ui_.reset(speculative_web_ui_.release()); 1651 web_ui_.reset(speculative_web_ui_.release());
1652 } else if (should_reuse_web_ui_) {
1653 DCHECK(web_ui_);
1654 should_reuse_web_ui_ = false;
1655 } else {
1656 web_ui_.reset();
1657 }
1642 DCHECK(!speculative_web_ui_); 1658 DCHECK(!speculative_web_ui_);
clamy 2015/03/31 15:54:10 Could you also add a DCHECK(!should_reuse_web_ui_)
carlosk 2015/04/01 14:54:07 Done.
1643 } 1659 }
1644 1660
1645 // It's possible for the pending_render_frame_host_ to be nullptr when we 1661 // It's possible for the pending_render_frame_host_ to be nullptr when we
1646 // aren't crossing process boundaries. If so, we just needed to handle the Web 1662 // aren't crossing process boundaries. If so, we just needed to handle the Web
1647 // UI committing above and we're done. 1663 // UI committing above and we're done.
1648 if (!pending_render_frame_host_ && !speculative_render_frame_host_) { 1664 if (!pending_render_frame_host_ && !speculative_render_frame_host_) {
1649 if (will_focus_location_bar) 1665 if (will_focus_location_bar)
1650 delegate_->SetFocusToLocationBar(false); 1666 delegate_->SetFocusToLocationBar(false);
1651 return; 1667 return;
1652 } 1668 }
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
2019 void RenderFrameHostManager::DeleteRenderFrameProxyHost( 2035 void RenderFrameHostManager::DeleteRenderFrameProxyHost(
2020 SiteInstance* instance) { 2036 SiteInstance* instance) {
2021 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId()); 2037 RenderFrameProxyHostMap::iterator iter = proxy_hosts_.find(instance->GetId());
2022 if (iter != proxy_hosts_.end()) { 2038 if (iter != proxy_hosts_.end()) {
2023 delete iter->second; 2039 delete iter->second;
2024 proxy_hosts_.erase(iter); 2040 proxy_hosts_.erase(iter);
2025 } 2041 }
2026 } 2042 }
2027 2043
2028 } // namespace content 2044 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698