OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer_host/render_view_host_impl.h" | 5 #include "content/browser/renderer_host/render_view_host_impl.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 base::Bind(base::IgnoreResult(&DismissVirtualKeyboardTask)), | 118 base::Bind(base::IgnoreResult(&DismissVirtualKeyboardTask)), |
119 TimeDelta::FromMilliseconds(kVirtualKeyboardDisplayWaitTimeoutMs)); | 119 TimeDelta::FromMilliseconds(kVirtualKeyboardDisplayWaitTimeoutMs)); |
120 ++virtual_keyboard_display_retries; | 120 ++virtual_keyboard_display_retries; |
121 } else { | 121 } else { |
122 virtual_keyboard_display_retries = 0; | 122 virtual_keyboard_display_retries = 0; |
123 } | 123 } |
124 } | 124 } |
125 } | 125 } |
126 #endif | 126 #endif |
127 | 127 |
128 // Enable sudden termination for the current RenderFrameHost of | |
129 // |frame_tree_node| if its SiteInstance is |site_instance|. Used with | |
130 // FrameTree::ForEach. | |
131 bool EnableSuddenTermination(scoped_refptr<SiteInstance> site_instance, | |
clamy
2015/02/03 12:54:03
Note that since SiteInstance is refcounted, we nee
Charlie Reis
2015/02/03 19:33:15
I don't think that's true, is it? It only needs t
clamy
2015/02/04 13:16:19
There is a static assert in base::Bind preventing
Charlie Reis
2015/02/04 21:34:57
Ah, base::Bind... Sorry for missing that aspect b
| |
132 FrameTreeNode* frame_tree_node) { | |
133 if (frame_tree_node->current_frame_host()->GetSiteInstance() | |
134 == site_instance.get()) { | |
135 frame_tree_node->current_frame_host() | |
136 ->set_override_sudden_termination_status(true); | |
137 } | |
138 return true; | |
139 } | |
140 | |
128 } // namespace | 141 } // namespace |
129 | 142 |
130 // static | 143 // static |
131 const int64 RenderViewHostImpl::kUnloadTimeoutMS = 1000; | 144 const int64 RenderViewHostImpl::kUnloadTimeoutMS = 1000; |
132 | 145 |
133 /////////////////////////////////////////////////////////////////////////////// | 146 /////////////////////////////////////////////////////////////////////////////// |
134 // RenderViewHost, public: | 147 // RenderViewHost, public: |
135 | 148 |
136 // static | 149 // static |
137 RenderViewHost* RenderViewHost::FromID(int render_process_id, | 150 RenderViewHost* RenderViewHost::FromID(int render_process_id, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
176 instance_(static_cast<SiteInstanceImpl*>(instance)), | 189 instance_(static_cast<SiteInstanceImpl*>(instance)), |
177 waiting_for_drag_context_response_(false), | 190 waiting_for_drag_context_response_(false), |
178 enabled_bindings_(0), | 191 enabled_bindings_(0), |
179 page_id_(-1), | 192 page_id_(-1), |
180 is_active_(!swapped_out), | 193 is_active_(!swapped_out), |
181 is_swapped_out_(swapped_out), | 194 is_swapped_out_(swapped_out), |
182 main_frame_routing_id_(main_frame_routing_id), | 195 main_frame_routing_id_(main_frame_routing_id), |
183 run_modal_reply_msg_(NULL), | 196 run_modal_reply_msg_(NULL), |
184 run_modal_opener_id_(MSG_ROUTING_NONE), | 197 run_modal_opener_id_(MSG_ROUTING_NONE), |
185 is_waiting_for_close_ack_(false), | 198 is_waiting_for_close_ack_(false), |
186 sudden_termination_allowed_(false), | |
187 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING), | 199 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING), |
188 virtual_keyboard_requested_(false), | 200 virtual_keyboard_requested_(false), |
189 is_focused_element_editable_(false), | 201 is_focused_element_editable_(false), |
190 updating_web_preferences_(false), | 202 updating_web_preferences_(false), |
191 weak_factory_(this) { | 203 weak_factory_(this) { |
192 DCHECK(instance_.get()); | 204 DCHECK(instance_.get()); |
193 CHECK(delegate_); // http://crbug.com/82827 | 205 CHECK(delegate_); // http://crbug.com/82827 |
194 | 206 |
195 GetProcess()->EnableSendQueue(); | 207 GetProcess()->EnableSendQueue(); |
196 | 208 |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
548 // This RenderViewHost doesn't have a live renderer, so just skip the unload | 560 // This RenderViewHost doesn't have a live renderer, so just skip the unload |
549 // event and close the page. | 561 // event and close the page. |
550 ClosePageIgnoringUnloadEvents(); | 562 ClosePageIgnoringUnloadEvents(); |
551 } | 563 } |
552 } | 564 } |
553 | 565 |
554 void RenderViewHostImpl::ClosePageIgnoringUnloadEvents() { | 566 void RenderViewHostImpl::ClosePageIgnoringUnloadEvents() { |
555 StopHangMonitorTimeout(); | 567 StopHangMonitorTimeout(); |
556 is_waiting_for_close_ack_ = false; | 568 is_waiting_for_close_ack_ = false; |
557 | 569 |
558 sudden_termination_allowed_ = true; | 570 // Enable sudden termination for all RenderFrameHosts in the FrameTree. |
571 FrameTree* frame_tree = static_cast<RenderFrameHostImpl*>(GetMainFrame()) | |
572 ->frame_tree_node()->frame_tree(); | |
573 frame_tree->ForEach(base::Bind(&EnableSuddenTermination, instance_)); | |
Charlie Reis
2015/02/03 19:33:15
instance_.get()
| |
559 delegate_->Close(this); | 574 delegate_->Close(this); |
560 } | 575 } |
561 | 576 |
562 #if defined(OS_ANDROID) | 577 #if defined(OS_ANDROID) |
563 void RenderViewHostImpl::ActivateNearestFindResult(int request_id, | 578 void RenderViewHostImpl::ActivateNearestFindResult(int request_id, |
564 float x, | 579 float x, |
565 float y) { | 580 float y) { |
566 Send(new InputMsg_ActivateNearestFindResult(GetRoutingID(), | 581 Send(new InputMsg_ActivateNearestFindResult(GetRoutingID(), |
567 request_id, x, y)); | 582 request_id, x, y)); |
568 } | 583 } |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
839 } | 854 } |
840 | 855 |
841 void RenderViewHostImpl::LoadStateChanged( | 856 void RenderViewHostImpl::LoadStateChanged( |
842 const GURL& url, | 857 const GURL& url, |
843 const net::LoadStateWithParam& load_state, | 858 const net::LoadStateWithParam& load_state, |
844 uint64 upload_position, | 859 uint64 upload_position, |
845 uint64 upload_size) { | 860 uint64 upload_size) { |
846 delegate_->LoadStateChanged(url, load_state, upload_position, upload_size); | 861 delegate_->LoadStateChanged(url, load_state, upload_position, upload_size); |
847 } | 862 } |
848 | 863 |
849 bool RenderViewHostImpl::SuddenTerminationAllowed() const { | |
850 return sudden_termination_allowed_ || | |
851 GetProcess()->SuddenTerminationAllowed(); | |
852 } | |
853 | |
854 /////////////////////////////////////////////////////////////////////////////// | 864 /////////////////////////////////////////////////////////////////////////////// |
855 // RenderViewHostImpl, IPC message handlers: | 865 // RenderViewHostImpl, IPC message handlers: |
856 | 866 |
857 bool RenderViewHostImpl::OnMessageReceived(const IPC::Message& msg) { | 867 bool RenderViewHostImpl::OnMessageReceived(const IPC::Message& msg) { |
858 if (!BrowserMessageFilter::CheckCanDispatchOnUI(msg, this)) | 868 if (!BrowserMessageFilter::CheckCanDispatchOnUI(msg, this)) |
859 return true; | 869 return true; |
860 | 870 |
861 // Filter out most IPC messages if this renderer is swapped out. | 871 // Filter out most IPC messages if this renderer is swapped out. |
862 // We still want to handle certain ACKs to keep our state consistent. | 872 // We still want to handle certain ACKs to keep our state consistent. |
863 if (is_swapped_out_) { | 873 if (is_swapped_out_) { |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1472 FrameTree* frame_tree = delegate_->GetFrameTree(); | 1482 FrameTree* frame_tree = delegate_->GetFrameTree(); |
1473 | 1483 |
1474 frame_tree->ResetForMainFrameSwap(); | 1484 frame_tree->ResetForMainFrameSwap(); |
1475 } | 1485 } |
1476 | 1486 |
1477 void RenderViewHostImpl::SelectWordAroundCaret() { | 1487 void RenderViewHostImpl::SelectWordAroundCaret() { |
1478 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); | 1488 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
1479 } | 1489 } |
1480 | 1490 |
1481 } // namespace content | 1491 } // namespace content |
OLD | NEW |