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

Unified Diff: content/browser/frame_host/render_frame_host_manager.cc

Issue 1048463004: PlzNavigate: track pending commits (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Now tracking pending commits Created 5 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/frame_host/render_frame_host_manager.cc
diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc
index 29771b2ab65da73c748a60643a0634acce2ec5a2..86ec929606b873d108c635750f63b0177eb29f40 100644
--- a/content/browser/frame_host/render_frame_host_manager.cc
+++ b/content/browser/frame_host/render_frame_host_manager.cc
@@ -63,6 +63,8 @@ RenderFrameHostManager::RenderFrameHostManager(
render_widget_delegate_(render_widget_delegate),
interstitial_page_(nullptr),
should_reuse_web_ui_(false),
+ pending_commit_current_frame_(false),
+ pending_commit_speculative_frame_(false),
weak_factory_(this) {
DCHECK(frame_tree_node_);
}
@@ -458,15 +460,19 @@ void RenderFrameHostManager::CommitPendingIfNecessary(
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableBrowserSideNavigation)) {
if (render_frame_host == speculative_render_frame_host_.get()) {
+ DCHECK(pending_commit_speculative_frame_);
CommitPending();
} else if (render_frame_host == render_frame_host_.get()) {
// TODO(carlosk): this code doesn't properly handle in-page navigation or
// interwoven navigation requests.
+ DCHECK(pending_commit_current_frame_);
Charlie Reis 2015/04/03 06:02:58 This appears to be the only place that pending_com
clamy 2015/04/07 16:29:21 So I ended up moving the state tracking to RenderF
Charlie Reis 2015/04/07 17:04:47 Hmm, ok. It would be nice to not need this in shi
DCHECK(!speculative_render_frame_host_);
} else {
// No one else should be sending us a DidNavigate in this state.
DCHECK(false);
}
+ // The current frame either committed or was swapped out.
+ pending_commit_current_frame_ = false;
Charlie Reis 2015/04/03 06:02:58 What if pending_commit_speculative_frame_ was true
DCHECK(!speculative_render_frame_host_);
return;
}
@@ -731,13 +737,14 @@ void RenderFrameHostManager::BeginNavigation(const NavigationRequest& request) {
// navigations.
CleanUpNavigation();
- RenderFrameHostImpl* dest_rfh = GetFrameHostForNavigation(request);
+ RenderFrameHostImpl* dest_rfh = GetFrameHostForNavigation(request, false);
DCHECK(dest_rfh);
}
// PlzNavigate
RenderFrameHostImpl* RenderFrameHostManager::GetFrameHostForNavigation(
- const NavigationRequest& request) {
+ const NavigationRequest& request,
+ bool is_for_commit) {
CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableBrowserSideNavigation));
@@ -827,7 +834,14 @@ RenderFrameHostImpl* RenderFrameHostManager::GetFrameHostForNavigation(
}
}
- cross_navigation_pending_ = navigation_rfh != render_frame_host_.get();
+ // Register that a commit is pending.
+ if (is_for_commit) {
Charlie Reis 2015/04/03 06:02:58 This is only used at the end of the method and doe
+ if (navigation_rfh == render_frame_host_.get())
+ pending_commit_current_frame_ = true;
+ else
+ pending_commit_speculative_frame_ = true;
+ }
+
return navigation_rfh;
}
@@ -837,6 +851,7 @@ void RenderFrameHostManager::CleanUpNavigation() {
switches::kEnableBrowserSideNavigation));
speculative_web_ui_.reset();
should_reuse_web_ui_ = false;
+ pending_commit_speculative_frame_ = false;
Charlie Reis 2015/04/03 06:02:59 This is where your comment about it being impossib
if (speculative_render_frame_host_)
DiscardUnusedFrame(UnsetSpeculativeRenderFrameHost());
}
@@ -1671,6 +1686,7 @@ void RenderFrameHostManager::CommitPending() {
DCHECK(speculative_render_frame_host_);
old_render_frame_host =
SetRenderFrameHost(speculative_render_frame_host_.Pass());
+ pending_commit_speculative_frame_ = false;
}
cross_navigation_pending_ = false;

Powered by Google App Engine
This is Rietveld 408576698