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 c73dd2ef28ce7efee16403340e8856313aba483c..871b3ebecacb646ffb14486b25c6d4453364f9ee 100644 |
| --- a/chrome/browser/chromeos/gdata/gdata_file_system.cc |
| +++ b/chrome/browser/chromeos/gdata/gdata_file_system.cc |
| @@ -1041,11 +1041,24 @@ void GDataFileSystem::Authenticate(const AuthStatusCallback& callback) { |
| documents_service_->Authenticate(callback); |
| } |
| -void GDataFileSystem::FindEntryByResourceIdSync( |
| +void GDataFileSystem::FindEntryByResourceIdAsync( |
| const std::string& resource_id, |
| const FindEntryCallback& callback) { |
| - base::AutoLock lock(lock_); // To access root. |
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || |
|
achuithb
2012/06/11 20:46:37
Not sure I understand the point of this DCHECK?
hshi1
2012/06/11 20:58:51
This is essentially a copy & paste of the many oth
achuithb
2012/06/11 21:48:41
I've not seen this pattern before (outside of this
|
| + BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| + RunTaskOnUIThread( |
| + base::Bind(&GDataFileSystem::FindEntryByResourceIdAsyncOnUIThread, |
| + ui_weak_ptr_, |
| + resource_id, |
| + CreateRelayCallback(callback))); |
| +} |
| + |
| +void GDataFileSystem::FindEntryByResourceIdAsyncOnUIThread( |
| + const std::string& resource_id, |
| + const FindEntryCallback& callback) { |
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| + base::AutoLock lock(lock_); // To access root. |
| GDataFile* file = NULL; |
| GDataEntry* entry = root_->GetEntryByResourceId(resource_id); |
| if (entry) |