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

Unified Diff: chrome/browser/sync/engine/process_commit_response_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/process_commit_response_command.cc
diff --git a/chrome/browser/sync/engine/process_commit_response_command.cc b/chrome/browser/sync/engine/process_commit_response_command.cc
index 83e0d30131e22bc0eac277c0142d5f3542a1b7a1..256c0bbac4d7b8efea2e126a8fab33cabfd60f13 100644
--- a/chrome/browser/sync/engine/process_commit_response_command.cc
+++ b/chrome/browser/sync/engine/process_commit_response_command.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/sync/engine/process_commit_response_command.h"
+#include <cstddef>
#include <set>
#include <string>
#include <vector>
@@ -59,6 +60,32 @@ void ResetErrorCounters(StatusController* status) {
ProcessCommitResponseCommand::ProcessCommitResponseCommand() {}
ProcessCommitResponseCommand::~ProcessCommitResponseCommand() {}
+bool ProcessCommitResponseCommand::HasCustomGroupsToChange() const {
+ // TODO(akalin): Set to true.
+ return false;
+}
+
+std::set<ModelSafeGroup> ProcessCommitResponseCommand::GetGroupsToChange(
+ const sessions::SyncSession& session) const {
+ std::set<ModelSafeGroup> groups_with_commits;
+ syncable::ScopedDirLookup dir(session.context()->directory_manager(),
+ session.context()->account_name());
+ if (!dir.good()) {
+ LOG(ERROR) << "Scoped dir lookup failed!";
+ return groups_with_commits;
+ }
+
+ syncable::ReadTransaction trans(FROM_HERE, dir);
+ const StatusController& status = session.status_controller();
+ for (size_t i = 0; i < status.commit_ids().size(); ++i) {
+ groups_with_commits.insert(
+ GetGroupForModelType(status.GetUnrestrictedCommitModelTypeAt(i),
+ session.routing_info()));
+ }
+
+ return groups_with_commits;
+}
+
bool ProcessCommitResponseCommand::ModelNeutralExecuteImpl(
sessions::SyncSession* session) {
ScopedDirLookup dir(session->context()->directory_manager(),

Powered by Google App Engine
This is Rietveld 408576698