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

Unified Diff: chrome/browser/sync/engine/model_changing_syncer_command.cc

Issue 8637006: [Sync] Make syncer commands avoid posting tasks on threads with no work to do (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync to head, fix windows compile Created 9 years 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/engine/model_changing_syncer_command.cc
diff --git a/chrome/browser/sync/engine/model_changing_syncer_command.cc b/chrome/browser/sync/engine/model_changing_syncer_command.cc
index a8df65ade9e3eb0795ef41c8bc0de775e5e136d4..a4aa26e15bda636f46c412fb76e948a5128411ac 100644
--- a/chrome/browser/sync/engine/model_changing_syncer_command.cc
+++ b/chrome/browser/sync/engine/model_changing_syncer_command.cc
@@ -6,7 +6,6 @@
#include "base/basictypes.h"
#include "base/callback_old.h"
-#include "chrome/browser/sync/engine/model_safe_worker.h"
#include "chrome/browser/sync/sessions/status_controller.h"
#include "chrome/browser/sync/sessions/sync_session.h"
#include "chrome/browser/sync/util/unrecoverable_error_info.h"
@@ -19,27 +18,15 @@ 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);
-
+ const std::set<ModelSafeGroup>& groups_to_change =
+ HasCustomGroupsToChange() ?
+ GetGroupsToChange(*work_session_) :
+ session->GetEnabledGroups();
for (size_t i = 0; i < session->workers().size(); ++i) {
- ModelSafeWorker* worker = session->workers()[i];
+ ModelSafeWorker* worker = work_session_->workers()[i];
ModelSafeGroup group = worker->GetModelSafeGroup();
// Skip workers whose group isn't active.
- if (active_groups.find(group) == active_groups.end()) {
+ if (groups_to_change.count(group) == 0u) {
DVLOG(2) << "Skipping worker for group "
<< ModelSafeGroupToString(group);
continue;

Powered by Google App Engine
This is Rietveld 408576698