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/containers/hash_tables.h" | 7 #include "base/containers/hash_tables.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/metrics/user_metrics_action.h" | 9 #include "base/metrics/user_metrics_action.h" |
10 #include "content/browser/child_process_security_policy_impl.h" | 10 #include "content/browser/child_process_security_policy_impl.h" |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
514 this, global_request_id, cross_site_transferring_request.Pass(), | 514 this, global_request_id, cross_site_transferring_request.Pass(), |
515 transfer_url_chain, referrer, page_transition, | 515 transfer_url_chain, referrer, page_transition, |
516 should_replace_current_entry); | 516 should_replace_current_entry); |
517 } | 517 } |
518 | 518 |
519 void RenderFrameHostImpl::SwapOut() { | 519 void RenderFrameHostImpl::SwapOut() { |
520 // TODO(creis): Move swapped out state to RFH. Until then, only update it | 520 // TODO(creis): Move swapped out state to RFH. Until then, only update it |
521 // when swapping out the main frame. | 521 // when swapping out the main frame. |
522 if (!GetParent()) { | 522 if (!GetParent()) { |
523 // If this RenderViewHost is not in the default state, it must have already | 523 // If this RenderViewHost is not in the default state, it must have already |
524 // gone through this, therefore just return. | 524 // gone through this, therefore return but proceed with the navigation. |
525 if (render_view_host_->rvh_state_ != RenderViewHostImpl::STATE_DEFAULT) | 525 if (render_view_host_->rvh_state_ != RenderViewHostImpl::STATE_DEFAULT) { |
526 frame_tree_node_->render_manager()->SwappedOut(this); | |
Charlie Reis
2014/04/04 22:23:02
Wait, this is a totally separate issue that we hav
| |
526 return; | 527 return; |
528 } | |
527 | 529 |
528 render_view_host_->SetState( | 530 render_view_host_->SetState( |
529 RenderViewHostImpl::STATE_WAITING_FOR_UNLOAD_ACK); | 531 RenderViewHostImpl::STATE_WAITING_FOR_UNLOAD_ACK); |
530 render_view_host_->unload_event_monitor_timeout_->Start( | 532 render_view_host_->unload_event_monitor_timeout_->Start( |
531 base::TimeDelta::FromMilliseconds( | 533 base::TimeDelta::FromMilliseconds( |
532 RenderViewHostImpl::kUnloadTimeoutMS)); | 534 RenderViewHostImpl::kUnloadTimeoutMS)); |
533 } | 535 } |
534 | 536 |
535 if (render_view_host_->IsRenderViewLive()) | 537 if (render_view_host_->IsRenderViewLive()) |
536 Send(new FrameMsg_SwapOut(routing_id_)); | 538 Send(new FrameMsg_SwapOut(routing_id_)); |
(...skipping 21 matching lines...) Expand all Loading... | |
558 if (GetParent()) { | 560 if (GetParent()) { |
559 NOTREACHED() << "Should only receive BeforeUnload_ACK from the main frame."; | 561 NOTREACHED() << "Should only receive BeforeUnload_ACK from the main frame."; |
560 return; | 562 return; |
561 } | 563 } |
562 | 564 |
563 render_view_host_->decrement_in_flight_event_count(); | 565 render_view_host_->decrement_in_flight_event_count(); |
564 render_view_host_->StopHangMonitorTimeout(); | 566 render_view_host_->StopHangMonitorTimeout(); |
565 // If this renderer navigated while the beforeunload request was in flight, we | 567 // If this renderer navigated while the beforeunload request was in flight, we |
566 // may have cleared this state in OnNavigate, in which case we can ignore | 568 // may have cleared this state in OnNavigate, in which case we can ignore |
567 // this message. | 569 // this message. |
568 if (!render_view_host_->is_waiting_for_beforeunload_ack_ || | 570 // However renderer might also be swapped out but we still want to proceed |
569 render_view_host_->rvh_state_ != RenderViewHostImpl::STATE_DEFAULT) { | 571 // with navigation, otherwise it would block whole web_contents. This can |
Charlie Reis
2014/04/04 22:23:02
nit: block whole web_contents -> block future navi
| |
572 // happen when pending cross-site navigation is canceled by second one just | |
Charlie Reis
2014/04/04 22:23:02
nit: a second one
| |
573 // before OnNavigate, current (loaded) RVH is waiting for commit but second | |
Charlie Reis
2014/04/04 22:23:02
This is a run-on sentence. Do you mean ", while t
| |
574 // navigation is started from the beginning. | |
575 if (!render_view_host_->is_waiting_for_beforeunload_ack_) { | |
570 return; | 576 return; |
571 } | 577 } |
572 | 578 |
573 render_view_host_->is_waiting_for_beforeunload_ack_ = false; | 579 render_view_host_->is_waiting_for_beforeunload_ack_ = false; |
574 | 580 |
575 base::TimeTicks before_unload_end_time; | 581 base::TimeTicks before_unload_end_time; |
576 if (!send_before_unload_start_time_.is_null() && | 582 if (!send_before_unload_start_time_.is_null() && |
577 !renderer_before_unload_start_time.is_null() && | 583 !renderer_before_unload_start_time.is_null() && |
578 !renderer_before_unload_end_time.is_null()) { | 584 !renderer_before_unload_end_time.is_null()) { |
579 // When passing TimeTicks across process boundaries, we need to compensate | 585 // When passing TimeTicks across process boundaries, we need to compensate |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
725 const gfx::Point& end) { | 731 const gfx::Point& end) { |
726 Send(new InputMsg_SelectRange(routing_id_, start, end)); | 732 Send(new InputMsg_SelectRange(routing_id_, start, end)); |
727 } | 733 } |
728 | 734 |
729 void RenderFrameHostImpl::ExtendSelectionAndDelete(size_t before, | 735 void RenderFrameHostImpl::ExtendSelectionAndDelete(size_t before, |
730 size_t after) { | 736 size_t after) { |
731 Send(new FrameMsg_ExtendSelectionAndDelete(routing_id_, before, after)); | 737 Send(new FrameMsg_ExtendSelectionAndDelete(routing_id_, before, after)); |
732 } | 738 } |
733 | 739 |
734 } // namespace content | 740 } // namespace content |
OLD | NEW |