diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-20 19:55:57 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-20 19:55:57 +0000 |
commit | ce3fa3c831cba1f44d34c1c66020f830be33a068 (patch) | |
tree | da18dbdfb081c17949dca2dcfa0633142a63a868 /chrome/browser/browser.h | |
parent | 6ee6368c466235c5919c9b4d5cfe11f8e48b29ca (diff) | |
download | chromium_src-ce3fa3c831cba1f44d34c1c66020f830be33a068.zip chromium_src-ce3fa3c831cba1f44d34c1c66020f830be33a068.tar.gz chromium_src-ce3fa3c831cba1f44d34c1c66020f830be33a068.tar.bz2 |
Re-land my change to clean up TabContents/WebContents ownership. This
is the same except in tab_strip_model_unittest I fixed a leak by making a
WebContents on the stack, I added a factory to the SiteInstance unittest to
prevent another leak, and I re-added a NULL set to the external_tab_container.
Fix the ownership model of TabContents and NavigationController. Previously the
NavigationController owned the TabContents, and there were extra steps required
at creation and destruction to clean everything up properly.
NavigationController is now a member of TabContents, and there is no setup or
tear down necessary other than the constructor and destructor. I could remove
the tab contents creation in the NavigationController, as well as all the
weird destruction code in WebContents which got moved to the destructor.
I made the controller getter return a reference since the ownership is clear
and there is no possibility of NULL. This required changing a lot of tiles, but
many of them were simplified since they no longer have to NULL check.
Previous review URL: http://codereview.chromium.org/69043
Review URL: http://codereview.chromium.org/67294
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14053 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser.h')
-rw-r--r-- | chrome/browser/browser.h | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h index af0fb52..d0f2d6f 100644 --- a/chrome/browser/browser.h +++ b/chrome/browser/browser.h @@ -227,15 +227,13 @@ class Browser : public TabStripModelDelegate, PageTransition::Type type); // Add a tab with its session history restored from the SessionRestore - // system. If select is true, the tab is selected. Returns the created - // NavigationController. |tab_index| gives the index to insert the tab at. - // |selected_navigation| is the index of the TabNavigation in |navigations| - // to select. - NavigationController* AddRestoredTab( - const std::vector<TabNavigation>& navigations, - int tab_index, - int selected_navigation, - bool select); + // system. If select is true, the tab is selected. |tab_index| gives the index + // to insert the tab at. |selected_navigation| is the index of the + // TabNavigation in |navigations| to select. + TabContents* AddRestoredTab(const std::vector<TabNavigation>& navigations, + int tab_index, + int selected_navigation, + bool select); // Replaces the state of the currently selected tab with the session // history restored from the SessionRestore system. @@ -525,11 +523,10 @@ class Browser : public TabStripModelDelegate, void SyncHistoryWithTabs(int index); // Called from AddRestoredTab and ReplaceRestoredTab to build a - // NavigationController from an incoming vector of TabNavigations. - // Caller takes ownership of the returned NavigationController. - NavigationController* BuildRestoredNavigationController( - const std::vector<TabNavigation>& navigations, - int selected_navigation); + // TabContents from an incoming vector of TabNavigations. + // Caller takes ownership of the returned TabContents. + TabContents* BuildRestoredTab(const std::vector<TabNavigation>& navigations, + int selected_navigation); // OnBeforeUnload handling ////////////////////////////////////////////////// @@ -639,7 +636,7 @@ class Browser : public TabStripModelDelegate, // toolbar during window creation (i.e. before any tabs have been added // to the window). TabContents* current_tab = browser_->GetSelectedTabContents(); - return current_tab ? current_tab->controller() : NULL; + return current_tab ? ¤t_tab->controller() : NULL; } private: |