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

Unified Diff: sync/sessions/sync_session.cc

Issue 10947039: Removed safe worker calculation from SyncScheduler. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 3 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: sync/sessions/sync_session.cc
diff --git a/sync/sessions/sync_session.cc b/sync/sessions/sync_session.cc
index b7bb5ca3c7f40bcf4410fb6e657d87304ad42cc1..6b3db326d31ca09f1be982ecb27bb5b848a0df65 100644
--- a/sync/sessions/sync_session.cc
+++ b/sync/sessions/sync_session.cc
@@ -18,8 +18,7 @@ namespace sessions {
namespace {
std::set<ModelSafeGroup> ComputeEnabledGroups(
- const ModelSafeRoutingInfo& routing_info,
- const std::vector<ModelSafeWorker*>& workers) {
+ const ModelSafeRoutingInfo& routing_info) {
std::set<ModelSafeGroup> enabled_groups;
// Project the list of enabled types (i.e., types in the routing
// info) to a list of enabled groups.
@@ -30,21 +29,6 @@ std::set<ModelSafeGroup> ComputeEnabledGroups(
// GROUP_PASSIVE is always enabled, since that's the group that
// top-level folders map to.
enabled_groups.insert(GROUP_PASSIVE);
- if (DCHECK_IS_ON()) {
- // We sometimes create dummy SyncSession objects (see
- // SyncScheduler::InitialSnapshot) so don't check in that case.
- if (!routing_info.empty() || !workers.empty()) {
- std::set<ModelSafeGroup> groups_with_workers;
- for (std::vector<ModelSafeWorker*>::const_iterator it = workers.begin();
- it != workers.end(); ++it) {
- groups_with_workers.insert((*it)->GetModelSafeGroup());
- }
- // All enabled groups should have a corresponding worker.
- DCHECK(std::includes(
- groups_with_workers.begin(), groups_with_workers.end(),
- enabled_groups.begin(), enabled_groups.end()));
- }
- }
return enabled_groups;
}
@@ -68,19 +52,16 @@ void PurgeStaleStates(ModelTypeStateMap* original,
} // namesepace
SyncSession::SyncSession(SyncSessionContext* context, Delegate* delegate,
- const SyncSourceInfo& source,
- const ModelSafeRoutingInfo& routing_info,
- const std::vector<ModelSafeWorker*>& workers)
+ const SyncSourceInfo& source,
+ const ModelSafeRoutingInfo& routing_info)
: context_(context),
source_(source),
write_transaction_(NULL),
delegate_(delegate),
- workers_(workers),
rlarocque 2012/09/19 20:39:21 What will be the effect of sync sessions with no w
routing_info_(routing_info),
- enabled_groups_(ComputeEnabledGroups(routing_info_, workers_)),
+ enabled_groups_(ComputeEnabledGroups(routing_info_)),
finished_(false) {
status_controller_.reset(new StatusController(routing_info_));
- std::sort(workers_.begin(), workers_.end());
}
SyncSession::~SyncSession() {}
@@ -96,12 +77,6 @@ void SyncSession::Coalesce(const SyncSession& session) {
CoalesceStates(&source_.types, session.source_.types);
source_.updates_source = session.source_.updates_source;
- std::vector<ModelSafeWorker*> temp;
- std::set_union(workers_.begin(), workers_.end(),
- session.workers_.begin(), session.workers_.end(),
- std::back_inserter(temp));
- workers_.swap(temp);
-
// We have to update the model safe routing info to the union. In case the
// same key is present in both pick the one from session.
for (ModelSafeRoutingInfo::const_iterator it =
@@ -112,7 +87,7 @@ void SyncSession::Coalesce(const SyncSession& session) {
}
// Now update enabled groups.
- enabled_groups_ = ComputeEnabledGroups(routing_info_, workers_);
+ enabled_groups_ = ComputeEnabledGroups(routing_info_);
}
void SyncSession::RebaseRoutingInfoWithLatest(const SyncSession& session) {
@@ -134,15 +109,8 @@ void SyncSession::RebaseRoutingInfoWithLatest(const SyncSession& session) {
// Now update the payload map.
PurgeStaleStates(&source_.types, session.routing_info_);
- // Now update the workers.
- std::vector<ModelSafeWorker*> temp;
- std::set_intersection(workers_.begin(), workers_.end(),
- session.workers_.begin(), session.workers_.end(),
- std::back_inserter(temp));
- workers_.swap(temp);
-
// Now update enabled groups.
- enabled_groups_ = ComputeEnabledGroups(routing_info_, workers_);
+ enabled_groups_ = ComputeEnabledGroups(routing_info_);
}
void SyncSession::PrepareForAnotherSyncCycle() {

Powered by Google App Engine
This is Rietveld 408576698