diff options
author | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-28 16:10:30 +0000 |
---|---|---|
committer | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-08-28 16:10:30 +0000 |
commit | 50664fdc92a8d1db14d83c902f67b7a8dce76480 (patch) | |
tree | 885c0903db9610d93417b7978008834ec26be9dc /chrome/browser/navigation_controller.cc | |
parent | da27ac3cbf0acb3a17878502c279dbaca90b63eb (diff) | |
download | chromium_src-50664fdc92a8d1db14d83c902f67b7a8dce76480.zip chromium_src-50664fdc92a8d1db14d83c902f67b7a8dce76480.tar.gz chromium_src-50664fdc92a8d1db14d83c902f67b7a8dce76480.tar.bz2 |
Fixes regression where we were no longer deleting TabContents when
navigating to a new TabContents.
BUG=1349274
TEST=none
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1487 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/navigation_controller.cc')
-rw-r--r-- | chrome/browser/navigation_controller.cc | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/chrome/browser/navigation_controller.cc b/chrome/browser/navigation_controller.cc index 514e400..715e33f7 100644 --- a/chrome/browser/navigation_controller.cc +++ b/chrome/browser/navigation_controller.cc @@ -509,6 +509,9 @@ void NavigationController::DidNavigateToEntry(NavigationEntry* entry) { if (entry->page_id() > GetMaxPageID()) { InsertEntry(entry); NotifyNavigationEntryCommitted(); + // It is now a safe time to schedule collection for any tab contents of a + // different type, because a navigation is necessary to get back to them. + ScheduleTabContentsCollectionForInactiveTabs(); return; } @@ -574,16 +577,7 @@ void NavigationController::DidNavigateToEntry(NavigationEntry* entry) { // It is now a safe time to schedule collection for any tab contents of a // different type, because a navigation is necessary to get back to them. - int index = GetCurrentEntryIndex(); - if (index < 0 || GetPendingEntryIndex() != -1) - return; - - TabContentsType active_type = GetEntryAtIndex(index)->tab_type(); - for (TabContentsMap::iterator i = tab_contents_map_.begin(); - i != tab_contents_map_.end(); ++i) { - if (i->first != active_type) - ScheduleTabContentsCollection(i->first); - } + ScheduleTabContentsCollectionForInactiveTabs(); } @@ -909,6 +903,19 @@ NavigationController* NavigationController::Clone(HWND parent_hwnd) { return nc; } +void NavigationController::ScheduleTabContentsCollectionForInactiveTabs() { + int index = GetCurrentEntryIndex(); + if (index < 0 || GetPendingEntryIndex() != -1) + return; + + TabContentsType active_type = GetEntryAtIndex(index)->tab_type(); + for (TabContentsMap::iterator i = tab_contents_map_.begin(); + i != tab_contents_map_.end(); ++i) { + if (i->first != active_type) + ScheduleTabContentsCollection(i->first); + } +} + void NavigationController::ScheduleTabContentsCollection(TabContentsType t) { TabContentsCollectorMap::const_iterator i = tab_contents_collector_map_.find(t); @@ -979,4 +986,3 @@ int NavigationController::GetEntryIndexWithPageID( } return -1; } - |