OLD | NEW |
---|---|
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 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
142 case blink::WebTextDirectionRightToLeft: | 142 case blink::WebTextDirectionRightToLeft: |
143 return base::i18n::RIGHT_TO_LEFT; | 143 return base::i18n::RIGHT_TO_LEFT; |
144 default: | 144 default: |
145 NOTREACHED(); | 145 NOTREACHED(); |
146 return base::i18n::UNKNOWN_DIRECTION; | 146 return base::i18n::UNKNOWN_DIRECTION; |
147 } | 147 } |
148 } | 148 } |
149 | 149 |
150 } // namespace | 150 } // namespace |
151 | 151 |
152 // static | |
153 bool RenderFrameHostImpl::IsRFHStateActive(RenderFrameHostImplState rfh_state) { | |
154 return rfh_state == STATE_DEFAULT; | |
155 } | |
156 | |
157 // static | |
152 RenderFrameHost* RenderFrameHost::FromID(int render_process_id, | 158 RenderFrameHost* RenderFrameHost::FromID(int render_process_id, |
153 int render_frame_id) { | 159 int render_frame_id) { |
154 return RenderFrameHostImpl::FromID(render_process_id, render_frame_id); | 160 return RenderFrameHostImpl::FromID(render_process_id, render_frame_id); |
155 } | 161 } |
156 | 162 |
157 // static | 163 // static |
158 RenderFrameHostImpl* RenderFrameHostImpl::FromID(int process_id, | 164 RenderFrameHostImpl* RenderFrameHostImpl::FromID(int process_id, |
159 int routing_id) { | 165 int routing_id) { |
160 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 166 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
161 RoutingIDFrameMap* frames = g_routing_id_frame_map.Pointer(); | 167 RoutingIDFrameMap* frames = g_routing_id_frame_map.Pointer(); |
162 RoutingIDFrameMap::iterator it = frames->find( | 168 RoutingIDFrameMap::iterator it = frames->find( |
163 RenderFrameHostID(process_id, routing_id)); | 169 RenderFrameHostID(process_id, routing_id)); |
164 return it == frames->end() ? NULL : it->second; | 170 return it == frames->end() ? NULL : it->second; |
165 } | 171 } |
166 | 172 |
167 RenderFrameHostImpl::RenderFrameHostImpl(RenderViewHostImpl* render_view_host, | 173 RenderFrameHostImpl::RenderFrameHostImpl(RenderViewHostImpl* render_view_host, |
168 RenderFrameHostDelegate* delegate, | 174 RenderFrameHostDelegate* delegate, |
169 FrameTree* frame_tree, | 175 FrameTree* frame_tree, |
170 FrameTreeNode* frame_tree_node, | 176 FrameTreeNode* frame_tree_node, |
171 int routing_id, | 177 int routing_id, |
172 bool is_swapped_out) | 178 bool is_swapped_out) |
173 : render_view_host_(render_view_host), | 179 : render_view_host_(render_view_host), |
174 delegate_(delegate), | 180 delegate_(delegate), |
175 cross_process_frame_connector_(NULL), | 181 cross_process_frame_connector_(NULL), |
176 render_frame_proxy_host_(NULL), | 182 render_frame_proxy_host_(NULL), |
177 frame_tree_(frame_tree), | 183 frame_tree_(frame_tree), |
178 frame_tree_node_(frame_tree_node), | 184 frame_tree_node_(frame_tree_node), |
179 routing_id_(routing_id), | 185 routing_id_(routing_id), |
180 is_swapped_out_(is_swapped_out), | |
181 render_frame_created_(false), | 186 render_frame_created_(false), |
182 navigations_suspended_(false), | 187 navigations_suspended_(false), |
188 is_waiting_for_beforeunload_ack_(false), | |
189 unload_ack_is_for_cross_site_transition_(false), | |
183 weak_ptr_factory_(this) { | 190 weak_ptr_factory_(this) { |
184 frame_tree_->RegisterRenderFrameHost(this); | 191 frame_tree_->RegisterRenderFrameHost(this); |
185 GetProcess()->AddRoute(routing_id_, this); | 192 GetProcess()->AddRoute(routing_id_, this); |
186 g_routing_id_frame_map.Get().insert(std::make_pair( | 193 g_routing_id_frame_map.Get().insert(std::make_pair( |
187 RenderFrameHostID(GetProcess()->GetID(), routing_id_), | 194 RenderFrameHostID(GetProcess()->GetID(), routing_id_), |
188 this)); | 195 this)); |
189 | 196 |
197 if (is_swapped_out) { | |
198 rfh_state_ = STATE_SWAPPED_OUT; | |
199 } else { | |
200 rfh_state_ = STATE_DEFAULT; | |
201 GetSiteInstance()->increment_active_frame_count(); | |
202 } | |
203 | |
190 if (GetProcess()->GetServiceRegistry()) { | 204 if (GetProcess()->GetServiceRegistry()) { |
191 RenderFrameSetupPtr setup; | 205 RenderFrameSetupPtr setup; |
192 GetProcess()->GetServiceRegistry()->ConnectToRemoteService(&setup); | 206 GetProcess()->GetServiceRegistry()->ConnectToRemoteService(&setup); |
193 mojo::ServiceProviderPtr service_provider; | 207 mojo::ServiceProviderPtr service_provider; |
194 setup->GetServiceProviderForFrame(routing_id_, | 208 setup->GetServiceProviderForFrame(routing_id_, |
195 mojo::Get(&service_provider)); | 209 mojo::Get(&service_provider)); |
196 service_registry_.BindRemoteServiceProvider( | 210 service_registry_.BindRemoteServiceProvider( |
197 service_provider.PassMessagePipe()); | 211 service_provider.PassMessagePipe()); |
198 } | 212 } |
213 | |
214 swapout_event_monitor_timeout_.reset(new TimeoutMonitor(base::Bind( | |
215 &RenderFrameHostImpl::OnSwappedOut, weak_ptr_factory_.GetWeakPtr()))); | |
199 } | 216 } |
200 | 217 |
201 RenderFrameHostImpl::~RenderFrameHostImpl() { | 218 RenderFrameHostImpl::~RenderFrameHostImpl() { |
202 GetProcess()->RemoveRoute(routing_id_); | 219 GetProcess()->RemoveRoute(routing_id_); |
203 g_routing_id_frame_map.Get().erase( | 220 g_routing_id_frame_map.Get().erase( |
204 RenderFrameHostID(GetProcess()->GetID(), routing_id_)); | 221 RenderFrameHostID(GetProcess()->GetID(), routing_id_)); |
205 | 222 |
206 if (delegate_) | 223 if (delegate_) |
207 delegate_->RenderFrameDeleted(this); | 224 delegate_->RenderFrameDeleted(this); |
208 | 225 |
209 FrameAccessibility::GetInstance()->OnRenderFrameHostDestroyed(this); | 226 FrameAccessibility::GetInstance()->OnRenderFrameHostDestroyed(this); |
210 | 227 |
228 // If this was swapped out, it already decremented the active frame count of | |
229 // the SiteInstance it belongs to. | |
230 if (IsRFHStateActive(rfh_state_)) | |
231 GetSiteInstance()->decrement_active_frame_count(); | |
232 | |
211 // Notify the FrameTree that this RFH is going away, allowing it to shut down | 233 // Notify the FrameTree that this RFH is going away, allowing it to shut down |
212 // the corresponding RenderViewHost if it is no longer needed. | 234 // the corresponding RenderViewHost if it is no longer needed. |
213 frame_tree_->UnregisterRenderFrameHost(this); | 235 frame_tree_->UnregisterRenderFrameHost(this); |
214 } | 236 } |
215 | 237 |
216 int RenderFrameHostImpl::GetRoutingID() { | 238 int RenderFrameHostImpl::GetRoutingID() { |
217 return routing_id_; | 239 return routing_id_; |
218 } | 240 } |
219 | 241 |
220 SiteInstance* RenderFrameHostImpl::GetSiteInstance() { | 242 SiteInstanceImpl* RenderFrameHostImpl::GetSiteInstance() { |
221 return render_view_host_->GetSiteInstance(); | 243 return render_view_host_->GetSiteInstance(); |
222 } | 244 } |
223 | 245 |
224 RenderProcessHost* RenderFrameHostImpl::GetProcess() { | 246 RenderProcessHost* RenderFrameHostImpl::GetProcess() { |
225 // TODO(nasko): This should return its own process, once we have working | 247 // TODO(nasko): This should return its own process, once we have working |
226 // cross-process navigation for subframes. | 248 // cross-process navigation for subframes. |
227 return render_view_host_->GetProcess(); | 249 return render_view_host_->GetProcess(); |
228 } | 250 } |
229 | 251 |
230 RenderFrameHost* RenderFrameHostImpl::GetParent() { | 252 RenderFrameHost* RenderFrameHostImpl::GetParent() { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
293 | 315 |
294 bool RenderFrameHostImpl::Send(IPC::Message* message) { | 316 bool RenderFrameHostImpl::Send(IPC::Message* message) { |
295 if (IPC_MESSAGE_ID_CLASS(message->type()) == InputMsgStart) { | 317 if (IPC_MESSAGE_ID_CLASS(message->type()) == InputMsgStart) { |
296 return render_view_host_->input_router()->SendInput( | 318 return render_view_host_->input_router()->SendInput( |
297 make_scoped_ptr(message)); | 319 make_scoped_ptr(message)); |
298 } | 320 } |
299 | 321 |
300 // Route IPCs through the RenderFrameProxyHost when in swapped out state. | 322 // Route IPCs through the RenderFrameProxyHost when in swapped out state. |
301 // Note: For subframes in --site-per-process mode, we don't use swapped out | 323 // Note: For subframes in --site-per-process mode, we don't use swapped out |
302 // RenderFrameHosts. | 324 // RenderFrameHosts. |
303 if (frame_tree_node_->IsMainFrame() && render_view_host_->IsSwappedOut()) { | 325 if (frame_tree_node_->IsMainFrame() && is_swapped_out()) { |
304 DCHECK(render_frame_proxy_host_); | 326 DCHECK(render_frame_proxy_host_); |
305 return render_frame_proxy_host_->Send(message); | 327 return render_frame_proxy_host_->Send(message); |
306 } | 328 } |
307 | 329 |
308 return GetProcess()->Send(message); | 330 return GetProcess()->Send(message); |
309 } | 331 } |
310 | 332 |
311 bool RenderFrameHostImpl::OnMessageReceived(const IPC::Message &msg) { | 333 bool RenderFrameHostImpl::OnMessageReceived(const IPC::Message &msg) { |
312 // Filter out most IPC messages if this renderer is swapped out. | 334 // Filter out most IPC messages if this frame is swapped out. |
313 // We still want to handle certain ACKs to keep our state consistent. | 335 // We still want to handle certain ACKs to keep our state consistent. |
314 // TODO(nasko): Only check RenderViewHost state, as this object's own state | 336 // TODO(nasko): Only check RenderViewHost state, as this object's own state |
nasko
2014/09/29 20:28:09
Shouldn't this TODO be removed? We don't check RVH
Charlie Reis
2014/09/29 20:49:21
Yep!
| |
315 // isn't yet properly updated. Transition this check once the swapped out | 337 // isn't yet properly updated. Transition this check once the swapped out |
316 // state is correct in RenderFrameHost itself. | 338 // state is correct in RenderFrameHost itself. |
317 if (render_view_host_->IsSwappedOut()) { | 339 if (is_swapped_out()) { |
318 if (!SwappedOutMessages::CanHandleWhileSwappedOut(msg)) { | 340 if (!SwappedOutMessages::CanHandleWhileSwappedOut(msg)) { |
319 // If this is a synchronous message and we decided not to handle it, | 341 // If this is a synchronous message and we decided not to handle it, |
320 // we must send an error reply, or else the renderer will be stuck | 342 // we must send an error reply, or else the renderer will be stuck |
321 // and won't respond to future requests. | 343 // and won't respond to future requests. |
322 if (msg.is_sync()) { | 344 if (msg.is_sync()) { |
323 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg); | 345 IPC::Message* reply = IPC::SyncMessage::GenerateReply(&msg); |
324 reply->set_reply_error(); | 346 reply->set_reply_error(); |
325 Send(reply); | 347 Send(reply); |
326 } | 348 } |
327 // Don't continue looking for someone to handle it. | 349 // Don't continue looking for someone to handle it. |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
662 return; | 684 return; |
663 TRACE_EVENT1("navigation", "RenderFrameHostImpl::OnDidCommitProvisionalLoad", | 685 TRACE_EVENT1("navigation", "RenderFrameHostImpl::OnDidCommitProvisionalLoad", |
664 "url", validated_params.url.possibly_invalid_spec()); | 686 "url", validated_params.url.possibly_invalid_spec()); |
665 | 687 |
666 // If we're waiting for a cross-site beforeunload ack from this renderer and | 688 // If we're waiting for a cross-site beforeunload ack from this renderer and |
667 // we receive a Navigate message from the main frame, then the renderer was | 689 // we receive a Navigate message from the main frame, then the renderer was |
668 // navigating already and sent it before hearing the FrameMsg_Stop message. | 690 // navigating already and sent it before hearing the FrameMsg_Stop message. |
669 // We do not want to cancel the pending navigation in this case, since the | 691 // We do not want to cancel the pending navigation in this case, since the |
670 // old page will soon be stopped. Instead, treat this as a beforeunload ack | 692 // old page will soon be stopped. Instead, treat this as a beforeunload ack |
671 // to allow the pending navigation to continue. | 693 // to allow the pending navigation to continue. |
672 if (render_view_host_->is_waiting_for_beforeunload_ack_ && | 694 if (is_waiting_for_beforeunload_ack_ && |
673 render_view_host_->unload_ack_is_for_cross_site_transition_ && | 695 unload_ack_is_for_cross_site_transition_ && |
674 ui::PageTransitionIsMainFrame(validated_params.transition)) { | 696 ui::PageTransitionIsMainFrame(validated_params.transition)) { |
675 OnBeforeUnloadACK(true, send_before_unload_start_time_, | 697 OnBeforeUnloadACK(true, send_before_unload_start_time_, |
676 base::TimeTicks::Now()); | 698 base::TimeTicks::Now()); |
677 return; | 699 return; |
678 } | 700 } |
679 | 701 |
680 // If we're waiting for an unload ack from this renderer and we receive a | 702 // If we're waiting for an unload ack from this renderer and we receive a |
681 // Navigate message, then the renderer was navigating before it received the | 703 // Navigate message, then the renderer was navigating before it received the |
682 // unload request. It will either respond to the unload request soon or our | 704 // unload request. It will either respond to the unload request soon or our |
683 // timer will expire. Either way, we should ignore this message, because we | 705 // timer will expire. Either way, we should ignore this message, because we |
684 // have already committed to closing this renderer. | 706 // have already committed to closing this renderer. |
685 if (render_view_host_->IsWaitingForUnloadACK()) | 707 if (IsWaitingForUnloadACK()) |
686 return; | 708 return; |
687 | 709 |
688 RenderProcessHost* process = GetProcess(); | 710 RenderProcessHost* process = GetProcess(); |
689 | 711 |
690 // Attempts to commit certain off-limits URL should be caught more strictly | 712 // Attempts to commit certain off-limits URL should be caught more strictly |
691 // than our FilterURL checks below. If a renderer violates this policy, it | 713 // than our FilterURL checks below. If a renderer violates this policy, it |
692 // should be killed. | 714 // should be killed. |
693 if (!CanCommitURL(validated_params.url)) { | 715 if (!CanCommitURL(validated_params.url)) { |
694 VLOG(1) << "Blocked URL " << validated_params.url.spec(); | 716 VLOG(1) << "Blocked URL " << validated_params.url.spec(); |
695 validated_params.url = GURL(url::kAboutBlankURL); | 717 validated_params.url = GURL(url::kAboutBlankURL); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
757 delegate_->DidDeferAfterResponseStarted(transition_data); | 779 delegate_->DidDeferAfterResponseStarted(transition_data); |
758 } | 780 } |
759 | 781 |
760 void RenderFrameHostImpl::SwapOut(RenderFrameProxyHost* proxy) { | 782 void RenderFrameHostImpl::SwapOut(RenderFrameProxyHost* proxy) { |
761 // The end of this event is in OnSwapOutACK when the RenderFrame has completed | 783 // The end of this event is in OnSwapOutACK when the RenderFrame has completed |
762 // the operation and sends back an IPC message. | 784 // the operation and sends back an IPC message. |
763 // The trace event may not end properly if the ACK times out. We expect this | 785 // The trace event may not end properly if the ACK times out. We expect this |
764 // to be fixed when RenderViewHostImpl::OnSwapOut moves to RenderFrameHost. | 786 // to be fixed when RenderViewHostImpl::OnSwapOut moves to RenderFrameHost. |
765 TRACE_EVENT_ASYNC_BEGIN0("navigation", "RenderFrameHostImpl::SwapOut", this); | 787 TRACE_EVENT_ASYNC_BEGIN0("navigation", "RenderFrameHostImpl::SwapOut", this); |
766 | 788 |
767 // TODO(creis): Move swapped out state to RFH. Until then, only update it | 789 // If this RenderFrameHost is not in the default state, it must have already |
768 // when swapping out the main frame. | 790 // gone through this, therefore just return. |
769 if (!GetParent()) { | 791 if (rfh_state_ != RenderFrameHostImpl::STATE_DEFAULT) |
770 // If this RenderViewHost is not in the default state, it must have already | 792 return; |
771 // gone through this, therefore just return. | |
772 if (render_view_host_->rvh_state_ != RenderViewHostImpl::STATE_DEFAULT) | |
773 return; | |
774 | 793 |
775 render_view_host_->SetState( | 794 SetState(RenderFrameHostImpl::STATE_PENDING_SWAP_OUT); |
776 RenderViewHostImpl::STATE_PENDING_SWAP_OUT); | 795 swapout_event_monitor_timeout_->Start( |
777 render_view_host_->unload_event_monitor_timeout_->Start( | 796 base::TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS)); |
778 base::TimeDelta::FromMilliseconds( | |
779 RenderViewHostImpl::kUnloadTimeoutMS)); | |
780 } | |
781 | 797 |
782 set_render_frame_proxy_host(proxy); | 798 set_render_frame_proxy_host(proxy); |
783 | 799 |
784 if (IsRenderFrameLive()) | 800 if (IsRenderFrameLive()) |
785 Send(new FrameMsg_SwapOut(routing_id_, proxy->GetRoutingID())); | 801 Send(new FrameMsg_SwapOut(routing_id_, proxy->GetRoutingID())); |
786 | 802 |
787 if (!GetParent()) | 803 if (!GetParent()) |
788 delegate_->SwappedOut(this); | 804 delegate_->SwappedOut(this); |
789 else | |
790 set_swapped_out(true); | |
791 } | 805 } |
792 | 806 |
793 void RenderFrameHostImpl::OnBeforeUnloadACK( | 807 void RenderFrameHostImpl::OnBeforeUnloadACK( |
794 bool proceed, | 808 bool proceed, |
795 const base::TimeTicks& renderer_before_unload_start_time, | 809 const base::TimeTicks& renderer_before_unload_start_time, |
796 const base::TimeTicks& renderer_before_unload_end_time) { | 810 const base::TimeTicks& renderer_before_unload_end_time) { |
797 TRACE_EVENT_ASYNC_END0( | 811 TRACE_EVENT_ASYNC_END0( |
798 "navigation", "RenderFrameHostImpl::BeforeUnload", this); | 812 "navigation", "RenderFrameHostImpl::BeforeUnload", this); |
799 // TODO(creis): Support properly beforeunload on subframes. For now just | 813 // TODO(creis): Support beforeunload on subframes. For now just pretend that |
800 // pretend that the handler ran and allowed the navigation to proceed. | 814 // the handler ran and allowed the navigation to proceed. |
801 if (GetParent()) { | 815 if (GetParent()) { |
802 render_view_host_->is_waiting_for_beforeunload_ack_ = false; | 816 is_waiting_for_beforeunload_ack_ = false; |
803 frame_tree_node_->render_manager()->OnBeforeUnloadACK( | 817 frame_tree_node_->render_manager()->OnBeforeUnloadACK( |
804 render_view_host_->unload_ack_is_for_cross_site_transition_, proceed, | 818 unload_ack_is_for_cross_site_transition_, proceed, |
805 renderer_before_unload_end_time); | 819 renderer_before_unload_end_time); |
806 return; | 820 return; |
807 } | 821 } |
808 | 822 |
809 render_view_host_->decrement_in_flight_event_count(); | 823 render_view_host_->decrement_in_flight_event_count(); |
810 render_view_host_->StopHangMonitorTimeout(); | 824 render_view_host_->StopHangMonitorTimeout(); |
811 // If this renderer navigated while the beforeunload request was in flight, we | 825 // If this renderer navigated while the beforeunload request was in flight, we |
812 // may have cleared this state in OnDidCommitProvisionalLoad, in which case we | 826 // may have cleared this state in OnDidCommitProvisionalLoad, in which case we |
813 // can ignore this message. | 827 // can ignore this message. |
814 // However renderer might also be swapped out but we still want to proceed | 828 // However renderer might also be swapped out but we still want to proceed |
815 // with navigation, otherwise it would block future navigations. This can | 829 // with navigation, otherwise it would block future navigations. This can |
816 // happen when pending cross-site navigation is canceled by a second one just | 830 // happen when pending cross-site navigation is canceled by a second one just |
817 // before OnDidCommitProvisionalLoad while current RVH is waiting for commit | 831 // before OnDidCommitProvisionalLoad while current RVH is waiting for commit |
818 // but second navigation is started from the beginning. | 832 // but second navigation is started from the beginning. |
819 if (!render_view_host_->is_waiting_for_beforeunload_ack_) { | 833 if (!is_waiting_for_beforeunload_ack_) { |
820 return; | 834 return; |
821 } | 835 } |
822 | 836 |
823 render_view_host_->is_waiting_for_beforeunload_ack_ = false; | 837 is_waiting_for_beforeunload_ack_ = false; |
824 | 838 |
825 base::TimeTicks before_unload_end_time; | 839 base::TimeTicks before_unload_end_time; |
826 if (!send_before_unload_start_time_.is_null() && | 840 if (!send_before_unload_start_time_.is_null() && |
827 !renderer_before_unload_start_time.is_null() && | 841 !renderer_before_unload_start_time.is_null() && |
828 !renderer_before_unload_end_time.is_null()) { | 842 !renderer_before_unload_end_time.is_null()) { |
829 // When passing TimeTicks across process boundaries, we need to compensate | 843 // When passing TimeTicks across process boundaries, we need to compensate |
830 // for any skew between the processes. Here we are converting the | 844 // for any skew between the processes. Here we are converting the |
831 // renderer's notion of before_unload_end_time to TimeTicks in the browser | 845 // renderer's notion of before_unload_end_time to TimeTicks in the browser |
832 // process. See comments in inter_process_time_ticks_converter.h for more. | 846 // process. See comments in inter_process_time_ticks_converter.h for more. |
833 InterProcessTimeTicksConverter converter( | 847 InterProcessTimeTicksConverter converter( |
(...skipping 17 matching lines...) Expand all Loading... | |
851 } else { | 865 } else { |
852 UMA_HISTOGRAM_TIMES( | 866 UMA_HISTOGRAM_TIMES( |
853 "InterProcessTimeTicks.BrowserAhead_RendererToBrowser", -skew); | 867 "InterProcessTimeTicks.BrowserAhead_RendererToBrowser", -skew); |
854 } | 868 } |
855 } | 869 } |
856 UMA_HISTOGRAM_BOOLEAN( | 870 UMA_HISTOGRAM_BOOLEAN( |
857 "InterProcessTimeTicks.IsSkewAdditive_RendererToBrowser", | 871 "InterProcessTimeTicks.IsSkewAdditive_RendererToBrowser", |
858 is_skew_additive); | 872 is_skew_additive); |
859 } | 873 } |
860 frame_tree_node_->render_manager()->OnBeforeUnloadACK( | 874 frame_tree_node_->render_manager()->OnBeforeUnloadACK( |
861 render_view_host_->unload_ack_is_for_cross_site_transition_, proceed, | 875 unload_ack_is_for_cross_site_transition_, proceed, |
862 before_unload_end_time); | 876 before_unload_end_time); |
863 | 877 |
864 // If canceled, notify the delegate to cancel its pending navigation entry. | 878 // If canceled, notify the delegate to cancel its pending navigation entry. |
865 if (!proceed) | 879 if (!proceed) |
866 render_view_host_->GetDelegate()->DidCancelLoading(); | 880 render_view_host_->GetDelegate()->DidCancelLoading(); |
867 } | 881 } |
868 | 882 |
869 void RenderFrameHostImpl::OnSwapOutACK() { | 883 bool RenderFrameHostImpl::IsWaitingForUnloadACK() const { |
870 OnSwappedOut(false); | 884 return render_view_host_->is_waiting_for_close_ack_ || |
871 TRACE_EVENT_ASYNC_END0("navigation", "RenderFrameHostImpl::SwapOut", this); | 885 rfh_state_ == STATE_PENDING_SHUTDOWN || |
886 rfh_state_ == STATE_PENDING_SWAP_OUT; | |
872 } | 887 } |
873 | 888 |
874 void RenderFrameHostImpl::OnSwappedOut(bool timed_out) { | 889 void RenderFrameHostImpl::OnSwapOutACK() { |
875 // For now, we only need to update the RVH state machine for top-level swaps. | 890 OnSwappedOut(); |
876 if (!GetParent()) | 891 } |
877 render_view_host_->OnSwappedOut(timed_out); | 892 |
893 void RenderFrameHostImpl::OnSwappedOut() { | |
894 // Ignore spurious swap out ack. | |
895 if (rfh_state_ != STATE_PENDING_SWAP_OUT && | |
896 rfh_state_ != STATE_PENDING_SHUTDOWN) | |
897 return; | |
898 | |
899 TRACE_EVENT_ASYNC_END0("navigation", "RenderFrameHostImpl::SwapOut", this); | |
900 swapout_event_monitor_timeout_->Stop(); | |
901 | |
902 switch (rfh_state_) { | |
903 case STATE_PENDING_SWAP_OUT: | |
904 SetState(STATE_SWAPPED_OUT); | |
905 break; | |
906 case STATE_PENDING_SHUTDOWN: | |
907 DCHECK(!pending_shutdown_on_swap_out_.is_null()); | |
908 pending_shutdown_on_swap_out_.Run(); | |
909 break; | |
910 default: | |
911 NOTREACHED(); | |
912 } | |
878 } | 913 } |
879 | 914 |
880 void RenderFrameHostImpl::OnContextMenu(const ContextMenuParams& params) { | 915 void RenderFrameHostImpl::OnContextMenu(const ContextMenuParams& params) { |
881 // Validate the URLs in |params|. If the renderer can't request the URLs | 916 // Validate the URLs in |params|. If the renderer can't request the URLs |
882 // directly, don't show them in the context menu. | 917 // directly, don't show them in the context menu. |
883 ContextMenuParams validated_params(params); | 918 ContextMenuParams validated_params(params); |
884 RenderProcessHost* process = GetProcess(); | 919 RenderProcessHost* process = GetProcess(); |
885 | 920 |
886 // We don't validate |unfiltered_link_url| so that this field can be used | 921 // We don't validate |unfiltered_link_url| so that this field can be used |
887 // when users want to copy the original link URL. | 922 // when users want to copy the original link URL. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
924 render_view_host_->StopHangMonitorTimeout(); | 959 render_view_host_->StopHangMonitorTimeout(); |
925 delegate_->RunJavaScriptMessage(this, message, default_prompt, | 960 delegate_->RunJavaScriptMessage(this, message, default_prompt, |
926 frame_url, type, reply_msg); | 961 frame_url, type, reply_msg); |
927 } | 962 } |
928 | 963 |
929 void RenderFrameHostImpl::OnRunBeforeUnloadConfirm( | 964 void RenderFrameHostImpl::OnRunBeforeUnloadConfirm( |
930 const GURL& frame_url, | 965 const GURL& frame_url, |
931 const base::string16& message, | 966 const base::string16& message, |
932 bool is_reload, | 967 bool is_reload, |
933 IPC::Message* reply_msg) { | 968 IPC::Message* reply_msg) { |
934 // While a JS before unload dialog is showing, tabs in the same process | 969 // While a JS beforeunload dialog is showing, tabs in the same process |
935 // shouldn't process input events. | 970 // shouldn't process input events. |
936 GetProcess()->SetIgnoreInputEvents(true); | 971 GetProcess()->SetIgnoreInputEvents(true); |
937 render_view_host_->StopHangMonitorTimeout(); | 972 render_view_host_->StopHangMonitorTimeout(); |
938 delegate_->RunBeforeUnloadConfirm(this, message, is_reload, reply_msg); | 973 delegate_->RunBeforeUnloadConfirm(this, message, is_reload, reply_msg); |
939 } | 974 } |
940 | 975 |
941 void RenderFrameHostImpl::OnRequestPlatformNotificationPermission( | 976 void RenderFrameHostImpl::OnRequestPlatformNotificationPermission( |
942 const GURL& origin, int request_id) { | 977 const GURL& origin, int request_id) { |
943 base::Callback<void(blink::WebNotificationPermission)> done_callback = | 978 base::Callback<void(blink::WebNotificationPermission)> done_callback = |
944 base::Bind( | 979 base::Bind( |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1027 frame_tree_node()->render_manager()->OnBeginNavigation(params); | 1062 frame_tree_node()->render_manager()->OnBeginNavigation(params); |
1028 } | 1063 } |
1029 | 1064 |
1030 void RenderFrameHostImpl::OnAccessibilityEvents( | 1065 void RenderFrameHostImpl::OnAccessibilityEvents( |
1031 const std::vector<AccessibilityHostMsg_EventParams>& params) { | 1066 const std::vector<AccessibilityHostMsg_EventParams>& params) { |
1032 RenderWidgetHostViewBase* view = static_cast<RenderWidgetHostViewBase*>( | 1067 RenderWidgetHostViewBase* view = static_cast<RenderWidgetHostViewBase*>( |
1033 render_view_host_->GetView()); | 1068 render_view_host_->GetView()); |
1034 | 1069 |
1035 AccessibilityMode accessibility_mode = delegate_->GetAccessibilityMode(); | 1070 AccessibilityMode accessibility_mode = delegate_->GetAccessibilityMode(); |
1036 if ((accessibility_mode != AccessibilityModeOff) && view && | 1071 if ((accessibility_mode != AccessibilityModeOff) && view && |
1037 RenderViewHostImpl::IsRVHStateActive(render_view_host_->rvh_state())) { | 1072 RenderFrameHostImpl::IsRFHStateActive(rfh_state())) { |
1038 if (accessibility_mode & AccessibilityModeFlagPlatform) { | 1073 if (accessibility_mode & AccessibilityModeFlagPlatform) { |
1039 GetOrCreateBrowserAccessibilityManager(); | 1074 GetOrCreateBrowserAccessibilityManager(); |
1040 if (browser_accessibility_manager_) | 1075 if (browser_accessibility_manager_) |
1041 browser_accessibility_manager_->OnAccessibilityEvents(params); | 1076 browser_accessibility_manager_->OnAccessibilityEvents(params); |
1042 } | 1077 } |
1043 | 1078 |
1044 if (browser_accessibility_manager_) { | 1079 if (browser_accessibility_manager_) { |
1045 // Get the frame routing ids from out-of-process iframes and | 1080 // Get the frame routing ids from out-of-process iframes and |
1046 // browser plugin instance ids from guests and update the mappings in | 1081 // browser plugin instance ids from guests and update the mappings in |
1047 // FrameAccessibility. | 1082 // FrameAccessibility. |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1098 << ax_tree_for_testing_->error(); | 1133 << ax_tree_for_testing_->error(); |
1099 } | 1134 } |
1100 accessibility_testing_callback_.Run(param.event_type, param.id); | 1135 accessibility_testing_callback_.Run(param.event_type, param.id); |
1101 } | 1136 } |
1102 } | 1137 } |
1103 | 1138 |
1104 void RenderFrameHostImpl::OnAccessibilityLocationChanges( | 1139 void RenderFrameHostImpl::OnAccessibilityLocationChanges( |
1105 const std::vector<AccessibilityHostMsg_LocationChangeParams>& params) { | 1140 const std::vector<AccessibilityHostMsg_LocationChangeParams>& params) { |
1106 RenderWidgetHostViewBase* view = static_cast<RenderWidgetHostViewBase*>( | 1141 RenderWidgetHostViewBase* view = static_cast<RenderWidgetHostViewBase*>( |
1107 render_view_host_->GetView()); | 1142 render_view_host_->GetView()); |
1108 if (view && | 1143 if (view && RenderFrameHostImpl::IsRFHStateActive(rfh_state())) { |
1109 RenderViewHostImpl::IsRVHStateActive(render_view_host_->rvh_state())) { | |
1110 AccessibilityMode accessibility_mode = delegate_->GetAccessibilityMode(); | 1144 AccessibilityMode accessibility_mode = delegate_->GetAccessibilityMode(); |
1111 if (accessibility_mode & AccessibilityModeFlagPlatform) { | 1145 if (accessibility_mode & AccessibilityModeFlagPlatform) { |
1112 if (!browser_accessibility_manager_) { | 1146 if (!browser_accessibility_manager_) { |
1113 browser_accessibility_manager_.reset( | 1147 browser_accessibility_manager_.reset( |
1114 view->CreateBrowserAccessibilityManager(this)); | 1148 view->CreateBrowserAccessibilityManager(this)); |
1115 } | 1149 } |
1116 if (browser_accessibility_manager_) | 1150 if (browser_accessibility_manager_) |
1117 browser_accessibility_manager_->OnLocationChanges(params); | 1151 browser_accessibility_manager_->OnLocationChanges(params); |
1118 } | 1152 } |
1119 // TODO(aboxhall): send location change events to web contents observers too | 1153 // TODO(aboxhall): send location change events to web contents observers too |
(...skipping 18 matching lines...) Expand all Loading... | |
1138 } | 1172 } |
1139 | 1173 |
1140 void RenderFrameHostImpl::OnHidePopup() { | 1174 void RenderFrameHostImpl::OnHidePopup() { |
1141 RenderViewHostDelegateView* view = | 1175 RenderViewHostDelegateView* view = |
1142 render_view_host_->delegate_->GetDelegateView(); | 1176 render_view_host_->delegate_->GetDelegateView(); |
1143 if (view) | 1177 if (view) |
1144 view->HidePopupMenu(); | 1178 view->HidePopupMenu(); |
1145 } | 1179 } |
1146 #endif | 1180 #endif |
1147 | 1181 |
1182 void RenderFrameHostImpl::SetState(RenderFrameHostImplState rfh_state) { | |
1183 // We update the number of RenderFrameHosts in a SiteInstance when the swapped | |
1184 // out status of a RenderFrameHost gets flipped to/from active. | |
1185 if (!IsRFHStateActive(rfh_state_) && IsRFHStateActive(rfh_state)) | |
1186 GetSiteInstance()->increment_active_frame_count(); | |
1187 else if (IsRFHStateActive(rfh_state_) && !IsRFHStateActive(rfh_state)) | |
1188 GetSiteInstance()->decrement_active_frame_count(); | |
1189 | |
1190 // The active and swapped out state of the RVH is determined by its main | |
1191 // frame, since subframes should have their own widgets. | |
1192 if (frame_tree_node_->IsMainFrame()) { | |
1193 render_view_host_->set_is_active(IsRFHStateActive(rfh_state)); | |
1194 render_view_host_->set_is_swapped_out(rfh_state == STATE_SWAPPED_OUT); | |
1195 } | |
1196 | |
1197 // Whenever we change the RFH state to and from live or swapped out state, we | |
nasko
2014/09/29 20:28:09
nit: you changed "live" to "active" in the first c
Charlie Reis
2014/09/29 20:49:21
Done.
| |
1198 // should not be waiting for beforeunload or close acks. We clear them here | |
1199 // to be safe, since they can cause navigations to be ignored in OnNavigate. | |
nasko
2014/09/29 20:28:09
nit: s/OnNavigate/OnDidCommitProvisionalLoad/
Charlie Reis
2014/09/29 20:49:21
Done.
| |
1200 // TODO(creis): Move is_waiting_for_beforeunload_ack_ into the state machine. | |
1201 if (rfh_state == STATE_DEFAULT || | |
1202 rfh_state == STATE_SWAPPED_OUT || | |
1203 rfh_state_ == STATE_DEFAULT || | |
1204 rfh_state_ == STATE_SWAPPED_OUT) { | |
1205 is_waiting_for_beforeunload_ack_ = false; | |
1206 render_view_host_->is_waiting_for_close_ack_ = false; | |
1207 } | |
1208 rfh_state_ = rfh_state; | |
1209 } | |
1210 | |
1148 void RenderFrameHostImpl::SetPendingShutdown(const base::Closure& on_swap_out) { | 1211 void RenderFrameHostImpl::SetPendingShutdown(const base::Closure& on_swap_out) { |
1149 render_view_host_->SetPendingShutdown(on_swap_out); | 1212 pending_shutdown_on_swap_out_ = on_swap_out; |
1213 SetState(STATE_PENDING_SHUTDOWN); | |
1150 } | 1214 } |
1151 | 1215 |
1152 bool RenderFrameHostImpl::CanCommitURL(const GURL& url) { | 1216 bool RenderFrameHostImpl::CanCommitURL(const GURL& url) { |
1153 // TODO(creis): We should also check for WebUI pages here. Also, when the | 1217 // TODO(creis): We should also check for WebUI pages here. Also, when the |
1154 // out-of-process iframes implementation is ready, we should check for | 1218 // out-of-process iframes implementation is ready, we should check for |
1155 // cross-site URLs that are not allowed to commit in this process. | 1219 // cross-site URLs that are not allowed to commit in this process. |
1156 | 1220 |
1157 // Give the client a chance to disallow URLs from committing. | 1221 // Give the client a chance to disallow URLs from committing. |
1158 return GetContentClient()->browser()->CanCommitURL(GetProcess(), url); | 1222 return GetContentClient()->browser()->CanCommitURL(GetProcess(), url); |
1159 } | 1223 } |
(...skipping 18 matching lines...) Expand all Loading... | |
1178 // request. | 1242 // request. |
1179 if (navigations_suspended_) { | 1243 if (navigations_suspended_) { |
1180 // Shouldn't be possible to have a second navigation while suspended, since | 1244 // Shouldn't be possible to have a second navigation while suspended, since |
1181 // navigations will only be suspended during a cross-site request. If a | 1245 // navigations will only be suspended during a cross-site request. If a |
1182 // second navigation occurs, RenderFrameHostManager will cancel this pending | 1246 // second navigation occurs, RenderFrameHostManager will cancel this pending |
1183 // RFH and create a new pending RFH. | 1247 // RFH and create a new pending RFH. |
1184 DCHECK(!suspended_nav_params_.get()); | 1248 DCHECK(!suspended_nav_params_.get()); |
1185 suspended_nav_params_.reset(new FrameMsg_Navigate_Params(params)); | 1249 suspended_nav_params_.reset(new FrameMsg_Navigate_Params(params)); |
1186 } else { | 1250 } else { |
1187 // Get back to a clean state, in case we start a new navigation without | 1251 // Get back to a clean state, in case we start a new navigation without |
1188 // completing a RVH swap or unload handler. | 1252 // completing a RFH swap or unload handler. |
1189 render_view_host_->SetState(RenderViewHostImpl::STATE_DEFAULT); | 1253 SetState(RenderFrameHostImpl::STATE_DEFAULT); |
1190 | 1254 |
1191 Send(new FrameMsg_Navigate(routing_id_, params)); | 1255 Send(new FrameMsg_Navigate(routing_id_, params)); |
1192 } | 1256 } |
1193 | 1257 |
1194 // Force the throbber to start. We do this because Blink's "started | 1258 // Force the throbber to start. We do this because Blink's "started |
1195 // loading" message will be received asynchronously from the UI of the | 1259 // loading" message will be received asynchronously from the UI of the |
1196 // browser. But we want to keep the throbber in sync with what's happening | 1260 // browser. But we want to keep the throbber in sync with what's happening |
1197 // in the UI. For example, we want to start throbbing immediately when the | 1261 // in the UI. For example, we want to start throbbing immediately when the |
1198 // user naivgates even if the renderer is delayed. There is also an issue | 1262 // user naivgates even if the renderer is delayed. There is also an issue |
1199 // with the throbber starting because the WebUI (which controls whether the | 1263 // with the throbber starting because the WebUI (which controls whether the |
(...skipping 22 matching lines...) Expand all Loading... | |
1222 void RenderFrameHostImpl::Stop() { | 1286 void RenderFrameHostImpl::Stop() { |
1223 Send(new FrameMsg_Stop(routing_id_)); | 1287 Send(new FrameMsg_Stop(routing_id_)); |
1224 } | 1288 } |
1225 | 1289 |
1226 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_cross_site_transition) { | 1290 void RenderFrameHostImpl::DispatchBeforeUnload(bool for_cross_site_transition) { |
1227 TRACE_EVENT_ASYNC_BEGIN0( | 1291 TRACE_EVENT_ASYNC_BEGIN0( |
1228 "navigation", "RenderFrameHostImpl::BeforeUnload", this); | 1292 "navigation", "RenderFrameHostImpl::BeforeUnload", this); |
1229 // TODO(creis): Support subframes. | 1293 // TODO(creis): Support subframes. |
1230 if (GetParent() || !IsRenderFrameLive()) { | 1294 if (GetParent() || !IsRenderFrameLive()) { |
1231 // We don't have a live renderer, so just skip running beforeunload. | 1295 // We don't have a live renderer, so just skip running beforeunload. |
1232 render_view_host_->is_waiting_for_beforeunload_ack_ = true; | 1296 is_waiting_for_beforeunload_ack_ = true; |
1233 render_view_host_->unload_ack_is_for_cross_site_transition_ = | 1297 unload_ack_is_for_cross_site_transition_ = for_cross_site_transition; |
1234 for_cross_site_transition; | |
1235 base::TimeTicks now = base::TimeTicks::Now(); | 1298 base::TimeTicks now = base::TimeTicks::Now(); |
1236 OnBeforeUnloadACK(true, now, now); | 1299 OnBeforeUnloadACK(true, now, now); |
1237 return; | 1300 return; |
1238 } | 1301 } |
1239 | 1302 |
1240 // This may be called more than once (if the user clicks the tab close button | 1303 // This may be called more than once (if the user clicks the tab close button |
1241 // several times, or if she clicks the tab close button then the browser close | 1304 // several times, or if she clicks the tab close button then the browser close |
1242 // button), and we only send the message once. | 1305 // button), and we only send the message once. |
1243 if (render_view_host_->is_waiting_for_beforeunload_ack_) { | 1306 if (is_waiting_for_beforeunload_ack_) { |
1244 // Some of our close messages could be for the tab, others for cross-site | 1307 // Some of our close messages could be for the tab, others for cross-site |
1245 // transitions. We always want to think it's for closing the tab if any | 1308 // transitions. We always want to think it's for closing the tab if any |
1246 // of the messages were, since otherwise it might be impossible to close | 1309 // of the messages were, since otherwise it might be impossible to close |
1247 // (if there was a cross-site "close" request pending when the user clicked | 1310 // (if there was a cross-site "close" request pending when the user clicked |
1248 // the close button). We want to keep the "for cross site" flag only if | 1311 // the close button). We want to keep the "for cross site" flag only if |
1249 // both the old and the new ones are also for cross site. | 1312 // both the old and the new ones are also for cross site. |
1250 render_view_host_->unload_ack_is_for_cross_site_transition_ = | 1313 unload_ack_is_for_cross_site_transition_ = |
1251 render_view_host_->unload_ack_is_for_cross_site_transition_ && | 1314 unload_ack_is_for_cross_site_transition_ && for_cross_site_transition; |
1252 for_cross_site_transition; | |
1253 } else { | 1315 } else { |
1254 // Start the hang monitor in case the renderer hangs in the beforeunload | 1316 // Start the hang monitor in case the renderer hangs in the beforeunload |
1255 // handler. | 1317 // handler. |
1256 render_view_host_->is_waiting_for_beforeunload_ack_ = true; | 1318 is_waiting_for_beforeunload_ack_ = true; |
1257 render_view_host_->unload_ack_is_for_cross_site_transition_ = | 1319 unload_ack_is_for_cross_site_transition_ = for_cross_site_transition; |
1258 for_cross_site_transition; | |
1259 // Increment the in-flight event count, to ensure that input events won't | 1320 // Increment the in-flight event count, to ensure that input events won't |
1260 // cancel the timeout timer. | 1321 // cancel the timeout timer. |
1261 render_view_host_->increment_in_flight_event_count(); | 1322 render_view_host_->increment_in_flight_event_count(); |
1262 render_view_host_->StartHangMonitorTimeout( | 1323 render_view_host_->StartHangMonitorTimeout( |
1263 TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS)); | 1324 TimeDelta::FromMilliseconds(RenderViewHostImpl::kUnloadTimeoutMS)); |
1264 send_before_unload_start_time_ = base::TimeTicks::Now(); | 1325 send_before_unload_start_time_ = base::TimeTicks::Now(); |
1265 Send(new FrameMsg_BeforeUnload(routing_id_)); | 1326 Send(new FrameMsg_BeforeUnload(routing_id_)); |
1266 } | 1327 } |
1267 } | 1328 } |
1268 | 1329 |
1269 void RenderFrameHostImpl::DisownOpener() { | 1330 void RenderFrameHostImpl::DisownOpener() { |
1270 Send(new FrameMsg_DisownOpener(GetRoutingID())); | 1331 Send(new FrameMsg_DisownOpener(GetRoutingID())); |
1271 } | 1332 } |
1272 | 1333 |
1273 void RenderFrameHostImpl::ExtendSelectionAndDelete(size_t before, | 1334 void RenderFrameHostImpl::ExtendSelectionAndDelete(size_t before, |
1274 size_t after) { | 1335 size_t after) { |
1275 Send(new InputMsg_ExtendSelectionAndDelete(routing_id_, before, after)); | 1336 Send(new InputMsg_ExtendSelectionAndDelete(routing_id_, before, after)); |
1276 } | 1337 } |
1277 | 1338 |
1278 void RenderFrameHostImpl::JavaScriptDialogClosed( | 1339 void RenderFrameHostImpl::JavaScriptDialogClosed( |
1279 IPC::Message* reply_msg, | 1340 IPC::Message* reply_msg, |
1280 bool success, | 1341 bool success, |
1281 const base::string16& user_input, | 1342 const base::string16& user_input, |
1282 bool dialog_was_suppressed) { | 1343 bool dialog_was_suppressed) { |
1283 GetProcess()->SetIgnoreInputEvents(false); | 1344 GetProcess()->SetIgnoreInputEvents(false); |
1284 bool is_waiting = render_view_host_->is_waiting_for_beforeunload_ack() || | 1345 bool is_waiting = is_waiting_for_beforeunload_ack_ || IsWaitingForUnloadACK(); |
1285 render_view_host_->IsWaitingForUnloadACK(); | |
1286 | 1346 |
1287 // If we are executing as part of (before)unload event handling, we don't | 1347 // If we are executing as part of (before)unload event handling, we don't |
1288 // want to use the regular hung_renderer_delay_ms_ if the user has agreed to | 1348 // want to use the regular hung_renderer_delay_ms_ if the user has agreed to |
1289 // leave the current page. In this case, use the regular timeout value used | 1349 // leave the current page. In this case, use the regular timeout value used |
1290 // during the (before)unload handling. | 1350 // during the (before)unload handling. |
1291 if (is_waiting) { | 1351 if (is_waiting) { |
1292 render_view_host_->StartHangMonitorTimeout(TimeDelta::FromMilliseconds( | 1352 render_view_host_->StartHangMonitorTimeout(TimeDelta::FromMilliseconds( |
1293 success ? RenderViewHostImpl::kUnloadTimeoutMS | 1353 success ? RenderViewHostImpl::kUnloadTimeoutMS |
1294 : render_view_host_->hung_renderer_delay_ms_)); | 1354 : render_view_host_->hung_renderer_delay_ms_)); |
1295 } | 1355 } |
1296 | 1356 |
1297 FrameHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg, | 1357 FrameHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg, |
1298 success, user_input); | 1358 success, user_input); |
1299 Send(reply_msg); | 1359 Send(reply_msg); |
1300 | 1360 |
1301 // If we are waiting for an unload or beforeunload ack and the user has | 1361 // If we are waiting for an unload or beforeunload ack and the user has |
1302 // suppressed messages, kill the tab immediately; a page that's spamming | 1362 // suppressed messages, kill the tab immediately; a page that's spamming |
1303 // alerts in onbeforeunload is presumably malicious, so there's no point in | 1363 // alerts in onbeforeunload is presumably malicious, so there's no point in |
1304 // continuing to run its script and dragging out the process. | 1364 // continuing to run its script and dragging out the process. |
1305 // This must be done after sending the reply since RenderView can't close | 1365 // This must be done after sending the reply since RenderView can't close |
1306 // correctly while waiting for a response. | 1366 // correctly while waiting for a response. |
1307 if (is_waiting && dialog_was_suppressed) | 1367 if (is_waiting && dialog_was_suppressed) |
1308 render_view_host_->delegate_->RendererUnresponsive( | 1368 render_view_host_->delegate_->RendererUnresponsive(render_view_host_); |
1309 render_view_host_, | |
1310 render_view_host_->is_waiting_for_beforeunload_ack(), | |
1311 render_view_host_->IsWaitingForUnloadACK()); | |
1312 } | 1369 } |
1313 | 1370 |
1314 void RenderFrameHostImpl::NotificationClosed(int notification_id) { | 1371 void RenderFrameHostImpl::NotificationClosed(int notification_id) { |
1315 cancel_notification_callbacks_.erase(notification_id); | 1372 cancel_notification_callbacks_.erase(notification_id); |
1316 } | 1373 } |
1317 | 1374 |
1318 void RenderFrameHostImpl::PlatformNotificationPermissionRequestDone( | 1375 void RenderFrameHostImpl::PlatformNotificationPermissionRequestDone( |
1319 int request_id, blink::WebNotificationPermission permission) { | 1376 int request_id, blink::WebNotificationPermission permission) { |
1320 Send(new PlatformNotificationMsg_PermissionRequestComplete( | 1377 Send(new PlatformNotificationMsg_PermissionRequestComplete( |
1321 routing_id_, request_id, permission)); | 1378 routing_id_, request_id, permission)); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1444 "RenderFrameHostImpl navigation suspended", this); | 1501 "RenderFrameHostImpl navigation suspended", this); |
1445 } else { | 1502 } else { |
1446 TRACE_EVENT_ASYNC_END0("navigation", | 1503 TRACE_EVENT_ASYNC_END0("navigation", |
1447 "RenderFrameHostImpl navigation suspended", this); | 1504 "RenderFrameHostImpl navigation suspended", this); |
1448 } | 1505 } |
1449 | 1506 |
1450 if (!suspend && suspended_nav_params_) { | 1507 if (!suspend && suspended_nav_params_) { |
1451 // There's navigation message params waiting to be sent. Now that we're not | 1508 // There's navigation message params waiting to be sent. Now that we're not |
1452 // suspended anymore, resume navigation by sending them. If we were swapped | 1509 // suspended anymore, resume navigation by sending them. If we were swapped |
1453 // out, we should also stop filtering out the IPC messages now. | 1510 // out, we should also stop filtering out the IPC messages now. |
1454 render_view_host_->SetState(RenderViewHostImpl::STATE_DEFAULT); | 1511 SetState(RenderFrameHostImpl::STATE_DEFAULT); |
1455 | 1512 |
1456 DCHECK(!proceed_time.is_null()); | 1513 DCHECK(!proceed_time.is_null()); |
1457 suspended_nav_params_->browser_navigation_start = proceed_time; | 1514 suspended_nav_params_->browser_navigation_start = proceed_time; |
1458 Send(new FrameMsg_Navigate(routing_id_, *suspended_nav_params_)); | 1515 Send(new FrameMsg_Navigate(routing_id_, *suspended_nav_params_)); |
1459 suspended_nav_params_.reset(); | 1516 suspended_nav_params_.reset(); |
1460 } | 1517 } |
1461 } | 1518 } |
1462 | 1519 |
1463 void RenderFrameHostImpl::CancelSuspendedNavigations() { | 1520 void RenderFrameHostImpl::CancelSuspendedNavigations() { |
1464 // Clear any state if a pending navigation is canceled or preempted. | 1521 // Clear any state if a pending navigation is canceled or preempted. |
1465 if (suspended_nav_params_) | 1522 if (suspended_nav_params_) |
1466 suspended_nav_params_.reset(); | 1523 suspended_nav_params_.reset(); |
1467 | 1524 |
1468 TRACE_EVENT_ASYNC_END0("navigation", | 1525 TRACE_EVENT_ASYNC_END0("navigation", |
1469 "RenderFrameHostImpl navigation suspended", this); | 1526 "RenderFrameHostImpl navigation suspended", this); |
1470 navigations_suspended_ = false; | 1527 navigations_suspended_ = false; |
1471 } | 1528 } |
1472 | 1529 |
1473 } // namespace content | 1530 } // namespace content |
OLD | NEW |