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

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

Issue 6395002: Adds some debugging code in hopes of isolating a crash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix check Created 9 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/hung_renderer_dialog.h" 5 #include "chrome/browser/hung_renderer_dialog.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/browser_list.h" 9 #include "chrome/browser/browser_list.h"
10 #include "chrome/browser/renderer_host/render_process_host.h" 10 #include "chrome/browser/renderer_host/render_process_host.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 /////////////////////////////////////////////////////////////////////////////// 65 ///////////////////////////////////////////////////////////////////////////////
66 // HungPagesTableModel, public: 66 // HungPagesTableModel, public:
67 67
68 HungPagesTableModel::HungPagesTableModel() : observer_(NULL) { 68 HungPagesTableModel::HungPagesTableModel() : observer_(NULL) {
69 } 69 }
70 70
71 HungPagesTableModel::~HungPagesTableModel() { 71 HungPagesTableModel::~HungPagesTableModel() {
72 } 72 }
73 73
74 void HungPagesTableModel::InitForTabContents(TabContents* hung_contents) { 74 void HungPagesTableModel::InitForTabContents(TabContents* hung_contents) {
75 // TODO(sky): remove when figure out cause of 58853.
76 CHECK(hung_contents->render_view_host());
75 tab_contentses_.clear(); 77 tab_contentses_.clear();
76 for (TabContentsIterator it; !it.done(); ++it) { 78 for (TabContentsIterator it; !it.done(); ++it) {
79 // TODO(sky): remove when figure out cause of 58853.
80 CHECK(it->render_view_host());
81 CHECK(hung_contents->render_view_host());
77 if (it->GetRenderProcessHost() == hung_contents->GetRenderProcessHost()) 82 if (it->GetRenderProcessHost() == hung_contents->GetRenderProcessHost())
78 tab_contentses_.push_back(*it); 83 tab_contentses_.push_back(*it);
79 } 84 }
80 // The world is different. 85 // The world is different.
81 if (observer_) 86 if (observer_)
82 observer_->OnModelChanged(); 87 observer_->OnModelChanged();
83 } 88 }
84 89
85 /////////////////////////////////////////////////////////////////////////////// 90 ///////////////////////////////////////////////////////////////////////////////
86 // HungPagesTableModel, views::GroupTableModel implementation: 91 // HungPagesTableModel, views::GroupTableModel implementation:
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 initialized_(false) { 224 initialized_(false) {
220 InitClass(); 225 InitClass();
221 } 226 }
222 227
223 HungRendererDialogView::~HungRendererDialogView() { 228 HungRendererDialogView::~HungRendererDialogView() {
224 hung_pages_table_->SetModel(NULL); 229 hung_pages_table_->SetModel(NULL);
225 } 230 }
226 231
227 void HungRendererDialogView::ShowForTabContents(TabContents* contents) { 232 void HungRendererDialogView::ShowForTabContents(TabContents* contents) {
228 DCHECK(contents && window()); 233 DCHECK(contents && window());
234 // TODO(sky): remove when figure out cause of 58853.
235 CHECK(contents->render_view_host());
229 contents_ = contents; 236 contents_ = contents;
230 237
231 // Don't show the warning unless the foreground window is the frame, or this 238 // Don't show the warning unless the foreground window is the frame, or this
232 // window (but still invisible). If the user has another window or 239 // window (but still invisible). If the user has another window or
233 // application selected, activating ourselves is rude. 240 // application selected, activating ourselves is rude.
234 HWND frame_hwnd = GetAncestor(contents->GetNativeView(), GA_ROOT); 241 HWND frame_hwnd = GetAncestor(contents->GetNativeView(), GA_ROOT);
235 HWND foreground_window = GetForegroundWindow(); 242 HWND foreground_window = GetForegroundWindow();
236 if (foreground_window != frame_hwnd && 243 if (foreground_window != frame_hwnd &&
237 foreground_window != window()->GetNativeWindow()) { 244 foreground_window != window()->GetNativeWindow()) {
238 return; 245 return;
239 } 246 }
240 247
241 if (!window()->IsActive()) { 248 if (!window()->IsActive()) {
249 // TODO(sky): remove when figure out cause of 58853.
250 CHECK(contents->render_view_host());
251
242 gfx::Rect bounds = GetDisplayBounds(contents); 252 gfx::Rect bounds = GetDisplayBounds(contents);
243 window()->SetBounds(bounds, frame_hwnd); 253 window()->SetBounds(bounds, frame_hwnd);
244 254
245 // We only do this if the window isn't active (i.e. hasn't been shown yet, 255 // We only do this if the window isn't active (i.e. hasn't been shown yet,
246 // or is currently shown but deactivated for another TabContents). This is 256 // or is currently shown but deactivated for another TabContents). This is
247 // because this window is a singleton, and it's possible another active 257 // because this window is a singleton, and it's possible another active
248 // renderer may hang while this one is showing, and we don't want to reset 258 // renderer may hang while this one is showing, and we don't want to reset
249 // the list of hung pages for a potentially unrelated renderer while this 259 // the list of hung pages for a potentially unrelated renderer while this
250 // one is showing. 260 // one is showing.
251 hung_pages_table_model_->InitForTabContents(contents); 261 hung_pages_table_model_->InitForTabContents(contents);
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 452
443 static HungRendererDialogView* CreateHungRendererDialogView() { 453 static HungRendererDialogView* CreateHungRendererDialogView() {
444 HungRendererDialogView* cv = new HungRendererDialogView; 454 HungRendererDialogView* cv = new HungRendererDialogView;
445 views::Window::CreateChromeWindow(NULL, gfx::Rect(), cv); 455 views::Window::CreateChromeWindow(NULL, gfx::Rect(), cv);
446 return cv; 456 return cv;
447 } 457 }
448 458
449 namespace hung_renderer_dialog { 459 namespace hung_renderer_dialog {
450 460
451 void ShowForTabContents(TabContents* contents) { 461 void ShowForTabContents(TabContents* contents) {
462 // TODO(sky): remove when figure out cause of 58853.
463 CHECK(contents->render_view_host());
452 if (!logging::DialogsAreSuppressed()) { 464 if (!logging::DialogsAreSuppressed()) {
453 if (!g_instance) 465 if (!g_instance)
454 g_instance = CreateHungRendererDialogView(); 466 g_instance = CreateHungRendererDialogView();
455 g_instance->ShowForTabContents(contents); 467 g_instance->ShowForTabContents(contents);
456 } 468 }
457 } 469 }
458 470
459 // static 471 // static
460 void HideForTabContents(TabContents* contents) { 472 void HideForTabContents(TabContents* contents) {
461 if (!logging::DialogsAreSuppressed() && g_instance) 473 if (!logging::DialogsAreSuppressed() && g_instance)
462 g_instance->EndForTabContents(contents); 474 g_instance->EndForTabContents(contents);
463 } 475 }
464 476
465 } // namespace hung_renderer_dialog 477 } // namespace hung_renderer_dialog
466 478
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698