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

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: Fix spelling error of 'completion' and a few unnecessary newlines. 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 d083d5d34ec7ea4344cc0b2570df4fe9d55955aa..5490eac9f2c2ae498e8f33b076a43e503e3bdaa1 100644
--- a/chrome/browser/chromeos/gdata/gdata_file_system.cc
+++ b/chrome/browser/chromeos/gdata/gdata_file_system.cc
@@ -834,6 +834,13 @@ CallbackType CreateRelayCallback(const CallbackType& callback) {
} // namespace
+void ReadOnlyFindEntryCallback(GDataEntry** out,
+ base::PlatformFileError error,
+ GDataEntry* entry) {
+ if (error == base::PLATFORM_FILE_OK)
+ *out = entry;
+}
+
// GDataFileSystem::GetDocumentsParams struct implementation.
GDataFileSystem::GetDocumentsParams::GetDocumentsParams(
@@ -1050,11 +1057,23 @@ void GDataFileSystem::Authenticate(const AuthStatusCallback& callback) {
documents_service_->Authenticate(callback);
}
-void GDataFileSystem::FindEntryByResourceIdSync(
+void GDataFileSystem::FindEntryByResourceId(const std::string& resource_id,
+ const FindEntryCallback& callback) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) ||
+ BrowserThread::CurrentlyOn(BrowserThread::IO));
+ RunTaskOnUIThread(
+ base::Bind(&GDataFileSystem::FindEntryByResourceIdOnUIThread,
+ ui_weak_ptr_,
+ resource_id,
+ CreateRelayCallback(callback)));
+}
+
+void GDataFileSystem::FindEntryByResourceIdOnUIThread(
const std::string& resource_id,
const FindEntryCallback& callback) {
- base::AutoLock lock(lock_); // To access root.
+ 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