Index: chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.cc |
diff --git a/chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.cc b/chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.cc |
index 6afa05c997c61a6ac1f37d8490dde9a9f6914ac2..38cb6ac2f5e8074922fd74836645a8927b0e49cd 100644 |
--- a/chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.cc |
+++ b/chrome/browser/sync_file_system/drive_backend/metadata_database_index_on_disk.cc |
@@ -494,6 +494,36 @@ int64 MetadataDatabaseIndexOnDisk::PickDirtyTracker() const { |
return tracker_id; |
} |
+void MetadataDatabaseIndexOnDisk::EnumerateDirtyTrackers( |
+ const TrackerIDCallback& callback) const { |
+ scoped_ptr<LevelDBWrapper::Iterator> itr = db_->NewIterator(); |
+ for (itr->Seek(kDirtyIDKeyPrefix); itr->Valid(); itr->Next()) { |
+ std::string id_str; |
+ if (!RemovePrefix(itr->key().ToString(), kDirtyIDKeyPrefix, &id_str)) |
+ break; |
+ |
+ int64 tracker_id = 0; |
+ if (!base::StringToInt64(id_str, &tracker_id)) { |
+ NOTREACHED(); |
+ continue; |
+ } |
+ callback.Run(tracker_id); |
+ } |
+ |
+ for (itr->Seek(kDemotedDirtyIDKeyPrefix); itr->Valid(); itr->Next()) { |
+ std::string id_str; |
+ if (!RemovePrefix(itr->key().ToString(), kDemotedDirtyIDKeyPrefix, &id_str)) |
+ break; |
+ |
+ int64 tracker_id = 0; |
+ if (!base::StringToInt64(id_str, &tracker_id)) { |
+ NOTREACHED(); |
+ continue; |
+ } |
+ callback.Run(tracker_id); |
+ } |
+} |
+ |
void MetadataDatabaseIndexOnDisk::DemoteDirtyTracker(int64 tracker_id) { |
const std::string key = GenerateDirtyIDKey(tracker_id); |