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

Unified Diff: chrome/browser/sync_file_system/sync_file_system_service.cc

Issue 294893005: [SyncFS] Make GetOriginStatusMap asynchronous (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refactoring Created 6 years, 7 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/sync_file_system/sync_file_system_service.cc
diff --git a/chrome/browser/sync_file_system/sync_file_system_service.cc b/chrome/browser/sync_file_system/sync_file_system_service.cc
index 8fb7b71750986440e968d47b60324e708b6a7e27..927d8a067c4940d81ffb0b1b039f9d3fc6512ab0 100644
--- a/chrome/browser/sync_file_system/sync_file_system_service.cc
+++ b/chrome/browser/sync_file_system/sync_file_system_service.cc
@@ -305,12 +305,10 @@ SyncServiceState SyncFileSystemService::GetSyncServiceState() {
}
void SyncFileSystemService::GetExtensionStatusMap(
- std::map<GURL, std::string>* status_map) {
- DCHECK(status_map);
- status_map->clear();
- remote_service_->GetOriginStatusMap(status_map);
- if (v2_remote_service_)
- v2_remote_service_->GetOriginStatusMap(status_map);
+ const RemoteFileSyncService::StatusMapCallback& callback) {
+ remote_service_->GetOriginStatusMap(
+ base::Bind(&SyncFileSystemService::DidGetExtensionStatusMap,
+ AsWeakPtr(), callback));
}
void SyncFileSystemService::DumpFiles(const GURL& origin,
@@ -578,6 +576,32 @@ void SyncFileSystemService::DidDumpV2Database(
callback.Run(*v1list);
}
+void SyncFileSystemService::DidGetExtensionStatusMap(
+ const RemoteFileSyncService::StatusMapCallback& callback,
+ const RemoteFileSyncService::OriginStatusMap& status_map) {
+ if (!v2_remote_service_) {
+ callback.Run(status_map);
+ return;
+ }
+
+ v2_remote_service_->GetOriginStatusMap(
+ base::Bind(&SyncFileSystemService::DidGetV2ExtensionStatusMap,
+ AsWeakPtr(), callback, status_map));
+}
+
+void SyncFileSystemService::DidGetV2ExtensionStatusMap(
+ const RemoteFileSyncService::StatusMapCallback& callback,
+ const RemoteFileSyncService::OriginStatusMap& status_map_v1,
+ const RemoteFileSyncService::OriginStatusMap& status_map_v2) {
+ // Merge |status_map_v2| into |status_map_v1|.
+ std::map<GURL, std::string> status_map(status_map_v1);
+ for (std::map<GURL, std::string>::const_iterator itr = status_map_v2.begin();
+ itr != status_map_v2.end(); ++itr)
+ status_map.insert(*itr);
tzik 2014/05/21 10:52:33 I think just status_map.insert(status_map_v2.begin
peria 2014/05/22 02:25:21 Done.
+
+ callback.Run(status_map);
+}
+
void SyncFileSystemService::SetSyncEnabledForTesting(bool enabled) {
sync_enabled_ = enabled;
remote_service_->SetSyncEnabled(sync_enabled_);

Powered by Google App Engine
This is Rietveld 408576698