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

Side by Side Diff: content/browser/renderer_host/render_view_host_impl.cc

Issue 1014623002: Revert "Refactor sudden termination" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase + fixed compilation error Created 5 years, 9 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 (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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 base::Bind(base::IgnoreResult(&DismissVirtualKeyboardTask)), 119 base::Bind(base::IgnoreResult(&DismissVirtualKeyboardTask)),
120 TimeDelta::FromMilliseconds(kVirtualKeyboardDisplayWaitTimeoutMs)); 120 TimeDelta::FromMilliseconds(kVirtualKeyboardDisplayWaitTimeoutMs));
121 ++virtual_keyboard_display_retries; 121 ++virtual_keyboard_display_retries;
122 } else { 122 } else {
123 virtual_keyboard_display_retries = 0; 123 virtual_keyboard_display_retries = 0;
124 } 124 }
125 } 125 }
126 } 126 }
127 #endif 127 #endif
128 128
129 // Enable sudden termination for the current RenderFrameHost of
130 // |frame_tree_node| if the ID of its SiteInstance is |site_instance_id|. Used
131 // with FrameTree::ForEach.
132 bool EnableSuddenTermination(int32 site_instance_id,
133 FrameTreeNode* frame_tree_node) {
134 if (frame_tree_node->current_frame_host()->GetSiteInstance()->GetId()
135 == site_instance_id) {
136 frame_tree_node->current_frame_host()
137 ->set_override_sudden_termination_status(true);
138 }
139 return true;
140 }
141
142 } // namespace 129 } // namespace
143 130
144 // static 131 // static
145 const int64 RenderViewHostImpl::kUnloadTimeoutMS = 1000; 132 const int64 RenderViewHostImpl::kUnloadTimeoutMS = 1000;
146 133
147 /////////////////////////////////////////////////////////////////////////////// 134 ///////////////////////////////////////////////////////////////////////////////
148 // RenderViewHost, public: 135 // RenderViewHost, public:
149 136
150 // static 137 // static
151 RenderViewHost* RenderViewHost::FromID(int render_process_id, 138 RenderViewHost* RenderViewHost::FromID(int render_process_id,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 frames_ref_count_(0), 175 frames_ref_count_(0),
189 delegate_(delegate), 176 delegate_(delegate),
190 instance_(static_cast<SiteInstanceImpl*>(instance)), 177 instance_(static_cast<SiteInstanceImpl*>(instance)),
191 waiting_for_drag_context_response_(false), 178 waiting_for_drag_context_response_(false),
192 enabled_bindings_(0), 179 enabled_bindings_(0),
193 page_id_(-1), 180 page_id_(-1),
194 is_active_(!swapped_out), 181 is_active_(!swapped_out),
195 is_swapped_out_(swapped_out), 182 is_swapped_out_(swapped_out),
196 main_frame_routing_id_(main_frame_routing_id), 183 main_frame_routing_id_(main_frame_routing_id),
197 is_waiting_for_close_ack_(false), 184 is_waiting_for_close_ack_(false),
185 sudden_termination_allowed_(false),
198 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING), 186 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING),
199 virtual_keyboard_requested_(false), 187 virtual_keyboard_requested_(false),
200 is_focused_element_editable_(false), 188 is_focused_element_editable_(false),
201 updating_web_preferences_(false), 189 updating_web_preferences_(false),
202 weak_factory_(this) { 190 weak_factory_(this) {
203 DCHECK(instance_.get()); 191 DCHECK(instance_.get());
204 CHECK(delegate_); // http://crbug.com/82827 192 CHECK(delegate_); // http://crbug.com/82827
205 193
206 GetProcess()->EnableSendQueue(); 194 GetProcess()->EnableSendQueue();
207 195
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 // This RenderViewHost doesn't have a live renderer, so just skip the unload 511 // This RenderViewHost doesn't have a live renderer, so just skip the unload
524 // event and close the page. 512 // event and close the page.
525 ClosePageIgnoringUnloadEvents(); 513 ClosePageIgnoringUnloadEvents();
526 } 514 }
527 } 515 }
528 516
529 void RenderViewHostImpl::ClosePageIgnoringUnloadEvents() { 517 void RenderViewHostImpl::ClosePageIgnoringUnloadEvents() {
530 StopHangMonitorTimeout(); 518 StopHangMonitorTimeout();
531 is_waiting_for_close_ack_ = false; 519 is_waiting_for_close_ack_ = false;
532 520
533 // Enable sudden termination for all RenderFrameHosts in the FrameTree. 521 sudden_termination_allowed_ = true;
534 FrameTree* frame_tree = static_cast<RenderFrameHostImpl*>(GetMainFrame())
535 ->frame_tree_node()->frame_tree();
536 frame_tree->ForEach(base::Bind(&EnableSuddenTermination, instance_->GetId()));
537 delegate_->Close(this); 522 delegate_->Close(this);
538 } 523 }
539 524
540 #if defined(OS_ANDROID) 525 #if defined(OS_ANDROID)
541 void RenderViewHostImpl::ActivateNearestFindResult(int request_id, 526 void RenderViewHostImpl::ActivateNearestFindResult(int request_id,
542 float x, 527 float x,
543 float y) { 528 float y) {
544 Send(new InputMsg_ActivateNearestFindResult(GetRoutingID(), 529 Send(new InputMsg_ActivateNearestFindResult(GetRoutingID(),
545 request_id, x, y)); 530 request_id, x, y));
546 } 531 }
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 } 800 }
816 801
817 void RenderViewHostImpl::LoadStateChanged( 802 void RenderViewHostImpl::LoadStateChanged(
818 const GURL& url, 803 const GURL& url,
819 const net::LoadStateWithParam& load_state, 804 const net::LoadStateWithParam& load_state,
820 uint64 upload_position, 805 uint64 upload_position,
821 uint64 upload_size) { 806 uint64 upload_size) {
822 delegate_->LoadStateChanged(url, load_state, upload_position, upload_size); 807 delegate_->LoadStateChanged(url, load_state, upload_position, upload_size);
823 } 808 }
824 809
810 bool RenderViewHostImpl::SuddenTerminationAllowed() const {
811 return sudden_termination_allowed_ ||
812 GetProcess()->SuddenTerminationAllowed();
813 }
814
825 /////////////////////////////////////////////////////////////////////////////// 815 ///////////////////////////////////////////////////////////////////////////////
826 // RenderViewHostImpl, IPC message handlers: 816 // RenderViewHostImpl, IPC message handlers:
827 817
828 bool RenderViewHostImpl::OnMessageReceived(const IPC::Message& msg) { 818 bool RenderViewHostImpl::OnMessageReceived(const IPC::Message& msg) {
829 if (!BrowserMessageFilter::CheckCanDispatchOnUI(msg, this)) 819 if (!BrowserMessageFilter::CheckCanDispatchOnUI(msg, this))
830 return true; 820 return true;
831 821
832 // Filter out most IPC messages if this renderer is swapped out. 822 // Filter out most IPC messages if this renderer is swapped out.
833 // We still want to handle certain ACKs to keep our state consistent. 823 // We still want to handle certain ACKs to keep our state consistent.
834 if (is_swapped_out_) { 824 if (is_swapped_out_) {
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
1420 FrameTree* frame_tree = delegate_->GetFrameTree(); 1410 FrameTree* frame_tree = delegate_->GetFrameTree();
1421 1411
1422 frame_tree->ResetForMainFrameSwap(); 1412 frame_tree->ResetForMainFrameSwap();
1423 } 1413 }
1424 1414
1425 void RenderViewHostImpl::SelectWordAroundCaret() { 1415 void RenderViewHostImpl::SelectWordAroundCaret() {
1426 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); 1416 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID()));
1427 } 1417 }
1428 1418
1429 } // namespace content 1419 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.h ('k') | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698