diff options
Diffstat (limited to 'chrome/browser/ui/browser_instant_controller.cc')
-rw-r--r-- | chrome/browser/ui/browser_instant_controller.cc | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/chrome/browser/ui/browser_instant_controller.cc b/chrome/browser/ui/browser_instant_controller.cc index 9d92283..14f0113 100644 --- a/chrome/browser/ui/browser_instant_controller.cc +++ b/chrome/browser/ui/browser_instant_controller.cc @@ -169,15 +169,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( |