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

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: 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 1660 matching lines...) Expand 10 before | Expand all | Expand 10 after
1671 params.user_gesture); 1671 params.user_gesture);
1672 } 1672 }
1673 1673
1674 void RenderFrameHostImpl::Stop() { 1674 void RenderFrameHostImpl::Stop() {
1675 Send(new FrameMsg_Stop(routing_id_)); 1675 Send(new FrameMsg_Stop(routing_id_));
1676 } 1676 }
1677 1677
1678 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation) { 1678 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_navigation) {
1679 // TODO(creis): Support beforeunload on subframes. For now just pretend that 1679 // TODO(creis): Support beforeunload on subframes. For now just pretend that
1680 // the handler ran and allowed the navigation to proceed. 1680 // the handler ran and allowed the navigation to proceed.
1681 if (GetParent() || !IsRenderFrameLive()) { 1681 if (!ShouldDispatchBeforeUnload()) {
1682 // We don't have a live renderer, so just skip running beforeunload. 1682 // There's no live renderer or this is a subframe, so just skip running
nasko 2015/06/12 17:22:22 ShouldDispatchBeforeUnload should be clear enough
carlosk 2015/06/15 19:11:54 Done.
1683 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 1683 // BeforeUnload.
nasko 2015/06/12 17:22:22 nit: Keep the capitalization intact (aka no capita
carlosk 2015/06/15 19:11:54 Done.
1684 switches::kEnableBrowserSideNavigation)) { 1684 DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch(
1685 frame_tree_node_->navigator()->OnBeforeUnloadACK( 1685 switches::kEnableBrowserSideNavigation) ||
1686 frame_tree_node_, true); 1686 !for_navigation);
nasko 2015/06/12 17:22:22 !A || !B is the same as !(A && B), but is a bit mo
carlosk 2015/06/15 19:11:54 Done.
1687 } else { 1687 frame_tree_node_->render_manager()->OnBeforeUnloadACK(
1688 frame_tree_node_->render_manager()->OnBeforeUnloadACK( 1688 for_navigation, true, base::TimeTicks::Now());
1689 for_navigation, true, base::TimeTicks::Now());
1690 }
1691 return; 1689 return;
1692 } 1690 }
1693 TRACE_EVENT_ASYNC_BEGIN0( 1691 TRACE_EVENT_ASYNC_BEGIN0(
1694 "navigation", "RenderFrameHostImpl::BeforeUnload", this); 1692 "navigation", "RenderFrameHostImpl::BeforeUnload", this);
1695 1693
1696 // This may be called more than once (if the user clicks the tab close button 1694 // This may be called more than once (if the user clicks the tab close button
1697 // several times, or if she clicks the tab close button then the browser close 1695 // several times, or if she clicks the tab close button then the browser close
1698 // button), and we only send the message once. 1696 // button), and we only send the message once.
1699 if (is_waiting_for_beforeunload_ack_) { 1697 if (is_waiting_for_beforeunload_ack_) {
1700 // Some of our close messages could be for the tab, others for cross-site 1698 // Some of our close messages could be for the tab, others for cross-site
(...skipping 12 matching lines...) Expand all
1713 // Increment the in-flight event count, to ensure that input events won't 1711 // Increment the in-flight event count, to ensure that input events won't
1714 // cancel the timeout timer. 1712 // cancel the timeout timer.
1715 render_view_host_->increment_in_flight_event_count(); 1713 render_view_host_->increment_in_flight_event_count();
1716 render_view_host_->StartHangMonitorTimeout( 1714 render_view_host_->StartHangMonitorTimeout(
1717 TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS)); 1715 TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS));
1718 send_before_unload_start_time_ = base::TimeTicks::Now(); 1716 send_before_unload_start_time_ = base::TimeTicks::Now();
1719 Send(new FrameMsg_BeforeUnload(routing_id_)); 1717 Send(new FrameMsg_BeforeUnload(routing_id_));
1720 } 1718 }
1721 } 1719 }
1722 1720
1721 bool RenderFrameHostImpl::ShouldDispatchBeforeUnload() {
1722 // TODO(creis): Support beforeunload on subframes.
1723 return !GetParent() && IsRenderFrameLive();
1724 }
1725
1723 void RenderFrameHostImpl::DisownOpener() { 1726 void RenderFrameHostImpl::DisownOpener() {
1724 Send(new FrameMsg_DisownOpener(GetRoutingID())); 1727 Send(new FrameMsg_DisownOpener(GetRoutingID()));
1725 } 1728 }
1726 1729
1727 void RenderFrameHostImpl::ExtendSelectionAndDelete(size_t before, 1730 void RenderFrameHostImpl::ExtendSelectionAndDelete(size_t before,
1728 size_t after) { 1731 size_t after) {
1729 Send(new InputMsg_ExtendSelectionAndDelete(routing_id_, before, after)); 1732 Send(new InputMsg_ExtendSelectionAndDelete(routing_id_, before, after));
1730 } 1733 }
1731 1734
1732 void RenderFrameHostImpl::JavaScriptDialogClosed( 1735 void RenderFrameHostImpl::JavaScriptDialogClosed(
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
2068 // We may be returning to an existing NavigationEntry that had been granted 2071 // We may be returning to an existing NavigationEntry that had been granted
2069 // file access. If this is a different process, we will need to grant the 2072 // file access. If this is a different process, we will need to grant the
2070 // access again. The files listed in the page state are validated when they 2073 // access again. The files listed in the page state are validated when they
2071 // are received from the renderer to prevent abuse. 2074 // are received from the renderer to prevent abuse.
2072 if (request_params.page_state.IsValid()) { 2075 if (request_params.page_state.IsValid()) {
2073 render_view_host_->GrantFileAccessFromPageState(request_params.page_state); 2076 render_view_host_->GrantFileAccessFromPageState(request_params.page_state);
2074 } 2077 }
2075 } 2078 }
2076 2079
2077 } // namespace content 2080 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698