summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorsky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-28 16:10:30 +0000
committersky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-28 16:10:30 +0000
commit50664fdc92a8d1db14d83c902f67b7a8dce76480 (patch)
tree885c0903db9610d93417b7978008834ec26be9dc /chrome
parentda27ac3cbf0acb3a17878502c279dbaca90b63eb (diff)
downloadchromium_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')
-rw-r--r--chrome/browser/navigation_controller.cc28
-rw-r--r--chrome/browser/navigation_controller.h4
2 files changed, 21 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;
}
-
diff --git a/chrome/browser/navigation_controller.h b/chrome/browser/navigation_controller.h
index 7c3c387..c2c517d 100644
--- a/chrome/browser/navigation_controller.h
+++ b/chrome/browser/navigation_controller.h
@@ -324,6 +324,10 @@ class NavigationController {
NavigationEntry* CreateNavigationEntry(const GURL& url,
PageTransition::Type transition);
+ // Invokes ScheduleTabContentsCollection for all TabContents but the active
+ // one.
+ void ScheduleTabContentsCollectionForInactiveTabs();
+
// Schedule the TabContents currently allocated for |tc| for collection.
// The TabContents will be destroyed later from a different event.
void ScheduleTabContentsCollection(TabContentsType t);