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( |