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

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: 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_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 7a7113f89c4b206e2ab3f093cbc3171ed5cd1b0c..23b89772a3a97e35a05aec50c2492f89b2b18798 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,27 @@ void ResetErrorCounters(StatusController* status) {
ProcessCommitResponseCommand::ProcessCommitResponseCommand() {}
ProcessCommitResponseCommand::~ProcessCommitResponseCommand() {}
+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