OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_SYNC_ENGINE_MODEL_CHANGING_SYNCER_COMMAND_H_ | 5 #ifndef CHROME_BROWSER_SYNC_ENGINE_MODEL_CHANGING_SYNCER_COMMAND_H_ |
6 #define CHROME_BROWSER_SYNC_ENGINE_MODEL_CHANGING_SYNCER_COMMAND_H_ | 6 #define CHROME_BROWSER_SYNC_ENGINE_MODEL_CHANGING_SYNCER_COMMAND_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "chrome/browser/sync/engine/model_safe_worker.h" | 10 #include "chrome/browser/sync/engine/model_safe_worker.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 ModelChangingExecuteImpl(work_session_); | 41 ModelChangingExecuteImpl(work_session_); |
42 return UnrecoverableErrorInfo(); | 42 return UnrecoverableErrorInfo(); |
43 } | 43 } |
44 | 44 |
45 std::set<ModelSafeGroup> GetGroupsToChangeForTest( | 45 std::set<ModelSafeGroup> GetGroupsToChangeForTest( |
46 const sessions::SyncSession& session) const { | 46 const sessions::SyncSession& session) const { |
47 return GetGroupsToChange(session); | 47 return GetGroupsToChange(session); |
48 } | 48 } |
49 | 49 |
50 protected: | 50 protected: |
51 // Hack to track down which subclass triggers the perf regression. | |
52 // (See comments in http://codereview.chromium.org/8637006/ for | |
53 // details.) If this returns false (the default), | |
54 // GetGroupsToChange() is not used and session.GetEnabledGroups() | |
55 // is used instead. | |
56 // | |
57 // TODO(akalin): Remove this when we track down the perf regression. | |
58 virtual bool HasCustomGroupsToChange() const = 0; | |
59 | |
60 // This should return the set of groups in |session| that need to be | 51 // This should return the set of groups in |session| that need to be |
61 // changed. The returned set should be a subset of | 52 // changed. The returned set should be a subset of |
62 // session.GetEnabledGroups(). Subclasses can guarantee this either | 53 // session.GetEnabledGroups(). Subclasses can guarantee this either |
63 // by calling one of the session.GetEnabledGroups*() functions and | 54 // by calling one of the session.GetEnabledGroups*() functions and |
64 // filtering that, or using GetGroupForModelType() (which handles | 55 // filtering that, or using GetGroupForModelType() (which handles |
65 // top-level/unspecified nodes) to project from model types to | 56 // top-level/unspecified nodes) to project from model types to |
66 // groups. | 57 // groups. |
67 virtual std::set<ModelSafeGroup> GetGroupsToChange( | 58 virtual std::set<ModelSafeGroup> GetGroupsToChange( |
68 const sessions::SyncSession& session) const = 0; | 59 const sessions::SyncSession& session) const = 0; |
69 | 60 |
(...skipping 17 matching lines...) Expand all Loading... |
87 // Implementations will implement ModelChangingExecuteImpl and not | 78 // Implementations will implement ModelChangingExecuteImpl and not |
88 // worry about storing the session or setting it. They are given work_session. | 79 // worry about storing the session or setting it. They are given work_session. |
89 sessions::SyncSession* work_session_; | 80 sessions::SyncSession* work_session_; |
90 | 81 |
91 DISALLOW_COPY_AND_ASSIGN(ModelChangingSyncerCommand); | 82 DISALLOW_COPY_AND_ASSIGN(ModelChangingSyncerCommand); |
92 }; | 83 }; |
93 | 84 |
94 } // namespace browser_sync | 85 } // namespace browser_sync |
95 | 86 |
96 #endif // CHROME_BROWSER_SYNC_ENGINE_MODEL_CHANGING_SYNCER_COMMAND_H_ | 87 #endif // CHROME_BROWSER_SYNC_ENGINE_MODEL_CHANGING_SYNCER_COMMAND_H_ |
OLD | NEW |