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

Side by Side 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 unified diff | Download patch
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_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 1677 matching lines...) Expand 10 before | Expand all | Expand 10 after
1688 params.user_gesture); 1688 params.user_gesture);
1689 } 1689 }
1690 1690
1691 void RenderFrameHostImpl::Stop() { 1691 void RenderFrameHostImpl::Stop() {
1692 Send(new FrameMsg_Stop(routing_id_)); 1692 Send(new FrameMsg_Stop(routing_id_));
1693 } 1693 }
1694 1694
1695 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation) { 1695 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation) {
1696 // TODO(creis): Support beforeunload on subframes. For now just pretend that 1696 // TODO(creis): Support beforeunload on subframes. For now just pretend that
1697 // the handler ran and allowed the navigation to proceed. 1697 // the handler ran and allowed the navigation to proceed.
1698 if (GetParent() || !IsRenderFrameLive()) { 1698 if (!ShouldDispatchBeforeUnload()) {
1699 // We don't have a live renderer, so just skip running beforeunload. 1699 DCHECK(!(base::CommandLine::ForCurrentProcess()->HasSwitch(
1700 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1700 switches::kEnableBrowserSideNavigation) &&
1701 switches::kEnableBrowserSideNavigation)) { 1701 for_navigation));
1702 frame_tree_node_->navigator()->OnBeforeUnloadACK( 1702 frame_tree_node_->render_manager()->OnBeforeUnloadACK(
1703 frame_tree_node_, true); 1703 for_navigation, true, base::TimeTicks::Now());
1704 } else {
1705 frame_tree_node_->render_manager()->OnBeforeUnloadACK(
1706 for_navigation, true, base::TimeTicks::Now());
1707 }
1708 return; 1704 return;
1709 } 1705 }
1710 TRACE_EVENT_ASYNC_BEGIN0( 1706 TRACE_EVENT_ASYNC_BEGIN0(
1711 "navigation", "RenderFrameHostImpl::BeforeUnload", this); 1707 "navigation", "RenderFrameHostImpl::BeforeUnload", this);
1712 1708
1713 // This may be called more than once (if the user clicks the tab close button 1709 // This may be called more than once (if the user clicks the tab close button
1714 // several times, or if she clicks the tab close button then the browser close 1710 // several times, or if she clicks the tab close button then the browser close
1715 // button), and we only send the message once. 1711 // button), and we only send the message once.
1716 if (is_waiting_for_beforeunload_ack_) { 1712 if (is_waiting_for_beforeunload_ack_) {
1717 // Some of our close messages could be for the tab, others for cross-site 1713 // Some of our close messages could be for the tab, others for cross-site
(...skipping 12 matching lines...) Expand all
1730 // Increment the in-flight event count, to ensure that input events won't 1726 // Increment the in-flight event count, to ensure that input events won't
1731 // cancel the timeout timer. 1727 // cancel the timeout timer.
1732 render_view_host_->increment_in_flight_event_count(); 1728 render_view_host_->increment_in_flight_event_count();
1733 render_view_host_->StartHangMonitorTimeout( 1729 render_view_host_->StartHangMonitorTimeout(
1734 TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS)); 1730 TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS));
1735 send_before_unload_start_time_ = base::TimeTicks::Now(); 1731 send_before_unload_start_time_ = base::TimeTicks::Now();
1736 Send(new FrameMsg_BeforeUnload(routing_id_)); 1732 Send(new FrameMsg_BeforeUnload(routing_id_));
1737 } 1733 }
1738 } 1734 }
1739 1735
1736 bool RenderFrameHostImpl::ShouldDispatchBeforeUnload() {
1737 // TODO(creis): Support beforeunload on subframes.
1738 return !GetParent() && IsRenderFrameLive();
1739 }
1740
1740 void RenderFrameHostImpl::DisownOpener() { 1741 void RenderFrameHostImpl::DisownOpener() {
1741 Send(new FrameMsg_DisownOpener(GetRoutingID())); 1742 Send(new FrameMsg_DisownOpener(GetRoutingID()));
1742 } 1743 }
1743 1744
1744 void RenderFrameHostImpl::ExtendSelectionAndDelete(size_t before, 1745 void RenderFrameHostImpl::ExtendSelectionAndDelete(size_t before,
1745 size_t after) { 1746 size_t after) {
1746 Send(new InputMsg_ExtendSelectionAndDelete(routing_id_, before, after)); 1747 Send(new InputMsg_ExtendSelectionAndDelete(routing_id_, before, after));
1747 } 1748 }
1748 1749
1749 void RenderFrameHostImpl::JavaScriptDialogClosed( 1750 void RenderFrameHostImpl::JavaScriptDialogClosed(
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
2085 // We may be returning to an existing NavigationEntry that had been granted 2086 // We may be returning to an existing NavigationEntry that had been granted
2086 // file access. If this is a different process, we will need to grant the 2087 // file access. If this is a different process, we will need to grant the
2087 // access again. The files listed in the page state are validated when they 2088 // access again. The files listed in the page state are validated when they
2088 // are received from the renderer to prevent abuse. 2089 // are received from the renderer to prevent abuse.
2089 if (request_params.page_state.IsValid()) { 2090 if (request_params.page_state.IsValid()) {
2090 render_view_host_->GrantFileAccessFromPageState(request_params.page_state); 2091 render_view_host_->GrantFileAccessFromPageState(request_params.page_state);
2091 } 2092 }
2092 } 2093 }
2093 2094
2094 } // namespace content 2095 } // namespace content
OLDNEW
« 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