diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-01 16:24:55 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-01 16:24:55 +0000 |
commit | 8be8294d1b808cc713241b7255d2ce3ebbed4718 (patch) | |
tree | 100287e38fe6924ffe5db5488dbe64b5d7df1ced /chrome/browser | |
parent | 1758e88fd909ea0ffd49621e8066ffad5627ffdf (diff) | |
download | chromium_src-8be8294d1b808cc713241b7255d2ce3ebbed4718.zip chromium_src-8be8294d1b808cc713241b7255d2ce3ebbed4718.tar.gz chromium_src-8be8294d1b808cc713241b7255d2ce3ebbed4718.tar.bz2 |
Use make_scoped_refptr for NewRunnableMethod if the raw ptr type is derived from RefCountedThreadSafe
Like http://codereview.chromium.org/4053006 , but for all of chrome.
This CL was created automatically by this clang rewriter: http://codereview.appspot.com/2809041. I manually fixed the one presubmit warning the rewriter introduced.
BUG=28083
TEST=None
Review URL: http://codereview.chromium.org/4188008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64614 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
5 files changed, 16 insertions, 10 deletions
diff --git a/chrome/browser/debugger/devtools_http_protocol_handler.cc b/chrome/browser/debugger/devtools_http_protocol_handler.cc index 5f01335..307aa84 100644 --- a/chrome/browser/debugger/devtools_http_protocol_handler.cc +++ b/chrome/browser/debugger/devtools_http_protocol_handler.cc @@ -95,7 +95,7 @@ void DevToolsHttpProtocolHandler::OnHttpRequest( FROM_HERE, NewRunnableMethod(this, &DevToolsHttpProtocolHandler::OnHttpRequestUI, - socket, + make_scoped_refptr(socket), info)); return; } @@ -123,7 +123,7 @@ void DevToolsHttpProtocolHandler::OnWebSocketRequest( NewRunnableMethod( this, &DevToolsHttpProtocolHandler::OnWebSocketRequestUI, - socket, + make_scoped_refptr(socket), request)); } @@ -135,7 +135,7 @@ void DevToolsHttpProtocolHandler::OnWebSocketMessage(HttpListenSocket* socket, NewRunnableMethod( this, &DevToolsHttpProtocolHandler::OnWebSocketMessageUI, - socket, + make_scoped_refptr(socket), data)); } @@ -154,6 +154,8 @@ void DevToolsHttpProtocolHandler::OnClose(HttpListenSocket* socket) { socket_to_requests_io_.erase(socket); } + // This can't use make_scoped_refptr because |socket| is already deleted + // when this runs -- http://crbug.com/59930 BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, diff --git a/chrome/browser/download/download_file_manager.cc b/chrome/browser/download/download_file_manager.cc index 8415c87..a8202e1 100644 --- a/chrome/browser/download/download_file_manager.cc +++ b/chrome/browser/download/download_file_manager.cc @@ -176,7 +176,7 @@ void DownloadFileManager::StartDownload(DownloadCreateInfo* info) { BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, NewRunnableMethod(this, &DownloadFileManager::CreateDownloadFile, - info, manager)); + info, make_scoped_refptr(manager))); } // We don't forward an update to the UI thread here, since we want to throttle diff --git a/chrome/browser/file_path_watcher_browsertest.cc b/chrome/browser/file_path_watcher_browsertest.cc index fe98189..a337ae3 100644 --- a/chrome/browser/file_path_watcher_browsertest.cc +++ b/chrome/browser/file_path_watcher_browsertest.cc @@ -44,7 +44,7 @@ class NotificationCollector loop_->PostTask(FROM_HERE, NewRunnableMethod(this, &NotificationCollector::RecordChange, - delegate)); + make_scoped_refptr(delegate))); } void Register(TestDelegate* delegate) { diff --git a/chrome/browser/importer/importer_unittest.cc b/chrome/browser/importer/importer_unittest.cc index 5261c03..214f056 100644 --- a/chrome/browser/importer/importer_unittest.cc +++ b/chrome/browser/importer/importer_unittest.cc @@ -122,7 +122,7 @@ class ImporterTest : public testing::Test { items = items | SEARCH_ENGINES; loop->PostTask(FROM_HERE, NewRunnableMethod(host.get(), &ImporterHost::StartImportSettings, profile_info, - static_cast<Profile*>(NULL), items, writer, true)); + static_cast<Profile*>(NULL), items, make_scoped_refptr(writer), true)); loop->Run(); } @@ -705,10 +705,14 @@ TEST_F(ImporterTest, MAYBE(Firefox2Importer)) { profile_info.app_path = app_path_; profile_info.source_path = profile_path_; - loop->PostTask(FROM_HERE, NewRunnableMethod(host.get(), - &ImporterHost::StartImportSettings, profile_info, + loop->PostTask(FROM_HERE, NewRunnableMethod( + host.get(), + &ImporterHost::StartImportSettings, + profile_info, static_cast<Profile*>(NULL), - HISTORY | PASSWORDS | FAVORITES | SEARCH_ENGINES, observer, true)); + HISTORY | PASSWORDS | FAVORITES | SEARCH_ENGINES, + make_scoped_refptr(observer), + true)); loop->Run(); } diff --git a/chrome/browser/notifications/desktop_notification_service_unittest.cc b/chrome/browser/notifications/desktop_notification_service_unittest.cc index 9f0067c..3c1c8ca 100644 --- a/chrome/browser/notifications/desktop_notification_service_unittest.cc +++ b/chrome/browser/notifications/desktop_notification_service_unittest.cc @@ -42,7 +42,7 @@ class ThreadProxy : public base::RefCountedThreadSafe<ThreadProxy> { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, NewRunnableMethod(this, &ThreadProxy::CacheHasPermissionIO, - cache, url)); + make_scoped_refptr(cache), url)); io_event_.Signal(); ui_event_.Wait(); // Wait for IO thread to be done. BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |