diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-08 22:25:33 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-08 22:25:33 +0000 |
commit | c750bb202fef68a9521c1ae8e1dec8bd74146be5 (patch) | |
tree | af2e71cec857c32fc52d7e58aa4b4f059d1834d3 /chrome/browser/sync/engine | |
parent | bbdd29869de3ae2de2536f780eccb0da99da7570 (diff) | |
download | chromium_src-c750bb202fef68a9521c1ae8e1dec8bd74146be5.zip chromium_src-c750bb202fef68a9521c1ae8e1dec8bd74146be5.tar.gz chromium_src-c750bb202fef68a9521c1ae8e1dec8bd74146be5.tar.bz2 |
[Sync] Avoid posting work on threads with no active data types
In ModelChangingSyncerCommand, get a list of active groups from
the routing info and use that to skip workers which don't correspond
to an active group.
In particular, this skips posting on the FILE thread, since its data
type (extension settings) isn't on yet.
Remove obsolete TODO.
Add integration test for enabling data types.
BUG=97832
TEST=
Review URL: http://codereview.chromium.org/8036030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104661 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/engine')
-rw-r--r-- | chrome/browser/sync/engine/model_changing_syncer_command.cc | 24 | ||||
-rw-r--r-- | chrome/browser/sync/engine/model_safe_worker.cc | 3 |
2 files changed, 23 insertions, 4 deletions
diff --git a/chrome/browser/sync/engine/model_changing_syncer_command.cc b/chrome/browser/sync/engine/model_changing_syncer_command.cc index 7c73631..797f795 100644 --- a/chrome/browser/sync/engine/model_changing_syncer_command.cc +++ b/chrome/browser/sync/engine/model_changing_syncer_command.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -17,9 +17,31 @@ void ModelChangingSyncerCommand::ExecuteImpl(sessions::SyncSession* session) { return; } + // Project the list of active types (i.e., types in the routing + // info) to a list of groups. + // + // TODO(akalin): Make this overrideable by subclasses (who might be + // working on a subset of |active_groups|). (See + // http://crbug.com/97832.) + std::set<ModelSafeGroup> active_groups; + const ModelSafeRoutingInfo& routing_info = session->routing_info(); + for (ModelSafeRoutingInfo::const_iterator it = routing_info.begin(); + it != routing_info.end(); ++it) { + active_groups.insert(it->second); + } + // Always work on GROUP_PASSIVE, since that's the group that + // top-level folders map to. + active_groups.insert(GROUP_PASSIVE); + for (size_t i = 0; i < session->workers().size(); ++i) { ModelSafeWorker* worker = session->workers()[i]; ModelSafeGroup group = worker->GetModelSafeGroup(); + // Skip workers whose group isn't active. + if (active_groups.find(group) == active_groups.end()) { + VLOG(2) << "Skipping worker for group " + << ModelSafeGroupToString(group); + continue; + } sessions::StatusController* status = work_session_->status_controller(); sessions::ScopedModelSafeGroupRestriction r(status, group); diff --git a/chrome/browser/sync/engine/model_safe_worker.cc b/chrome/browser/sync/engine/model_safe_worker.cc index 8142be2..ae94b26 100644 --- a/chrome/browser/sync/engine/model_safe_worker.cc +++ b/chrome/browser/sync/engine/model_safe_worker.cc @@ -43,9 +43,6 @@ ModelSafeGroup GetGroupForModelType(const syncable::ModelType type, const ModelSafeRoutingInfo& routes) { ModelSafeRoutingInfo::const_iterator it = routes.find(type); if (it == routes.end()) { - // TODO(tim): We shouldn't end up here for TOP_LEVEL_FOLDER, but an issue - // with the server's PermanentItemPopulator is causing TLF updates in - // some cases. See bug 36735. if (type != syncable::UNSPECIFIED && type != syncable::TOP_LEVEL_FOLDER) LOG(WARNING) << "Entry does not belong to active ModelSafeGroup!"; return GROUP_PASSIVE; |