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

Unified Diff: chrome/browser/ui/browser_instant_controller.cc

Issue 12256029: Use scoped_ptr to document ownership in InstantUnloadHandler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More correct ownership semantics Created 7 years, 10 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/instant/instant_unload_handler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_instant_controller.cc
diff --git a/chrome/browser/ui/browser_instant_controller.cc b/chrome/browser/ui/browser_instant_controller.cc
index 4cdc6d43f3b1187fdb4951010b9f1c4cf0e258e3..d359be86679da70b482dc8e4b8b0829ba7553041 100644
--- a/chrome/browser/ui/browser_instant_controller.cc
+++ b/chrome/browser/ui/browser_instant_controller.cc
@@ -171,15 +171,10 @@ void BrowserInstantController::ReplaceWebContentsAt(
int index,
scoped_ptr<content::WebContents> new_contents) {
DCHECK_NE(TabStripModel::kNoTab, index);
- content::WebContents* old_contents =
- browser_->tab_strip_model()->GetWebContentsAt(index);
- // TabStripModel takes ownership of |new_contents|.
- browser_->tab_strip_model()->ReplaceWebContentsAt(
- index, new_contents.release());
- // TODO(samarth): use scoped_ptr instead of comments to document ownership
- // transfer.
- // InstantUnloadHandler takes ownership of |old_contents|.
- instant_unload_handler_.RunUnloadListenersOrDestroy(old_contents, index);
+ scoped_ptr<content::WebContents> old_contents(browser_->tab_strip_model()->
+ ReplaceWebContentsAt(index, new_contents.release()));
+ instant_unload_handler_.RunUnloadListenersOrDestroy(old_contents.Pass(),
+ index);
}
void BrowserInstantController::SetInstantSuggestion(
« no previous file with comments | « chrome/browser/instant/instant_unload_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698