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

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

Issue 1159183002: Improve process crash handling in RenderViewHost & mock RenderProcessHost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix for WebViewInteractiveUiTest.TextInputClientIsUpToDate Created 5 years, 6 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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 is_waiting_for_close_ack_(false), 220 is_waiting_for_close_ack_(false),
221 sudden_termination_allowed_(false), 221 sudden_termination_allowed_(false),
222 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING), 222 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING),
223 virtual_keyboard_requested_(false), 223 virtual_keyboard_requested_(false),
224 is_focused_element_editable_(false), 224 is_focused_element_editable_(false),
225 updating_web_preferences_(false), 225 updating_web_preferences_(false),
226 weak_factory_(this) { 226 weak_factory_(this) {
227 DCHECK(instance_.get()); 227 DCHECK(instance_.get());
228 CHECK(delegate_); // http://crbug.com/82827 228 CHECK(delegate_); // http://crbug.com/82827
229 229
230 GetProcess()->AddObserver(this);
230 GetProcess()->EnableSendQueue(); 231 GetProcess()->EnableSendQueue();
231 232
232 if (ResourceDispatcherHostImpl::Get()) { 233 if (ResourceDispatcherHostImpl::Get()) {
233 bool has_active_audio = false; 234 bool has_active_audio = false;
234 if (has_initialized_audio_host) { 235 if (has_initialized_audio_host) {
235 scoped_refptr<AudioRendererHost> arh = 236 scoped_refptr<AudioRendererHost> arh =
236 static_cast<RenderProcessHostImpl*>(GetProcess()) 237 static_cast<RenderProcessHostImpl*>(GetProcess())
237 ->audio_renderer_host(); 238 ->audio_renderer_host();
238 if (arh.get()) 239 if (arh.get())
239 has_active_audio = 240 has_active_audio =
(...skipping 14 matching lines...) Expand all
254 RenderViewHostImpl::~RenderViewHostImpl() { 255 RenderViewHostImpl::~RenderViewHostImpl() {
255 if (ResourceDispatcherHostImpl::Get()) { 256 if (ResourceDispatcherHostImpl::Get()) {
256 BrowserThread::PostTask( 257 BrowserThread::PostTask(
257 BrowserThread::IO, FROM_HERE, 258 BrowserThread::IO, FROM_HERE,
258 base::Bind(&ResourceDispatcherHostImpl::OnRenderViewHostDeleted, 259 base::Bind(&ResourceDispatcherHostImpl::OnRenderViewHostDeleted,
259 base::Unretained(ResourceDispatcherHostImpl::Get()), 260 base::Unretained(ResourceDispatcherHostImpl::Get()),
260 GetProcess()->GetID(), GetRoutingID())); 261 GetProcess()->GetID(), GetRoutingID()));
261 } 262 }
262 263
263 delegate_->RenderViewDeleted(this); 264 delegate_->RenderViewDeleted(this);
265 GetProcess()->RemoveObserver(this);
264 } 266 }
265 267
266 RenderViewHostDelegate* RenderViewHostImpl::GetDelegate() const { 268 RenderViewHostDelegate* RenderViewHostImpl::GetDelegate() const {
267 return delegate_; 269 return delegate_;
268 } 270 }
269 271
270 SiteInstanceImpl* RenderViewHostImpl::GetSiteInstance() const { 272 SiteInstanceImpl* RenderViewHostImpl::GetSiteInstance() const {
271 return instance_.get(); 273 return instance_.get();
272 } 274 }
273 275
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 float y) { 578 float y) {
577 Send(new InputMsg_ActivateNearestFindResult(GetRoutingID(), 579 Send(new InputMsg_ActivateNearestFindResult(GetRoutingID(),
578 request_id, x, y)); 580 request_id, x, y));
579 } 581 }
580 582
581 void RenderViewHostImpl::RequestFindMatchRects(int current_version) { 583 void RenderViewHostImpl::RequestFindMatchRects(int current_version) {
582 Send(new ViewMsg_FindMatchRects(GetRoutingID(), current_version)); 584 Send(new ViewMsg_FindMatchRects(GetRoutingID(), current_version));
583 } 585 }
584 #endif 586 #endif
585 587
588 void RenderViewHostImpl::RenderProcessExited(RenderProcessHost* host,
589 base::TerminationStatus status,
590 int exit_code) {
591 if (!renderer_initialized())
592 return;
593
594 RenderWidgetHostImpl::RendererExited(status, exit_code);
595 delegate_->RenderViewTerminated(
596 this, static_cast<base::TerminationStatus>(status), exit_code);
597 }
598
586 void RenderViewHostImpl::DragTargetDragEnter( 599 void RenderViewHostImpl::DragTargetDragEnter(
587 const DropData& drop_data, 600 const DropData& drop_data,
588 const gfx::Point& client_pt, 601 const gfx::Point& client_pt,
589 const gfx::Point& screen_pt, 602 const gfx::Point& screen_pt,
590 WebDragOperationsMask operations_allowed, 603 WebDragOperationsMask operations_allowed,
591 int key_modifiers) { 604 int key_modifiers) {
592 const int renderer_id = GetProcess()->GetID(); 605 const int renderer_id = GetProcess()->GetID();
593 ChildProcessSecurityPolicyImpl* policy = 606 ChildProcessSecurityPolicyImpl* policy =
594 ChildProcessSecurityPolicyImpl::GetInstance(); 607 ChildProcessSecurityPolicyImpl::GetInstance();
595 608
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 if (!policy->CanReadFile(GetProcess()->GetID(), file)) 1435 if (!policy->CanReadFile(GetProcess()->GetID(), file))
1423 policy->GrantReadFile(GetProcess()->GetID(), file); 1436 policy->GrantReadFile(GetProcess()->GetID(), file);
1424 } 1437 }
1425 } 1438 }
1426 1439
1427 void RenderViewHostImpl::SelectWordAroundCaret() { 1440 void RenderViewHostImpl::SelectWordAroundCaret() {
1428 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); 1441 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID()));
1429 } 1442 }
1430 1443
1431 } // namespace content 1444 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698