Chromium Code Reviews| Index: chrome/browser/chromeos/gdata/gdata_file_system.cc |
| diff --git a/chrome/browser/chromeos/gdata/gdata_file_system.cc b/chrome/browser/chromeos/gdata/gdata_file_system.cc |
| index e8e111c08ff3dc5ed77a8176a8d3d4367aa2bda0..bce9a19f691b020bc5bae4d3abfd9e6f2b312700 100644 |
| --- a/chrome/browser/chromeos/gdata/gdata_file_system.cc |
| +++ b/chrome/browser/chromeos/gdata/gdata_file_system.cc |
| @@ -233,8 +233,7 @@ void OnCacheUpdatedForAddUploadedFile( |
| // OnTransferCompleted. |
| void OnAddUploadFileCompleted( |
| const FileOperationCallback& callback, |
| - base::PlatformFileError error, |
| - scoped_ptr<UploadFileInfo> /* upload_file_info */) { |
| + base::PlatformFileError error) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| if (!callback.is_null()) |
| callback.Run(error); |
| @@ -1165,19 +1164,12 @@ void GDataFileSystem::OnTransferCompleted( |
| DCHECK(upload_file_info.get()); |
| if (error == base::PLATFORM_FILE_OK && upload_file_info->entry.get()) { |
| - // Save a local copy of the UploadFileInfo pointer. Depending on order of |
| - // argument evaluation, base::Passed() may invalidate the scoped pointer |
| - // |upload_file_info| before it can be dereferenced to access its members. |
| - const UploadFileInfo* upload_file_info_ptr = upload_file_info.get(); |
|
satorux1
2012/07/11 19:17:16
glad to see this brittle piece to be gone.
|
| AddUploadedFile(UPLOAD_NEW_FILE, |
| - upload_file_info_ptr->gdata_path.DirName(), |
| - upload_file_info_ptr->entry.get(), |
| - upload_file_info_ptr->file_path, |
| + upload_file_info->gdata_path.DirName(), |
| + upload_file_info->entry.Pass(), |
| + upload_file_info->file_path, |
| GDataCache::FILE_OPERATION_COPY, |
| - base::Bind(&OnAddUploadFileCompleted, |
| - callback, |
| - error, |
| - base::Passed(&upload_file_info))); |
| + base::Bind(&OnAddUploadFileCompleted, callback, error)); |
| } else if (!callback.is_null()) { |
| callback.Run(error); |
| } |
| @@ -2387,17 +2379,12 @@ void GDataFileSystem::OnUpdatedFileUploaded( |
| return; |
| } |
| - // See comments in OnTransferCompleted() for why we copy this pointer. |
| - const UploadFileInfo* upload_file_info_ptr = upload_file_info.get(); |
|
satorux1
2012/07/11 19:17:16
this one too.
|
| AddUploadedFile(UPLOAD_EXISTING_FILE, |
| - upload_file_info_ptr->gdata_path.DirName(), |
| - upload_file_info_ptr->entry.get(), |
| - upload_file_info_ptr->file_path, |
| + upload_file_info->gdata_path.DirName(), |
| + upload_file_info->entry.Pass(), |
| + upload_file_info->file_path, |
| GDataCache::FILE_OPERATION_MOVE, |
| - base::Bind(&OnAddUploadFileCompleted, |
| - callback, |
| - error, |
| - base::Passed(&upload_file_info))); |
| + base::Bind(&OnAddUploadFileCompleted, callback, error)); |
| } |
| void GDataFileSystem::GetAvailableSpace( |
| @@ -3503,7 +3490,7 @@ base::PlatformFileError GDataFileSystem::RemoveEntryFromGData( |
| void GDataFileSystem::AddUploadedFile( |
| UploadMode upload_mode, |
| const FilePath& virtual_dir_path, |
| - DocumentEntry* entry, |
| + scoped_ptr<DocumentEntry> entry, |
| const FilePath& file_content_path, |
| GDataCache::FileOperationType cache_operation, |
| const base::Closure& callback) { |
| @@ -3517,7 +3504,7 @@ void GDataFileSystem::AddUploadedFile( |
| ui_weak_ptr_, |
| upload_mode, |
| virtual_dir_path, |
| - entry, |
| + base::Passed(&entry), |
| file_content_path, |
| cache_operation, |
| callback)); |
| @@ -3526,14 +3513,14 @@ void GDataFileSystem::AddUploadedFile( |
| void GDataFileSystem::AddUploadedFileOnUIThread( |
| UploadMode upload_mode, |
| const FilePath& virtual_dir_path, |
| - DocumentEntry* entry, |
| + scoped_ptr<DocumentEntry> entry, |
| const FilePath& file_content_path, |
| GDataCache::FileOperationType cache_operation, |
| const base::Closure& callback) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| DCHECK(!callback.is_null()); |
| - if (!entry) { |
| + if (!entry.get()) { |
| NOTREACHED(); |
| callback.Run(); |
| return; |
| @@ -3552,7 +3539,7 @@ void GDataFileSystem::AddUploadedFileOnUIThread( |
| } |
| scoped_ptr<GDataEntry> new_entry( |
| - GDataEntry::FromDocumentEntry(parent_dir, entry, root_.get())); |
| + GDataEntry::FromDocumentEntry(parent_dir, entry.get(), root_.get())); |
| if (!new_entry.get()) { |
| callback.Run(); |
| return; |