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

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: Address comments, add tests 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 e6763bdc773eeebb88ebcc0b25bd15088a05d1b0..8485a2123d6ca164aae7ad34321167923932198d 100644
--- a/chrome/browser/sync/engine/process_updates_command.cc
+++ b/chrome/browser/sync/engine/process_updates_command.cc
@@ -22,10 +22,31 @@ 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>& enabled_groups = session.GetEnabledGroups();
+
+ for (std::set<ModelSafeGroup>::const_iterator it =
+ enabled_groups.begin(); it != enabled_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;
tim (not reviewing) 2011/11/29 00:01:59 again, maybe just keep an index on this when we ad
akalin 2011/11/30 01:33:03 I don't know if I agree with this. Unlike the una
tim (not reviewing) 2011/11/30 02:21:23 OK, yeah lets do that.
+}
+
bool ProcessUpdatesCommand::ModelNeutralExecuteImpl(SyncSession* session) {
const GetUpdatesResponse& updates =
session->status_controller().updates_response().get_updates();

Powered by Google App Engine
This is Rietveld 408576698