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

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

Issue 10834052: gdata: Add GDataCache::GetResourceIdsOfAllFiles() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_cache.h ('k') | chrome/browser/chromeos/gdata/gdata_cache_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/gdata/gdata_cache.cc
diff --git a/chrome/browser/chromeos/gdata/gdata_cache.cc b/chrome/browser/chromeos/gdata/gdata_cache.cc
index 5c11ad95f6bbca6cfe46f627b4d3de540cbcd526..7558f7c0bcdbb1539d64d31b40e63c4d67c9d58e 100644
--- a/chrome/browser/chromeos/gdata/gdata_cache.cc
+++ b/chrome/browser/chromeos/gdata/gdata_cache.cc
@@ -228,6 +228,15 @@ void CollectExistingPinnedFile(std::vector<std::string>* resource_ids,
resource_ids->push_back(resource_id);
}
+// Appends |resource_id| ID to |resource_ids| unconditionally.
+void CollectAnyFile(std::vector<std::string>* resource_ids,
+ const std::string& resource_id,
+ const GDataCacheEntry& /* cache_entry */) {
+ DCHECK(resource_ids);
+
+ resource_ids->push_back(resource_id);
+}
+
// Runs callback with pointers dereferenced.
// Used to implement SetMountedStateOnUIThread.
void RunSetMountedStateCallback(const SetMountedStateCallback& callback,
@@ -433,6 +442,21 @@ void GDataCache::GetResourceIdsOfExistingPinnedFilesOnUIThread(
base::Owned(resource_ids)));
}
+void GDataCache::GetResourceIdsOfAllFilesOnUIThread(
+ const GetResourceIdsCallback& callback) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ std::vector<std::string>* resource_ids = new std::vector<std::string>;
+ blocking_task_runner_->PostTaskAndReply(
+ FROM_HERE,
+ base::Bind(&GDataCache::GetResourceIdsOfAllFiles,
+ base::Unretained(this),
+ resource_ids),
+ base::Bind(&RunGetResourceIdsCallback,
+ callback,
+ base::Owned(resource_ids)));
+}
+
void GDataCache::FreeDiskSpaceIfNeededFor(int64 num_bytes,
bool* has_enough_space) {
AssertOnSequencedWorkerPool();
@@ -741,6 +765,14 @@ void GDataCache::GetResourceIdsOfExistingPinnedFiles(
metadata_->Iterate(base::Bind(&CollectExistingPinnedFile, resource_ids));
}
+void GDataCache::GetResourceIdsOfAllFiles(
+ std::vector<std::string>* resource_ids) {
+ AssertOnSequencedWorkerPool();
+ DCHECK(resource_ids);
+
+ metadata_->Iterate(base::Bind(&CollectAnyFile, resource_ids));
+}
+
void GDataCache::GetFile(const std::string& resource_id,
const std::string& md5,
GDataFileError* error,
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_cache.h ('k') | chrome/browser/chromeos/gdata/gdata_cache_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698