Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Unified Diff: chrome/browser/chromeos/gdata/gdata_file_system.cc

Issue 10538071: gdata: Convert FindEntryByResourceIdSync() to asynchronous. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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)

Powered by Google App Engine
This is Rietveld 408576698