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

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

Issue 8785015: Revert 112815 - [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: 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
===================================================================
--- chrome/browser/sync/engine/model_changing_syncer_command.cc (revision 112854)
+++ chrome/browser/sync/engine/model_changing_syncer_command.cc (working copy)
@@ -6,6 +6,7 @@
#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"
@@ -18,13 +19,27 @@
return;
}
- const std::set<ModelSafeGroup>& groups_to_change =
- GetGroupsToChange(*work_session_);
+ // 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 = work_session_->workers()[i];
+ ModelSafeWorker* worker = session->workers()[i];
ModelSafeGroup group = worker->GetModelSafeGroup();
// Skip workers whose group isn't active.
- if (groups_to_change.count(group) == 0u) {
+ if (active_groups.find(group) == active_groups.end()) {
DVLOG(2) << "Skipping worker for group "
<< ModelSafeGroupToString(group);
continue;

Powered by Google App Engine
This is Rietveld 408576698