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

Unified Diff: chrome/browser/tabs/tab_strip_model_order_controller.cc

Issue 6124009: Adds some debugging code in hopes of figuring out why we're (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/tabs/tab_strip_model_order_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/tabs/tab_strip_model_order_controller.cc
diff --git a/chrome/browser/tabs/tab_strip_model_order_controller.cc b/chrome/browser/tabs/tab_strip_model_order_controller.cc
index c7d10f45c19b7cd26d30a70553ecfeaf199aaec7..52730ef3886b8f48e56c2d938b3e1a6fc292e7c5 100644
--- a/chrome/browser/tabs/tab_strip_model_order_controller.cc
+++ b/chrome/browser/tabs/tab_strip_model_order_controller.cc
@@ -64,7 +64,7 @@ int TabStripModelOrderController::DetermineInsertionIndexForAppending() {
}
int TabStripModelOrderController::DetermineNewSelectedIndex(
- int removing_index) const {
+ int removing_index, volatile int* reason) const {
int tab_count = tabstrip_->count();
DCHECK(removing_index >= 0 && removing_index < tab_count);
NavigationController* parent_opener =
@@ -74,33 +74,44 @@ int TabStripModelOrderController::DetermineNewSelectedIndex(
// group of the removed tab.
NavigationController* removed_controller =
&tabstrip_->GetTabContentsAt(removing_index)->controller();
+ // The parent opener should never be the same as the controller being removed.
+ CHECK(parent_opener != removed_controller);
int index = tabstrip_->GetIndexOfNextTabContentsOpenedBy(removed_controller,
removing_index,
false);
- if (index != TabStripModel::kNoTab)
+ if (index != TabStripModel::kNoTab) {
+ *reason = 1;
return GetValidIndex(index, removing_index);
+ }
if (parent_opener) {
// If the tab was in a group, shift selection to the next tab in the group.
int index = tabstrip_->GetIndexOfNextTabContentsOpenedBy(parent_opener,
removing_index,
false);
- if (index != TabStripModel::kNoTab)
+ if (index != TabStripModel::kNoTab) {
+ *reason = 2;
return GetValidIndex(index, removing_index);
+ }
// If we can't find a subsequent group member, just fall back to the
// parent_opener itself. Note that we use "group" here since opener is
// reset by select operations..
index = tabstrip_->GetIndexOfController(parent_opener);
- if (index != TabStripModel::kNoTab)
+ if (index != TabStripModel::kNoTab) {
+ *reason = 3;
return GetValidIndex(index, removing_index);
+ }
}
// No opener set, fall through to the default handler...
int selected_index = tabstrip_->selected_index();
- if (selected_index >= (tab_count - 1))
+ if (selected_index >= (tab_count - 1)) {
+ *reason = 4;
return selected_index - 1;
+ }
+ *reason = 5;
return selected_index;
}
« no previous file with comments | « chrome/browser/tabs/tab_strip_model_order_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698