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

Unified Diff: chrome/browser/sync/engine/process_updates_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: Refactor some test code Created 9 years, 1 month 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/process_updates_command.cc
diff --git a/chrome/browser/sync/engine/process_updates_command.cc b/chrome/browser/sync/engine/process_updates_command.cc
index 367be000a8463ffc7d09b3d6915300a64881ef2e..5a2f4fece746267163560124c7accaddaa93af2f 100644
--- a/chrome/browser/sync/engine/process_updates_command.cc
+++ b/chrome/browser/sync/engine/process_updates_command.cc
@@ -22,10 +22,32 @@ namespace browser_sync {
using sessions::SyncSession;
using sessions::StatusController;
+using sessions::UpdateProgress;
ProcessUpdatesCommand::ProcessUpdatesCommand() {}
ProcessUpdatesCommand::~ProcessUpdatesCommand() {}
+std::set<ModelSafeGroup> ProcessUpdatesCommand::GetGroupsToChange(
+ const sessions::SyncSession& session) const {
+ std::set<ModelSafeGroup> groups_with_verified_updates;
+
+ const std::set<ModelSafeGroup>& active_groups =
+ ModelChangingSyncerCommand::GetActiveGroups(session);
+
+ for (std::set<ModelSafeGroup>::const_iterator it =
+ active_groups.begin(); it != active_groups.end(); ++it) {
+ const UpdateProgress* update_progress =
+ session.status_controller().GetUnrestrictedUpdateProgress(*it);
+ if (update_progress &&
+ (update_progress->VerifiedUpdatesBegin() !=
+ update_progress->VerifiedUpdatesEnd())) {
+ groups_with_verified_updates.insert(*it);
+ }
+ }
+
+ return groups_with_verified_updates;
+}
+
bool ProcessUpdatesCommand::ModelNeutralExecuteImpl(SyncSession* session) {
const GetUpdatesResponse& updates =
session->status_controller().updates_response().get_updates();

Powered by Google App Engine
This is Rietveld 408576698