diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-27 15:26:36 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-27 15:26:36 +0000 |
commit | ef321762d036191157a3d31a6eff2884f3ff0356 (patch) | |
tree | ee24ab21eab9188055143694f75bd31dcd35b18f /chrome/browser/views | |
parent | b9867d73c61906ddaff2f366f86932b0b57f2bcf (diff) | |
download | chromium_src-ef321762d036191157a3d31a6eff2884f3ff0356.zip chromium_src-ef321762d036191157a3d31a6eff2884f3ff0356.tar.gz chromium_src-ef321762d036191157a3d31a6eff2884f3ff0356.tar.bz2 |
Nukes TabStrip::CanUpdateDisplay. This appears to be the culprit for a
couple of crashes we're getting.
BUG=24132, 13707
TEST=thorougly test tab dragging on windows and make sure there are no
regressions.
Review URL: http://codereview.chromium.org/337013
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30193 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views')
-rw-r--r-- | chrome/browser/views/tabs/tab_strip.cc | 52 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_strip.h | 6 |
2 files changed, 20 insertions, 38 deletions
diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc index f41defb..dfdb2be 100644 --- a/chrome/browser/views/tabs/tab_strip.cc +++ b/chrome/browser/views/tabs/tab_strip.cc @@ -1032,14 +1032,12 @@ void TabStrip::TabInsertedAt(TabContents* contents, } void TabStrip::TabDetachedAt(TabContents* contents, int index) { - if (CanUpdateDisplay()) { - GenerateIdealBounds(); - StartRemoveTabAnimation(index, contents); - // Have to do this _after_ calling StartRemoveTabAnimation, so that any - // previous remove is completed fully and index is valid in sync with the - // model index. - GetTabAt(index)->set_closing(true); - } + GenerateIdealBounds(); + StartRemoveTabAnimation(index, contents); + // Have to do this _after_ calling StartRemoveTabAnimation, so that any + // previous remove is completed fully and index is valid in sync with the + // model index. + GetTabAt(index)->set_closing(true); } void TabStrip::TabSelectedAt(TabContents* old_contents, @@ -1047,20 +1045,18 @@ void TabStrip::TabSelectedAt(TabContents* old_contents, int index, bool user_gesture) { DCHECK(index >= 0 && index < GetTabCount()); - if (CanUpdateDisplay()) { - // We have "tiny tabs" if the tabs are so tiny that the unselected ones are - // a different size to the selected ones. - bool tiny_tabs = current_unselected_width_ != current_selected_width_; - if (!IsAnimating() && (!resize_layout_scheduled_ || tiny_tabs)) { - Layout(); - } else { - SchedulePaint(); - } - - int old_index = model_->GetIndexOfTabContents(old_contents); - if (old_index >= 0) - GetTabAt(old_index)->StopPinnedTabTitleAnimation(); + // We have "tiny tabs" if the tabs are so tiny that the unselected ones are + // a different size to the selected ones. + bool tiny_tabs = current_unselected_width_ != current_selected_width_; + if (!IsAnimating() && (!resize_layout_scheduled_ || tiny_tabs)) { + Layout(); + } else { + SchedulePaint(); } + + int old_index = model_->GetIndexOfTabContents(old_contents); + if (old_index >= 0) + GetTabAt(old_index)->StopPinnedTabTitleAnimation(); } void TabStrip::TabMoved(TabContents* contents, int from_index, int to_index, @@ -1208,6 +1204,7 @@ void TabStrip::MaybeStartDrag(Tab* tab, const views::MouseEvent& event) { // This records some extra information in hopes of tracking down why. // The string contains the following, in order: // . If a drag is already in progress, a 'D'. + // . If the model is closing all, an 'A'. // . Index of tab the user is dragging. // . Number of tabs. // . Size of the model. @@ -1216,6 +1213,8 @@ void TabStrip::MaybeStartDrag(Tab* tab, const views::MouseEvent& event) { std::string tmp; if (drag_controller_.get()) tmp += "D"; + if (model_->closing_all()) + tmp += " A"; tmp += " " + IntToString(index); tmp += " " + IntToString(GetTabCount()); tmp += " " + IntToString(model_->count()); @@ -1906,17 +1905,6 @@ void TabStrip::StartPinAndMoveTabAnimation(int from_index, active_animation_->Start(); } -bool TabStrip::CanUpdateDisplay() { - // Don't bother laying out/painting when we're closing all tabs. - if (model_->closing_all()) { - // Make sure any active animation is ended, too. - if (active_animation_.get()) - active_animation_->Stop(); - return false; - } - return true; -} - void TabStrip::FinishAnimation(TabStrip::TabAnimation* animation, bool layout) { active_animation_.reset(NULL); diff --git a/chrome/browser/views/tabs/tab_strip.h b/chrome/browser/views/tabs/tab_strip.h index e16a6573..6d6ec7a 100644 --- a/chrome/browser/views/tabs/tab_strip.h +++ b/chrome/browser/views/tabs/tab_strip.h @@ -273,12 +273,6 @@ class TabStrip : public views::View, void StartPinAndMoveTabAnimation(int from_index, int to_index, const gfx::Rect& start_bounds); - // Returns true if detach or select changes in the model should be reflected - // in the TabStrip. This returns false if we're closing all tabs in the - // TabStrip and so we should prevent updating. This is not const because we - // use this as a signal to cancel any active animations. - bool CanUpdateDisplay(); - // Notifies the TabStrip that the specified TabAnimation has completed. // Optionally a full Layout will be performed, specified by |layout|. void FinishAnimation(TabAnimation* animation, bool layout); |