| 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 // SyncSessionContext encapsulates the contextual information and engine | 5 // SyncSessionContext encapsulates the contextual information and engine |
| 6 // components specific to a SyncSession. A context is accessible via | 6 // components specific to a SyncSession. A context is accessible via |
| 7 // a SyncSession so that session SyncerCommands and parts of the engine have | 7 // a SyncSession so that session SyncerCommands and parts of the engine have |
| 8 // a convenient way to access other parts. In this way it can be thought of as | 8 // a convenient way to access other parts. In this way it can be thought of as |
| 9 // the surrounding environment for the SyncSession. The components of this | 9 // the surrounding environment for the SyncSession. The components of this |
| 10 // environment are either valid or not valid for the entire context lifetime, | 10 // environment are either valid or not valid for the entire context lifetime, |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 void set_previous_session_routing_info(const ModelSafeRoutingInfo& info) { | 103 void set_previous_session_routing_info(const ModelSafeRoutingInfo& info) { |
| 104 previous_session_routing_info_ = info; | 104 previous_session_routing_info_ = info; |
| 105 } | 105 } |
| 106 | 106 |
| 107 void NotifyListeners(const SyncEngineEvent& event) { | 107 void NotifyListeners(const SyncEngineEvent& event) { |
| 108 FOR_EACH_OBSERVER(SyncEngineEventListener, listeners_, | 108 FOR_EACH_OBSERVER(SyncEngineEventListener, listeners_, |
| 109 OnSyncEngineEvent(event)); | 109 OnSyncEngineEvent(event)); |
| 110 } | 110 } |
| 111 | 111 |
| 112 // This is virtual for unit tests. | 112 // This is virtual for unit tests. |
| 113 virtual void SetUnthrottleTime(const syncable::ModelTypeSet& types, | 113 virtual void SetUnthrottleTime(syncable::ModelEnumSet types, |
| 114 const base::TimeTicks& time); | 114 const base::TimeTicks& time); |
| 115 | 115 |
| 116 // This prunes the |unthrottle_time_| map based on the |time| passed in. This | 116 // This prunes the |unthrottle_time_| map based on the |time| passed in. This |
| 117 // is called by syncer at the SYNCER_BEGIN stage. | 117 // is called by syncer at the SYNCER_BEGIN stage. |
| 118 void PruneUnthrottledTypes(const base::TimeTicks& time); | 118 void PruneUnthrottledTypes(const base::TimeTicks& time); |
| 119 | 119 |
| 120 // This returns the list of currently throttled types. Unless server returns | 120 // This returns the list of currently throttled types. Unless server returns |
| 121 // new throttled types this will remain constant through out the sync cycle. | 121 // new throttled types this will remain constant through out the sync cycle. |
| 122 syncable::ModelTypeSet GetThrottledTypes() const; | 122 syncable::ModelEnumSet GetThrottledTypes() const; |
| 123 | 123 |
| 124 private: | 124 private: |
| 125 typedef std::map<syncable::ModelType, base::TimeTicks> UnthrottleTimes; | 125 typedef std::map<syncable::ModelType, base::TimeTicks> UnthrottleTimes; |
| 126 | 126 |
| 127 FRIEND_TEST_ALL_PREFIXES(SyncSessionContextTest, AddUnthrottleTimeTest); | 127 FRIEND_TEST_ALL_PREFIXES(SyncSessionContextTest, AddUnthrottleTimeTest); |
| 128 FRIEND_TEST_ALL_PREFIXES(SyncSessionContextTest, | 128 FRIEND_TEST_ALL_PREFIXES(SyncSessionContextTest, |
| 129 GetCurrentlyThrottledTypesTest); | 129 GetCurrentlyThrottledTypesTest); |
| 130 | 130 |
| 131 // Rather than force clients to set and null-out various context members, we | 131 // Rather than force clients to set and null-out various context members, we |
| 132 // extend our encapsulation boundary to scoped helpers that take care of this | 132 // extend our encapsulation boundary to scoped helpers that take care of this |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 private: | 197 private: |
| 198 SyncSessionContext* context_; | 198 SyncSessionContext* context_; |
| 199 ConflictResolver* resolver_; | 199 ConflictResolver* resolver_; |
| 200 DISALLOW_COPY_AND_ASSIGN(ScopedSessionContextConflictResolver); | 200 DISALLOW_COPY_AND_ASSIGN(ScopedSessionContextConflictResolver); |
| 201 }; | 201 }; |
| 202 | 202 |
| 203 } // namespace sessions | 203 } // namespace sessions |
| 204 } // namespace browser_sync | 204 } // namespace browser_sync |
| 205 | 205 |
| 206 #endif // CHROME_BROWSER_SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_ | 206 #endif // CHROME_BROWSER_SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_ |
| OLD | NEW |