diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-03 18:02:19 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-03 18:02:19 +0000 |
commit | 61b5009276bf52f14af3984724a410fb9a7bd1f5 (patch) | |
tree | 7a9ba5610891523fc38c07bffd9cb281765331e2 | |
parent | 6b91c40ac881e3512d204256b87c2b4ed83beb0f (diff) | |
download | chromium_src-61b5009276bf52f14af3984724a410fb9a7bd1f5.zip chromium_src-61b5009276bf52f14af3984724a410fb9a7bd1f5.tar.gz chromium_src-61b5009276bf52f14af3984724a410fb9a7bd1f5.tar.bz2 |
Makes it so the hung renderer dialog isn't shown if the page that is
hung is being shown by instant.
This also fixes a crash if the instant preview hung. The crash occurred because when HungRendererDialogView::ShowForTabContents set the bounds a synchronous focus change was triggered, which caused the instant preview to be destroyed, and when hung_pages_table_model_->InitForTabContents(contents) was invoked the contents was destroyed and no renderer.
BUG=58853
TEST=see bug
Review URL: http://codereview.chromium.org/6286055
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73636 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/instant/instant_loader.cc | 7 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.cc | 4 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents_delegate.cc | 4 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents_delegate.h | 3 | ||||
-rw-r--r-- | chrome/browser/ui/views/hung_renderer_view.cc | 23 |
5 files changed, 18 insertions, 23 deletions
diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc index e4ee07d..2bb01a0 100644 --- a/chrome/browser/instant/instant_loader.cc +++ b/chrome/browser/instant/instant_loader.cc @@ -373,6 +373,13 @@ class InstantLoader::TabContentsDelegateImpl loader_->PageDoesntSupportInstant(user_typed_before_load_); } + virtual bool ShouldShowHungRendererDialog() { + // If we allow the hung renderer dialog to be shown it'll gain focus, + // stealing focus from the omnibox causing instant to be cancelled. Return + // false so that doesn't happen. + return false; + } + private: typedef std::vector<scoped_refptr<history::HistoryAddPageArgs> > AddPageVector; diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index ea76a4a..9c539b3 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -2849,8 +2849,10 @@ void TabContents::RendererUnresponsive(RenderViewHost* rvh, return; } - if (render_view_host() && render_view_host()->IsRenderViewLive()) + if (render_view_host() && render_view_host()->IsRenderViewLive() && + (!delegate() || delegate()->ShouldShowHungRendererDialog())) { hung_renderer_dialog::ShowForTabContents(this); + } } void TabContents::RendererResponsive(RenderViewHost* render_view_host) { diff --git a/chrome/browser/tab_contents/tab_contents_delegate.cc b/chrome/browser/tab_contents/tab_contents_delegate.cc index 987e620..facb87c 100644 --- a/chrome/browser/tab_contents/tab_contents_delegate.cc +++ b/chrome/browser/tab_contents/tab_contents_delegate.cc @@ -227,5 +227,9 @@ void TabContentsDelegate::OnInstantSupportDetermined(int32 page_id, void TabContentsDelegate::ContentRestrictionsChanged(TabContents* source) { } +bool TabContentsDelegate::ShouldShowHungRendererDialog() { + return true; +} + TabContentsDelegate::~TabContentsDelegate() { } diff --git a/chrome/browser/tab_contents/tab_contents_delegate.h b/chrome/browser/tab_contents/tab_contents_delegate.h index 9b52e32..9fb6cc5 100644 --- a/chrome/browser/tab_contents/tab_contents_delegate.h +++ b/chrome/browser/tab_contents/tab_contents_delegate.h @@ -332,6 +332,9 @@ class TabContentsDelegate : public AutomationResourceRoutingDelegate { // changed. virtual void ContentRestrictionsChanged(TabContents* source); + // Returns true if the hung renderer dialog should be shown. Default is true. + virtual bool ShouldShowHungRendererDialog(); + protected: virtual ~TabContentsDelegate(); }; diff --git a/chrome/browser/ui/views/hung_renderer_view.cc b/chrome/browser/ui/views/hung_renderer_view.cc index cdd08af..2892589 100644 --- a/chrome/browser/ui/views/hung_renderer_view.cc +++ b/chrome/browser/ui/views/hung_renderer_view.cc @@ -72,13 +72,8 @@ HungPagesTableModel::~HungPagesTableModel() { } void HungPagesTableModel::InitForTabContents(TabContents* hung_contents) { - // TODO(sky): remove when figure out cause of 58853. - CHECK(hung_contents->render_view_host()); tab_contentses_.clear(); for (TabContentsIterator it; !it.done(); ++it) { - // TODO(sky): remove when figure out cause of 58853. - CHECK(it->render_view_host()); - CHECK(hung_contents->render_view_host()); if (it->GetRenderProcessHost() == hung_contents->GetRenderProcessHost()) tab_contentses_.push_back(*it); } @@ -194,9 +189,6 @@ class HungRendererDialogView : public views::View, // Whether or not we've created controls for ourself. bool initialized_; - // TODO(sky): remove when figure out cause of 58853. - bool preparing_to_show_; - // An amusing icon image. static SkBitmap* frozen_icon_; @@ -224,8 +216,7 @@ HungRendererDialogView::HungRendererDialogView() kill_button_(NULL), kill_button_container_(NULL), contents_(NULL), - initialized_(false), - preparing_to_show_(false) { + initialized_(false) { InitClass(); } @@ -235,8 +226,6 @@ HungRendererDialogView::~HungRendererDialogView() { void HungRendererDialogView::ShowForTabContents(TabContents* contents) { DCHECK(contents && window()); - // TODO(sky): remove when figure out cause of 58853. - CHECK(contents->render_view_host()); contents_ = contents; // Don't show the warning unless the foreground window is the frame, or this @@ -250,18 +239,12 @@ void HungRendererDialogView::ShowForTabContents(TabContents* contents) { } if (!window()->IsActive()) { - // TODO(sky): remove when figure out cause of 58853. - CHECK(contents->render_view_host()); volatile TabContents* passed_c = contents; volatile TabContents* this_contents = contents_; - preparing_to_show_ = true; gfx::Rect bounds = GetDisplayBounds(contents); window()->SetBounds(bounds, frame_hwnd); - preparing_to_show_ = false; - CHECK(contents->render_view_host()); - // We only do this if the window isn't active (i.e. hasn't been shown yet, // or is currently shown but deactivated for another TabContents). This is // because this window is a singleton, and it's possible another active @@ -277,8 +260,6 @@ void HungRendererDialogView::EndForTabContents(TabContents* contents) { DCHECK(contents); if (contents_ && contents_->GetRenderProcessHost() == contents->GetRenderProcessHost()) { - // TODO(sky): remove when figure out cause of 58853. - CHECK(!preparing_to_show_); window()->Close(); // Since we're closing, we no longer need this TabContents. contents_ = NULL; @@ -471,8 +452,6 @@ static HungRendererDialogView* CreateHungRendererDialogView() { namespace hung_renderer_dialog { void ShowForTabContents(TabContents* contents) { - // TODO(sky): remove when figure out cause of 58853. - CHECK(contents->render_view_host()); if (!logging::DialogsAreSuppressed()) { if (!g_instance) g_instance = CreateHungRendererDialogView(); |