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

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

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/model_changing_syncer_command.h
diff --git a/chrome/browser/sync/engine/model_changing_syncer_command.h b/chrome/browser/sync/engine/model_changing_syncer_command.h
index 9a2311e96d907365d7f61a6cd519aa431f962cc3..2c747530936160157efe18d566377ae5fd6b9cf5 100644
--- a/chrome/browser/sync/engine/model_changing_syncer_command.h
+++ b/chrome/browser/sync/engine/model_changing_syncer_command.h
@@ -7,6 +7,7 @@
#pragma once
#include "base/compiler_specific.h"
+#include "chrome/browser/sync/engine/model_safe_worker.h"
#include "chrome/browser/sync/engine/syncer_command.h"
#include "chrome/browser/sync/util/unrecoverable_error_info.h"
@@ -41,6 +42,31 @@ class ModelChangingSyncerCommand : public SyncerCommand {
return UnrecoverableErrorInfo();
}
+ std::set<ModelSafeGroup> GetGroupsToChangeForTest(
+ const sessions::SyncSession& session) const {
+ return GetGroupsToChange(session);
+ }
+
+ protected:
+ // Hack to track down which subclass triggers the perf regression.
+ // (See comments in http://codereview.chromium.org/8637006/ for
+ // details.) If this returns false (the default),
+ // GetGroupsToChange() is not used and session.GetEnabledGroups()
+ // is used instead.
+ //
+ // TODO(akalin): Remove this when we track down the perf regression.
+ virtual bool HasCustomGroupsToChange() const = 0;
+
+ // This should return the set of groups in |session| that need to be
+ // changed. The returned set should be a subset of
+ // session.GetEnabledGroups(). Subclasses can guarantee this either
+ // by calling one of the session.GetEnabledGroups*() functions and
+ // filtering that, or using GetGroupForModelType() (which handles
+ // top-level/unspecified nodes) to project from model types to
+ // groups.
+ virtual std::set<ModelSafeGroup> GetGroupsToChange(
+ const sessions::SyncSession& session) const = 0;
+
// Sometimes, a command has work to do that needs to touch global state
// belonging to multiple ModelSafeGroups, but in a way that is known to be
// safe. This will be called once, prior to ModelChangingExecuteImpl,

Powered by Google App Engine
This is Rietveld 408576698