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

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

Issue 10815008: gdata: Make GDataFileSystem::ReadDirectoryByPath() much more efficient (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove a blank line Created 8 years, 5 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 f246808119a5c62f5e37bd7bb350b8108923cc79..bf441df31f4bad2b6249e5036a95cb525e178ff4 100644
--- a/chrome/browser/chromeos/gdata/gdata_file_system.cc
+++ b/chrome/browser/chromeos/gdata/gdata_file_system.cc
@@ -2237,7 +2237,7 @@ void GDataFileSystem::OnReadDirectory(const ReadDirectoryCallback& callback,
if (!callback.is_null())
callback.Run(error,
hide_hosted_docs_,
- scoped_ptr<GDataDirectoryProto>());
+ scoped_ptr<GDataEntryProtoVector>());
return;
}
DCHECK(entry);
@@ -2247,17 +2247,28 @@ void GDataFileSystem::OnReadDirectory(const ReadDirectoryCallback& callback,
if (!callback.is_null())
callback.Run(GDATA_FILE_ERROR_NOT_FOUND,
hide_hosted_docs_,
- scoped_ptr<GDataDirectoryProto>());
+ scoped_ptr<GDataEntryProtoVector>());
return;
}
- scoped_ptr<GDataDirectoryProto> directory_proto(new GDataDirectoryProto);
- directory->ToProto(directory_proto.get());
+ scoped_ptr<GDataEntryProtoVector> entries(new GDataEntryProtoVector);
+ for (GDataFileCollection::const_iterator iter =
+ directory->child_files().begin();
+ iter != directory->child_files().end(); ++iter) {
+ GDataEntryProto proto;
+ static_cast<const GDataEntry*>(iter->second)->ToProtoFull(&proto);
+ entries->push_back(proto);
+ }
+ for (GDataDirectoryCollection::const_iterator iter =
+ directory->child_directories().begin();
+ iter != directory->child_directories().end(); ++iter) {
+ GDataEntryProto proto;
+ static_cast<const GDataEntry*>(iter->second)->ToProtoFull(&proto);
+ entries->push_back(proto);
+ }
if (!callback.is_null())
- callback.Run(GDATA_FILE_OK,
- hide_hosted_docs_,
- directory_proto.Pass());
+ callback.Run(GDATA_FILE_OK, hide_hosted_docs_, entries.Pass());
}
void GDataFileSystem::RequestDirectoryRefresh(const FilePath& file_path) {

Powered by Google App Engine
This is Rietveld 408576698