OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 DCHECK(account_name_.empty()); | 103 DCHECK(account_name_.empty()); |
104 account_name_ = name; | 104 account_name_ = name; |
105 } | 105 } |
106 const std::string& account_name() const { return account_name_; } | 106 const std::string& account_name() const { return account_name_; } |
107 | 107 |
108 void set_max_commit_batch_size(int batch_size) { | 108 void set_max_commit_batch_size(int batch_size) { |
109 max_commit_batch_size_ = batch_size; | 109 max_commit_batch_size_ = batch_size; |
110 } | 110 } |
111 int32 max_commit_batch_size() const { return max_commit_batch_size_; } | 111 int32 max_commit_batch_size() const { return max_commit_batch_size_; } |
112 | 112 |
113 const ModelSafeRoutingInfo& previous_session_routing_info() const { | |
114 return previous_session_routing_info_; | |
115 } | |
116 | |
117 void set_previous_session_routing_info(const ModelSafeRoutingInfo& info) { | |
118 previous_session_routing_info_ = info; | |
119 } | |
120 | |
121 void NotifyListeners(const SyncEngineEvent& event) { | 113 void NotifyListeners(const SyncEngineEvent& event) { |
122 FOR_EACH_OBSERVER(SyncEngineEventListener, listeners_, | 114 FOR_EACH_OBSERVER(SyncEngineEventListener, listeners_, |
123 OnSyncEngineEvent(event)); | 115 OnSyncEngineEvent(event)); |
124 } | 116 } |
125 | 117 |
126 TrafficRecorder* traffic_recorder() { | 118 TrafficRecorder* traffic_recorder() { |
127 return traffic_recorder_; | 119 return traffic_recorder_; |
128 } | 120 } |
129 | 121 |
130 private: | 122 private: |
(...skipping 25 matching lines...) Expand all Loading... |
156 // Kept up to date with talk events to determine whether notifications are | 148 // Kept up to date with talk events to determine whether notifications are |
157 // enabled. True only if the notification channel is authorized and open. | 149 // enabled. True only if the notification channel is authorized and open. |
158 bool notifications_enabled_; | 150 bool notifications_enabled_; |
159 | 151 |
160 // The name of the account being synced. | 152 // The name of the account being synced. |
161 std::string account_name_; | 153 std::string account_name_; |
162 | 154 |
163 // The server limits the number of items a client can commit in one batch. | 155 // The server limits the number of items a client can commit in one batch. |
164 int max_commit_batch_size_; | 156 int max_commit_batch_size_; |
165 | 157 |
166 // Some routing info history to help us clean up types that get disabled | |
167 // by the user. | |
168 ModelSafeRoutingInfo previous_session_routing_info_; | |
169 | |
170 ThrottledDataTypeTracker* throttled_data_type_tracker_; | 158 ThrottledDataTypeTracker* throttled_data_type_tracker_; |
171 | 159 |
172 // We use this to get debug info to send to the server for debugging | 160 // We use this to get debug info to send to the server for debugging |
173 // client behavior on server side. | 161 // client behavior on server side. |
174 DebugInfoGetter* const debug_info_getter_; | 162 DebugInfoGetter* const debug_info_getter_; |
175 | 163 |
176 TrafficRecorder* traffic_recorder_; | 164 TrafficRecorder* traffic_recorder_; |
177 | 165 |
178 DISALLOW_COPY_AND_ASSIGN(SyncSessionContext); | 166 DISALLOW_COPY_AND_ASSIGN(SyncSessionContext); |
179 }; | 167 }; |
(...skipping 18 matching lines...) Expand all Loading... |
198 private: | 186 private: |
199 SyncSessionContext* context_; | 187 SyncSessionContext* context_; |
200 ConflictResolver* resolver_; | 188 ConflictResolver* resolver_; |
201 DISALLOW_COPY_AND_ASSIGN(ScopedSessionContextConflictResolver); | 189 DISALLOW_COPY_AND_ASSIGN(ScopedSessionContextConflictResolver); |
202 }; | 190 }; |
203 | 191 |
204 } // namespace sessions | 192 } // namespace sessions |
205 } // namespace syncer | 193 } // namespace syncer |
206 | 194 |
207 #endif // SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_ | 195 #endif // SYNC_SESSIONS_SYNC_SESSION_CONTEXT_H_ |
OLD | NEW |