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

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

Issue 1163303003: PlzNavigate: Create the speculative renderer earlier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Method renames and comment updates. Created 5 years, 6 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_impl.cc
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index 7fe74daf4470e4eb5fd4f762c087e3152d3e7b54..6707816561d703d406d4a1b15ee6c5b56089c2c1 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -1695,16 +1695,12 @@ void RenderFrameHostImpl::Stop() {
void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation) {
// TODO(creis): Support beforeunload on subframes. For now just pretend that
// the handler ran and allowed the navigation to proceed.
- if (GetParent() || !IsRenderFrameLive()) {
- // We don't have a live renderer, so just skip running beforeunload.
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableBrowserSideNavigation)) {
- frame_tree_node_->navigator()->OnBeforeUnloadACK(
- frame_tree_node_, true);
- } else {
- frame_tree_node_->render_manager()->OnBeforeUnloadACK(
- for_navigation, true, base::TimeTicks::Now());
- }
+ if (!ShouldDispatchBeforeUnload()) {
+ DCHECK(!(base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableBrowserSideNavigation) &&
+ for_navigation));
+ frame_tree_node_->render_manager()->OnBeforeUnloadACK(
+ for_navigation, true, base::TimeTicks::Now());
return;
}
TRACE_EVENT_ASYNC_BEGIN0(
@@ -1737,6 +1733,11 @@ void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation) {
}
}
+bool RenderFrameHostImpl::ShouldDispatchBeforeUnload() {
+ // TODO(creis): Support beforeunload on subframes.
+ return !GetParent() && IsRenderFrameLive();
+}
+
void RenderFrameHostImpl::DisownOpener() {
Send(new FrameMsg_DisownOpener(GetRoutingID()));
}
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | content/browser/frame_host/render_frame_host_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698