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

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: 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
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..a562fcf496b0ce8f8f3c1ab9398b32a166bb5286 100644
--- a/chrome/browser/ui/browser_instant_controller.cc
+++ b/chrome/browser/ui/browser_instant_controller.cc
@@ -173,13 +173,10 @@ void BrowserInstantController::ReplaceWebContentsAt(
DCHECK_NE(TabStripModel::kNoTab, index);
content::WebContents* old_contents =
Jered 2013/02/13 23:25:48 I think this should be a scoped_ptr and the call s
sreeram 2013/02/13 23:41:27 Done. Added a comment for clarity too.
sreeram 2013/02/13 23:53:11 Patchset #3 does this correctly now, without any c
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);
+ browser_->tab_strip_model()->ReplaceWebContentsAt(index,
+ new_contents.release());
+ instant_unload_handler_.RunUnloadListenersOrDestroy(
+ scoped_ptr<content::WebContents>(old_contents), index);
}
void BrowserInstantController::SetInstantSuggestion(

Powered by Google App Engine
This is Rietveld 408576698