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

Unified Diff: chrome/browser/ui/webui/hung_renderer_dialog.cc

Issue 8510071: Revert 109984 - Tests for WebUI Hung Renderer Dialog (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/hung_renderer_dialog.h ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/hung_renderer_dialog.cc
===================================================================
--- chrome/browser/ui/webui/hung_renderer_dialog.cc (revision 109988)
+++ chrome/browser/ui/webui/hung_renderer_dialog.cc (working copy)
@@ -35,7 +35,7 @@
void ShowHungRendererDialog(TabContents* contents) {
#if defined(OS_CHROMEOS) || defined(USE_AURA)
- HungRendererDialog::ShowHungRendererDialog(contents, true);
+ HungRendererDialog::ShowHungRendererDialog(contents);
#else
// TODO(rbyers): Remove IsMoreWebUI check once we decide for sure which
// platforms will use the WebUI version of this dialog.
@@ -63,7 +63,12 @@
// HungRendererDialog public static methods
void HungRendererDialog::ShowHungRendererDialog(TabContents* contents) {
- ShowHungRendererDialogInternal(contents, true);
+ if (!logging::DialogsAreSuppressed()) {
+ if (g_instance)
+ return;
+ g_instance = new HungRendererDialog();
+ g_instance->ShowDialog(contents);
+ }
}
void HungRendererDialog::HideHungRendererDialog(TabContents* contents) {
@@ -71,49 +76,16 @@
g_instance->HideDialog(contents);
}
-////////////////////////////////////////////////////////////////////////////////
-// HungRendererDialog::TabContentsObserverImpl
-HungRendererDialog::TabContentsObserverImpl::TabContentsObserverImpl(
- HungRendererDialog* dialog,
- TabContents* contents)
- : TabContentsObserver(contents),
- contents_(contents),
- dialog_(dialog) {
-}
-
-void HungRendererDialog::TabContentsObserverImpl::RenderViewGone() {
- dialog_->HideDialog(contents_);
-}
-
-void HungRendererDialog::TabContentsObserverImpl::TabContentsDestroyed(
- TabContents* tab) {
- dialog_->HideDialog(contents_);
-}
-
////////////////////////////////////////////////////////////////////////////////
// HungRendererDialog private methods
-HungRendererDialog::HungRendererDialog(bool is_enabled)
+HungRendererDialog::HungRendererDialog()
: contents_(NULL),
handler_(NULL),
- is_enabled_(is_enabled),
window_(NULL) {
}
-HungRendererDialog::~HungRendererDialog() {
-}
-
-void HungRendererDialog::ShowHungRendererDialogInternal(TabContents* contents,
- bool is_enabled) {
- if (!logging::DialogsAreSuppressed()) {
- if (g_instance)
- return;
- g_instance = new HungRendererDialog(is_enabled);
- g_instance->ShowDialog(contents);
- }
-}
-
void HungRendererDialog::ShowDialog(TabContents* contents) {
DCHECK(contents);
contents_ = contents;
@@ -121,7 +93,6 @@
DCHECK(browser);
handler_ = new HungRendererDialogHandler(contents_);
window_ = browser->BrowserShowHtmlDialog(this, NULL);
- contents_observer_.reset(new TabContentsObserverImpl(this, contents_));
}
void HungRendererDialog::HideDialog(TabContents* contents) {
@@ -133,7 +104,6 @@
// Settings |contents_| to NULL prevents the hang monitor from restarting.
// We do this because the close dialog handler runs whether it is trigged by
// the user closing the box, or by being closed externally with widget->Close.
- contents_observer_.reset();
contents_ = NULL;
DCHECK(handler_);
handler_->CloseDialog();
@@ -165,27 +135,25 @@
}
void HungRendererDialog::OnDialogClosed(const std::string& json_retval) {
- if (is_enabled_) {
- // Figure out what the response was.
- scoped_ptr<Value> root(base::JSONReader::Read(json_retval, false));
- bool response = false;
- ListValue* list = NULL;
- // If the dialog closes because of a button click then the json is a list
- // containing a single bool. If the dialog closes some other way, then we
- // assume it means no permission was given to kill tabs.
- if (root.get() && root->GetAsList(&list) && list &&
- list->GetBoolean(0, &response) && response) {
- // The user indicated that it is OK to kill the renderer process.
- if (contents_ && contents_->GetRenderProcessHost()) {
- base::KillProcess(contents_->GetRenderProcessHost()->GetHandle(),
- content::RESULT_CODE_HUNG, false);
- }
- } else {
- // No indication from the user that it is ok to kill anything. Just wait.
- // Start waiting again for responsiveness.
- if (contents_ && contents_->render_view_host())
- contents_->render_view_host()->RestartHangMonitorTimeout();
+ // Figure out what the response was.
+ scoped_ptr<Value> root(base::JSONReader::Read(json_retval, false));
+ bool response = false;
+ ListValue* list = NULL;
+ // If the dialog closes because of a button click then the json is a list
+ // containing a single bool. If the dialog closes some other way, then we
+ // assume it means no permission was given to kill tabs.
+ if (root.get() && root->GetAsList(&list) && list &&
+ list->GetBoolean(0, &response) && response) {
+ // The user indicated that it is OK to kill the renderer process.
+ if (contents_ && contents_->GetRenderProcessHost()) {
+ base::KillProcess(contents_->GetRenderProcessHost()->GetHandle(),
+ content::RESULT_CODE_HUNG, false);
}
+ } else {
+ // No indication from the user that it is ok to kill anything. Just wait.
+ // Start waiting again for responsiveness.
+ if (contents_ && contents_->render_view_host())
+ contents_->render_view_host()->RestartHangMonitorTimeout();
}
g_instance = NULL;
delete this;
« no previous file with comments | « chrome/browser/ui/webui/hung_renderer_dialog.h ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698