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

Unified Diff: components/sync/engine_impl/sync_scheduler_impl.cc

Issue 2644373003: Revert of [Sync] Make directory types registration explicit in ModelTypeRegistry (Closed)
Patch Set: Created 3 years, 11 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: components/sync/engine_impl/sync_scheduler_impl.cc
diff --git a/components/sync/engine_impl/sync_scheduler_impl.cc b/components/sync/engine_impl/sync_scheduler_impl.cc
index 09a873c896c41687c6d9e73be854d4cb7006e6cf..69559b513ea342ed2c36229a5aea643c48e91bb8 100644
--- a/components/sync/engine_impl/sync_scheduler_impl.cc
+++ b/components/sync/engine_impl/sync_scheduler_impl.cc
@@ -100,10 +100,12 @@
ConfigurationParams::ConfigurationParams(
const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource& source,
ModelTypeSet types_to_download,
+ const ModelSafeRoutingInfo& routing_info,
const base::Closure& ready_task,
const base::Closure& retry_task)
: source(source),
types_to_download(types_to_download),
+ routing_info(routing_info),
ready_task(ready_task),
retry_task(retry_task) {
DCHECK(!ready_task.is_null());
@@ -268,6 +270,25 @@
observer.OnSyncCycleEvent(event);
}
+namespace {
+
+// Helper to extract the routing info corresponding to types in
+// |types_to_download| from |current_routes|.
+void BuildModelSafeParams(ModelTypeSet types_to_download,
+ const ModelSafeRoutingInfo& current_routes,
+ ModelSafeRoutingInfo* result_routes) {
+ for (ModelTypeSet::Iterator iter = types_to_download.First(); iter.Good();
+ iter.Inc()) {
+ ModelType type = iter.Get();
+ ModelSafeRoutingInfo::const_iterator route = current_routes.find(type);
+ DCHECK(route != current_routes.end());
+ ModelSafeGroup group = route->second;
+ (*result_routes)[type] = group;
+ }
+}
+
+} // namespace.
+
void SyncSchedulerImpl::ScheduleConfiguration(
const ConfigurationParams& params) {
DCHECK(CalledOnValidThread());
@@ -280,6 +301,11 @@
// Only one configuration is allowed at a time. Verify we're not waiting
// for a pending configure job.
DCHECK(!pending_configure_params_);
+
+ ModelSafeRoutingInfo restricted_routes;
+ BuildModelSafeParams(params.types_to_download, params.routing_info,
+ &restricted_routes);
+ cycle_context_->SetRoutingInfo(restricted_routes);
// Only reconfigure if we have types to download.
if (!params.types_to_download.Empty()) {
« no previous file with comments | « components/sync/engine_impl/sync_scheduler.h ('k') | components/sync/engine_impl/sync_scheduler_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698