diff options
author | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-20 23:14:23 +0000 |
---|---|---|
committer | jamesr@chromium.org <jamesr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-20 23:14:23 +0000 |
commit | f8f8250237f535750e0d8269d2762f52db090e45 (patch) | |
tree | 1cdf3da8041969b9b0ac8c045ca2bf458256ca66 /chrome/browser | |
parent | c1dc9f130ed8792c3e821f486d3c5e1ed4e567f3 (diff) | |
download | chromium_src-f8f8250237f535750e0d8269d2762f52db090e45.zip chromium_src-f8f8250237f535750e0d8269d2762f52db090e45.tar.gz chromium_src-f8f8250237f535750e0d8269d2762f52db090e45.tar.bz2 |
Forces T*s to scoped_refptr<T> when PostTask()ing to a function expecting scoped_refptr<T>
Review URL: http://codereview.chromium.org/418007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32706 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/browser_about_handler.cc | 3 | ||||
-rw-r--r-- | chrome/browser/dom_ui/downloads_dom_handler.cc | 7 | ||||
-rw-r--r-- | chrome/browser/dom_ui/downloads_ui.cc | 2 | ||||
-rw-r--r-- | chrome/browser/dom_ui/filebrowse_ui.cc | 4 | ||||
-rw-r--r-- | chrome/browser/dom_ui/history_ui.cc | 4 | ||||
-rw-r--r-- | chrome/browser/dom_ui/most_visited_handler.cc | 18 | ||||
-rw-r--r-- | chrome/browser/dom_ui/new_tab_ui.cc | 16 | ||||
-rw-r--r-- | chrome/browser/dom_ui/print_ui.cc | 2 | ||||
-rw-r--r-- | chrome/browser/extensions/extension_updater.cc | 2 | ||||
-rw-r--r-- | chrome/browser/extensions/extensions_ui.cc | 2 | ||||
-rw-r--r-- | chrome/browser/sync/sync_setup_wizard.cc | 8 |
11 files changed, 26 insertions, 42 deletions
diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index 44fab78..79abe28 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -598,7 +598,8 @@ AboutSource::AboutSource() ChromeThread::IO, FROM_HERE, NewRunnableMethod( Singleton<ChromeURLDataManager>::get(), - &ChromeURLDataManager::AddDataSource, this)); + &ChromeURLDataManager::AddDataSource, + make_scoped_refptr(this))); } AboutSource::~AboutSource() { diff --git a/chrome/browser/dom_ui/downloads_dom_handler.cc b/chrome/browser/dom_ui/downloads_dom_handler.cc index 028b21a..7e8d1a0 100644 --- a/chrome/browser/dom_ui/downloads_dom_handler.cc +++ b/chrome/browser/dom_ui/downloads_dom_handler.cc @@ -49,9 +49,10 @@ DownloadsDOMHandler::DownloadsDOMHandler(DownloadManager* dlm) // Create our fileicon data source. ChromeThread::PostTask( ChromeThread::IO, FROM_HERE, - NewRunnableMethod(Singleton<ChromeURLDataManager>::get(), - &ChromeURLDataManager::AddDataSource, - new FileIconSource())); + NewRunnableMethod( + Singleton<ChromeURLDataManager>::get(), + &ChromeURLDataManager::AddDataSource, + make_scoped_refptr(new FileIconSource()))); } DownloadsDOMHandler::~DownloadsDOMHandler() { diff --git a/chrome/browser/dom_ui/downloads_ui.cc b/chrome/browser/dom_ui/downloads_ui.cc index e36654f..f12e812 100644 --- a/chrome/browser/dom_ui/downloads_ui.cc +++ b/chrome/browser/dom_ui/downloads_ui.cc @@ -133,7 +133,7 @@ DownloadsUI::DownloadsUI(TabContents* contents) : DOMUI(contents) { ChromeThread::IO, FROM_HERE, NewRunnableMethod(Singleton<ChromeURLDataManager>::get(), &ChromeURLDataManager::AddDataSource, - html_source)); + make_scoped_refptr(html_source))); } // static diff --git a/chrome/browser/dom_ui/filebrowse_ui.cc b/chrome/browser/dom_ui/filebrowse_ui.cc index 48ed389..13b6539 100644 --- a/chrome/browser/dom_ui/filebrowse_ui.cc +++ b/chrome/browser/dom_ui/filebrowse_ui.cc @@ -157,7 +157,7 @@ DOMMessageHandler* FilebrowseHandler::Attach(DOMUI* dom_ui) { NewRunnableMethod( Singleton<ChromeURLDataManager>::get(), &ChromeURLDataManager::AddDataSource, - new DOMUIFavIconSource(dom_ui->GetProfile()))); + make_scoped_refptr(new DOMUIFavIconSource(dom_ui->GetProfile())))); profile_ = dom_ui->GetProfile(); return DOMMessageHandler::Attach(dom_ui); } @@ -323,5 +323,5 @@ FileBrowseUI::FileBrowseUI(TabContents* contents) : DOMUI(contents) { NewRunnableMethod( Singleton<ChromeURLDataManager>::get(), &ChromeURLDataManager::AddDataSource, - html_source)); + make_scoped_refptr(html_source))); } diff --git a/chrome/browser/dom_ui/history_ui.cc b/chrome/browser/dom_ui/history_ui.cc index dce9cdb..a97992b 100644 --- a/chrome/browser/dom_ui/history_ui.cc +++ b/chrome/browser/dom_ui/history_ui.cc @@ -116,7 +116,7 @@ DOMMessageHandler* BrowsingHistoryHandler::Attach(DOMUI* dom_ui) { NewRunnableMethod( Singleton<ChromeURLDataManager>::get(), &ChromeURLDataManager::AddDataSource, - new DOMUIFavIconSource(dom_ui->GetProfile()))); + make_scoped_refptr(new DOMUIFavIconSource(dom_ui->GetProfile())))); // Get notifications when history is cleared. registrar_.Add(this, NotificationType::HISTORY_URLS_DELETED, @@ -371,7 +371,7 @@ HistoryUI::HistoryUI(TabContents* contents) : DOMUI(contents) { NewRunnableMethod( Singleton<ChromeURLDataManager>::get(), &ChromeURLDataManager::AddDataSource, - html_source)); + make_scoped_refptr(html_source))); } // static diff --git a/chrome/browser/dom_ui/most_visited_handler.cc b/chrome/browser/dom_ui/most_visited_handler.cc index 7dc5569..8901d3f9 100644 --- a/chrome/browser/dom_ui/most_visited_handler.cc +++ b/chrome/browser/dom_ui/most_visited_handler.cc @@ -59,24 +59,18 @@ DOMMessageHandler* MostVisitedHandler::Attach(DOMUI* dom_ui) { // Set up our sources for thumbnail and favicon data. DOMUIThumbnailSource* thumbnail_src = new DOMUIThumbnailSource(dom_ui->GetProfile()); - bool posted = ChromeThread::PostTask( + ChromeThread::PostTask( ChromeThread::IO, FROM_HERE, NewRunnableMethod(Singleton<ChromeURLDataManager>::get(), - &ChromeURLDataManager::AddDataSource, thumbnail_src)); - if (!posted) { - thumbnail_src->AddRef(); - thumbnail_src->Release(); // Keep Valgrind happy in unit tests. - } + &ChromeURLDataManager::AddDataSource, + make_scoped_refptr(thumbnail_src))); DOMUIFavIconSource* favicon_src = new DOMUIFavIconSource(dom_ui->GetProfile()); - posted = ChromeThread::PostTask( + ChromeThread::PostTask( ChromeThread::IO, FROM_HERE, NewRunnableMethod(Singleton<ChromeURLDataManager>::get(), - &ChromeURLDataManager::AddDataSource, favicon_src)); - if (!posted) { - favicon_src->AddRef(); - favicon_src->Release(); // Keep Valgrind happy in unit tests. - } + &ChromeURLDataManager::AddDataSource, + make_scoped_refptr(favicon_src))); // Get notifications when history is cleared. registrar_.Add(this, NotificationType::HISTORY_URLS_DELETED, diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc index b11d7b4..a69a4ba 100644 --- a/chrome/browser/dom_ui/new_tab_ui.cc +++ b/chrome/browser/dom_ui/new_tab_ui.cc @@ -483,16 +483,12 @@ NewTabUI::NewTabUI(TabContents* contents) InitializeCSSCaches(); NewTabHTMLSource* html_source = new NewTabHTMLSource(GetProfile()->GetOriginalProfile()); - bool posted = ChromeThread::PostTask( + ChromeThread::PostTask( ChromeThread::IO, FROM_HERE, NewRunnableMethod( Singleton<ChromeURLDataManager>::get(), &ChromeURLDataManager::AddDataSource, - html_source)); - if (!posted) { - html_source->AddRef(); - html_source->Release(); // Keep Valgrind happy in tests. - } + make_scoped_refptr(html_source))); if (!GetProfile()->IsOffTheRecord()) { AddMessageHandler((new ShownSectionsHandler())->Attach(this)); @@ -544,16 +540,12 @@ void NewTabUI::Observe(NotificationType type, void NewTabUI::InitializeCSSCaches() { DOMUIThemeSource* theme = new DOMUIThemeSource(GetProfile()); - bool posted = ChromeThread::PostTask( + ChromeThread::PostTask( ChromeThread::IO, FROM_HERE, NewRunnableMethod( Singleton<ChromeURLDataManager>::get(), &ChromeURLDataManager::AddDataSource, - theme)); - if (!posted) { - theme->AddRef(); - theme->Release(); // Keep Valgrind happy in tests. - } + make_scoped_refptr(theme))); } // static diff --git a/chrome/browser/dom_ui/print_ui.cc b/chrome/browser/dom_ui/print_ui.cc index 31146ab..5aea8d7 100644 --- a/chrome/browser/dom_ui/print_ui.cc +++ b/chrome/browser/dom_ui/print_ui.cc @@ -32,7 +32,7 @@ PrintUI::PrintUI(TabContents* contents) : DOMUI(contents) { NewRunnableMethod( Singleton<ChromeURLDataManager>::get(), &ChromeURLDataManager::AddDataSource, - html_source)); + make_scoped_refptr(html_source))); } //////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/extensions/extension_updater.cc b/chrome/browser/extensions/extension_updater.cc index 6578024..a219b0d 100644 --- a/chrome/browser/extensions/extension_updater.cc +++ b/chrome/browser/extensions/extension_updater.cc @@ -363,7 +363,7 @@ void ExtensionUpdater::OnCRXFetchComplete(const GURL& url, ChromeThread::FILE, FROM_HERE, NewRunnableMethod( file_handler_.get(), &ExtensionUpdaterFileHandler::WriteTempFile, - current_extension_fetch_.id, data, this)); + current_extension_fetch_.id, data, make_scoped_refptr(this))); } } else { // TODO(asargent) do things like exponential backoff, handling diff --git a/chrome/browser/extensions/extensions_ui.cc b/chrome/browser/extensions/extensions_ui.cc index 2af1c01..7eb58bb 100644 --- a/chrome/browser/extensions/extensions_ui.cc +++ b/chrome/browser/extensions/extensions_ui.cc @@ -739,7 +739,7 @@ ExtensionsUI::ExtensionsUI(TabContents* contents) : DOMUI(contents) { NewRunnableMethod( Singleton<ChromeURLDataManager>::get(), &ChromeURLDataManager::AddDataSource, - html_source)); + make_scoped_refptr(html_source))); } // static diff --git a/chrome/browser/sync/sync_setup_wizard.cc b/chrome/browser/sync/sync_setup_wizard.cc index e6f7bd8..e003b49 100644 --- a/chrome/browser/sync/sync_setup_wizard.cc +++ b/chrome/browser/sync/sync_setup_wizard.cc @@ -180,15 +180,11 @@ SyncSetupWizard::SyncSetupWizard(ProfileSyncService* service) flow_container_(new SyncSetupFlowContainer()) { // Add our network layer data source for 'cloudy' URLs. SyncResourcesSource* sync_source = new SyncResourcesSource(); - bool posted = ChromeThread::PostTask( + ChromeThread::PostTask( ChromeThread::IO, FROM_HERE, NewRunnableMethod(Singleton<ChromeURLDataManager>::get(), &ChromeURLDataManager::AddDataSource, - sync_source)); - if (!posted) { - sync_source->AddRef(); - sync_source->Release(); // Keep Valgrind happy in unit tests. - } + make_scoped_refptr(sync_source))); } SyncSetupWizard::~SyncSetupWizard() { |