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 9d7aa28116ea8814c0c227b536c3c91e6ab5710f..676991fc05c6008a71ac05bf227f7f9da0a37c90 100644 |
--- a/chrome/browser/chromeos/gdata/gdata_file_system.cc |
+++ b/chrome/browser/chromeos/gdata/gdata_file_system.cc |
@@ -3527,34 +3527,27 @@ void GDataFileSystem::AddUploadedFileOnUIThread( |
GDataCache::FileOperationType cache_operation, |
const base::Closure& callback) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
- DCHECK(!callback.is_null()); |
+ base::ScopedClosureRunner callback_runner(callback); |
achuithb
2012/08/02 19:08:37
nit: Please add a comment since this is not common
satorux1
2012/08/02 19:41:13
ah this is pretty cool.
hshi1
2012/08/02 19:55:13
Done.
|
if (!entry.get()) { |
NOTREACHED(); |
- callback.Run(); |
return; |
} |
GDataEntry* dir_entry = directory_service_->FindEntryByPathSync( |
virtual_dir_path); |
- if (!dir_entry) { |
- callback.Run(); |
+ if (!dir_entry) |
return; |
- } |
GDataDirectory* parent_dir = dir_entry->AsGDataDirectory(); |
- if (!parent_dir) { |
- callback.Run(); |
+ if (!parent_dir) |
return; |
- } |
scoped_ptr<GDataEntry> new_entry( |
GDataEntry::FromDocumentEntry( |
parent_dir, entry.get(), directory_service_.get())); |
- if (!new_entry.get()) { |
- callback.Run(); |
+ if (!new_entry.get()) |
return; |
- } |
if (upload_mode == UPLOAD_EXISTING_FILE) { |
// Remove an existing entry, which should be present. |
@@ -3579,13 +3572,13 @@ void GDataFileSystem::AddUploadedFileOnUIThread( |
file_content_path, |
cache_operation, |
base::Bind(&OnCacheUpdatedForAddUploadedFile, |
- callback)); |
+ callback_runner.Release())); |
} else if (upload_mode == UPLOAD_EXISTING_FILE) { |
// Clear the dirty bit if we have updated an existing file. |
cache_->ClearDirtyOnUIThread(resource_id, |
md5, |
base::Bind(&OnCacheUpdatedForAddUploadedFile, |
- callback)); |
+ callback_runner.Release())); |
} else { |
NOTREACHED() << "Unexpected upload mode: " << upload_mode; |
} |