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

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

Issue 857213003: Refactor sudden termination (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Charlie's comments Created 5 years, 10 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 instance_(static_cast<SiteInstanceImpl*>(instance)), 176 instance_(static_cast<SiteInstanceImpl*>(instance)),
177 waiting_for_drag_context_response_(false), 177 waiting_for_drag_context_response_(false),
178 enabled_bindings_(0), 178 enabled_bindings_(0),
179 page_id_(-1), 179 page_id_(-1),
180 is_active_(!swapped_out), 180 is_active_(!swapped_out),
181 is_swapped_out_(swapped_out), 181 is_swapped_out_(swapped_out),
182 main_frame_routing_id_(main_frame_routing_id), 182 main_frame_routing_id_(main_frame_routing_id),
183 run_modal_reply_msg_(NULL), 183 run_modal_reply_msg_(NULL),
184 run_modal_opener_id_(MSG_ROUTING_NONE), 184 run_modal_opener_id_(MSG_ROUTING_NONE),
185 is_waiting_for_close_ack_(false), 185 is_waiting_for_close_ack_(false),
186 sudden_termination_allowed_(false),
187 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING), 186 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING),
188 virtual_keyboard_requested_(false), 187 virtual_keyboard_requested_(false),
189 is_focused_element_editable_(false), 188 is_focused_element_editable_(false),
190 updating_web_preferences_(false), 189 updating_web_preferences_(false),
191 weak_factory_(this) { 190 weak_factory_(this) {
192 DCHECK(instance_.get()); 191 DCHECK(instance_.get());
193 CHECK(delegate_); // http://crbug.com/82827 192 CHECK(delegate_); // http://crbug.com/82827
194 193
195 GetProcess()->EnableSendQueue(); 194 GetProcess()->EnableSendQueue();
196 195
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 // This RenderViewHost doesn't have a live renderer, so just skip the unload 547 // This RenderViewHost doesn't have a live renderer, so just skip the unload
549 // event and close the page. 548 // event and close the page.
550 ClosePageIgnoringUnloadEvents(); 549 ClosePageIgnoringUnloadEvents();
551 } 550 }
552 } 551 }
553 552
554 void RenderViewHostImpl::ClosePageIgnoringUnloadEvents() { 553 void RenderViewHostImpl::ClosePageIgnoringUnloadEvents() {
555 StopHangMonitorTimeout(); 554 StopHangMonitorTimeout();
556 is_waiting_for_close_ack_ = false; 555 is_waiting_for_close_ack_ = false;
557 556
558 sudden_termination_allowed_ = true;
559 delegate_->Close(this); 557 delegate_->Close(this);
560 } 558 }
561 559
562 #if defined(OS_ANDROID) 560 #if defined(OS_ANDROID)
563 void RenderViewHostImpl::ActivateNearestFindResult(int request_id, 561 void RenderViewHostImpl::ActivateNearestFindResult(int request_id,
564 float x, 562 float x,
565 float y) { 563 float y) {
566 Send(new InputMsg_ActivateNearestFindResult(GetRoutingID(), 564 Send(new InputMsg_ActivateNearestFindResult(GetRoutingID(),
567 request_id, x, y)); 565 request_id, x, y));
568 } 566 }
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 } 837 }
840 838
841 void RenderViewHostImpl::LoadStateChanged( 839 void RenderViewHostImpl::LoadStateChanged(
842 const GURL& url, 840 const GURL& url,
843 const net::LoadStateWithParam& load_state, 841 const net::LoadStateWithParam& load_state,
844 uint64 upload_position, 842 uint64 upload_position,
845 uint64 upload_size) { 843 uint64 upload_size) {
846 delegate_->LoadStateChanged(url, load_state, upload_position, upload_size); 844 delegate_->LoadStateChanged(url, load_state, upload_position, upload_size);
847 } 845 }
848 846
849 bool RenderViewHostImpl::SuddenTerminationAllowed() const {
850 return sudden_termination_allowed_ ||
851 GetProcess()->SuddenTerminationAllowed();
852 }
853
854 /////////////////////////////////////////////////////////////////////////////// 847 ///////////////////////////////////////////////////////////////////////////////
855 // RenderViewHostImpl, IPC message handlers: 848 // RenderViewHostImpl, IPC message handlers:
856 849
857 bool RenderViewHostImpl::OnMessageReceived(const IPC::Message& msg) { 850 bool RenderViewHostImpl::OnMessageReceived(const IPC::Message& msg) {
858 if (!BrowserMessageFilter::CheckCanDispatchOnUI(msg, this)) 851 if (!BrowserMessageFilter::CheckCanDispatchOnUI(msg, this))
859 return true; 852 return true;
860 853
861 // Filter out most IPC messages if this renderer is swapped out. 854 // Filter out most IPC messages if this renderer is swapped out.
862 // We still want to handle certain ACKs to keep our state consistent. 855 // We still want to handle certain ACKs to keep our state consistent.
863 if (is_swapped_out_) { 856 if (is_swapped_out_) {
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
1479 FrameTree* frame_tree = delegate_->GetFrameTree(); 1472 FrameTree* frame_tree = delegate_->GetFrameTree();
1480 1473
1481 frame_tree->ResetForMainFrameSwap(); 1474 frame_tree->ResetForMainFrameSwap();
1482 } 1475 }
1483 1476
1484 void RenderViewHostImpl::SelectWordAroundCaret() { 1477 void RenderViewHostImpl::SelectWordAroundCaret() {
1485 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); 1478 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID()));
1486 } 1479 }
1487 1480
1488 } // namespace content 1481 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698