diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-19 15:48:36 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-19 15:48:36 +0000 |
commit | 71d4bd80077d11ebf351d0c2a901d9ccb4e0fbec (patch) | |
tree | e5509abca9f20a386985ab220198ed058d0bf0e5 | |
parent | ee6398fb06dc165087260f2dd76008617ab17f3c (diff) | |
download | chromium_src-71d4bd80077d11ebf351d0c2a901d9ccb4e0fbec.zip chromium_src-71d4bd80077d11ebf351d0c2a901d9ccb4e0fbec.tar.gz chromium_src-71d4bd80077d11ebf351d0c2a901d9ccb4e0fbec.tar.bz2 |
Cleanup: Use PostTaskAndReplyWithResults in ImageCaptureDevice.
Review URL: https://codereview.chromium.org/27692004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@229570 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/storage_monitor/image_capture_device.mm | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/chrome/browser/storage_monitor/image_capture_device.mm b/chrome/browser/storage_monitor/image_capture_device.mm index e70be83..dfbb606 100644 --- a/chrome/browser/storage_monitor/image_capture_device.mm +++ b/chrome/browser/storage_monitor/image_capture_device.mm @@ -9,23 +9,20 @@ namespace { -void RenameFile(const base::FilePath& downloaded_filename, - const base::FilePath& desired_filename, - base::PlatformFileError* result) { +base::PlatformFileError RenameFile(const base::FilePath& downloaded_filename, + const base::FilePath& desired_filename) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); bool success = base::ReplaceFile(downloaded_filename, desired_filename, NULL); - *result = success ? base::PLATFORM_FILE_OK - : base::PLATFORM_FILE_ERROR_NOT_FOUND; + return success ? base::PLATFORM_FILE_OK : base::PLATFORM_FILE_ERROR_NOT_FOUND; } void ReturnRenameResultToListener( base::WeakPtr<ImageCaptureDeviceListener> listener, const std::string& name, - base::PlatformFileError* result) { + const base::PlatformFileError& result) { DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); - scoped_ptr<base::PlatformFileError> result_deleter(result); if (listener) - listener->DownloadedFile(name, *result); + listener->DownloadedFile(name, result); } base::Time NSDateToBaseTime(NSDate* date) { @@ -214,12 +211,11 @@ base::FilePath PathForCameraItem(ICCameraItem* item) { base::FilePath saveAsPath = saveDir.Append(saveAsFilename); base::FilePath savedPath = saveDir.Append(savedFilename); // Shared result value from file-copy closure to tell-listener closure. - base::PlatformFileError* copyResult = new base::PlatformFileError(); - content::BrowserThread::PostTaskAndReply( + content::BrowserThread::PostTaskAndReplyWithResult( content::BrowserThread::FILE, FROM_HERE, - base::Bind(&RenameFile, savedPath, saveAsPath, copyResult), - base::Bind(&ReturnRenameResultToListener, listener_, name, copyResult)); + base::Bind(&RenameFile, savedPath, saveAsPath), + base::Bind(&ReturnRenameResultToListener, listener_, name)); } @end // ImageCaptureDevice |