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

Side by Side Diff: chrome/browser/ui/views/hung_renderer_view.cc

Issue 740813004: Use StopChildProcess instead of base::KillProcess to kill a renderer process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update comments Created 6 years 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 "chrome/browser/ui/views/hung_renderer_view.h" 5 #include "chrome/browser/ui/views/hung_renderer_view.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/memory/scoped_vector.h" 8 #include "base/memory/scoped_vector.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/favicon/favicon_tab_helper.h" 10 #include "chrome/browser/favicon/favicon_tab_helper.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 189
190 // static 190 // static
191 bool HungRendererDialogView::IsFrameActive(WebContents* contents) { 191 bool HungRendererDialogView::IsFrameActive(WebContents* contents) {
192 gfx::NativeView frame_view = 192 gfx::NativeView frame_view =
193 platform_util::GetTopLevel(contents->GetNativeView()); 193 platform_util::GetTopLevel(contents->GetNativeView());
194 return platform_util::IsWindowActive(frame_view); 194 return platform_util::IsWindowActive(frame_view);
195 } 195 }
196 196
197 // static 197 // static
198 void HungRendererDialogView::KillRendererProcess( 198 void HungRendererDialogView::KillRendererProcess(
199 base::ProcessHandle process_handle) { 199 content::RenderProcessHost* rph) {
200 #if defined(OS_WIN) 200 #if defined(OS_WIN)
201 // Try to generate a crash report for the hung process. 201 // Try to generate a crash report for the hung process.
202 CrashDumpAndTerminateHungChildProcess(process_handle); 202 CrashDumpAndTerminateHungChildProcess(rph->GetHandle());
203 #else 203 #else
204 base::KillProcess(process_handle, content::RESULT_CODE_HUNG, false); 204 rph->Shutdown(content::RESULT_CODE_HUNG, false);
205 #endif 205 #endif
206 } 206 }
207 207
208 208
209 HungRendererDialogView::HungRendererDialogView() 209 HungRendererDialogView::HungRendererDialogView()
210 : hung_pages_table_(NULL), 210 : hung_pages_table_(NULL),
211 kill_button_(NULL), 211 kill_button_(NULL),
212 initialized_(false) { 212 initialized_(false) {
213 InitClass(); 213 InitClass();
214 } 214 }
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 #endif 335 #endif
336 } 336 }
337 337
338 /////////////////////////////////////////////////////////////////////////////// 338 ///////////////////////////////////////////////////////////////////////////////
339 // HungRendererDialogView, views::ButtonListener implementation: 339 // HungRendererDialogView, views::ButtonListener implementation:
340 340
341 void HungRendererDialogView::ButtonPressed( 341 void HungRendererDialogView::ButtonPressed(
342 views::Button* sender, const ui::Event& event) { 342 views::Button* sender, const ui::Event& event) {
343 if (sender == kill_button_ && 343 if (sender == kill_button_ &&
344 hung_pages_table_model_->GetRenderProcessHost()) { 344 hung_pages_table_model_->GetRenderProcessHost()) {
345 base::ProcessHandle process_handle = 345 KillRendererProcess(hung_pages_table_model_->GetRenderProcessHost());
346 hung_pages_table_model_->GetRenderProcessHost()->GetHandle();
347
348 KillRendererProcess(process_handle);
349 } 346 }
350 } 347 }
351 348
352 /////////////////////////////////////////////////////////////////////////////// 349 ///////////////////////////////////////////////////////////////////////////////
353 // HungRendererDialogView, HungPagesTableModel::Delegate overrides: 350 // HungRendererDialogView, HungPagesTableModel::Delegate overrides:
354 351
355 void HungRendererDialogView::TabDestroyed() { 352 void HungRendererDialogView::TabDestroyed() {
356 GetWidget()->Close(); 353 GetWidget()->Close();
357 } 354 }
358 355
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 HungRendererDialogView* view = HungRendererDialogView::Create(toplevel_view); 440 HungRendererDialogView* view = HungRendererDialogView::Create(toplevel_view);
444 view->ShowForWebContents(contents); 441 view->ShowForWebContents(contents);
445 } 442 }
446 443
447 void HideHungRendererDialog(WebContents* contents) { 444 void HideHungRendererDialog(WebContents* contents) {
448 if (!logging::DialogsAreSuppressed() && HungRendererDialogView::GetInstance()) 445 if (!logging::DialogsAreSuppressed() && HungRendererDialogView::GetInstance())
449 HungRendererDialogView::GetInstance()->EndForWebContents(contents); 446 HungRendererDialogView::GetInstance()->EndForWebContents(contents);
450 } 447 }
451 448
452 } // namespace chrome 449 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/hung_renderer_view.h ('k') | chrome/browser/ui/zoom/zoom_controller_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698