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

Side by Side Diff: components/sync/driver/glue/sync_backend_host_core.h

Issue 2533083002: [Sync] SyncEngine refactor part 1: interfaces. (Closed)
Patch Set: Rebase. Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_CORE_H_ 5 #ifndef COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_CORE_H_
6 #define COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_CORE_H_ 6 #define COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_CORE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 std::string restored_key_for_bootstrapping; 76 std::string restored_key_for_bootstrapping;
77 std::string restored_keystore_key_for_bootstrapping; 77 std::string restored_keystore_key_for_bootstrapping;
78 std::unique_ptr<EngineComponentsFactory> engine_components_factory; 78 std::unique_ptr<EngineComponentsFactory> engine_components_factory;
79 const WeakHandle<UnrecoverableErrorHandler> unrecoverable_error_handler; 79 const WeakHandle<UnrecoverableErrorHandler> unrecoverable_error_handler;
80 base::Closure report_unrecoverable_error_function; 80 base::Closure report_unrecoverable_error_function;
81 std::unique_ptr<SyncEncryptionHandler::NigoriState> saved_nigori_state; 81 std::unique_ptr<SyncEncryptionHandler::NigoriState> saved_nigori_state;
82 const std::map<ModelType, int64_t> invalidation_versions; 82 const std::map<ModelType, int64_t> invalidation_versions;
83 }; 83 };
84 84
85 // Helper struct to handle currying params to 85 // Helper struct to handle currying params to
86 // SyncBackendHost::Core::DoConfigureSyncer. 86 // SyncBackendHostCore::DoConfigureSyncer.
87 struct DoConfigureSyncerTypes { 87 struct DoConfigureSyncerTypes {
88 DoConfigureSyncerTypes(); 88 DoConfigureSyncerTypes();
89 DoConfigureSyncerTypes(const DoConfigureSyncerTypes& other); 89 DoConfigureSyncerTypes(const DoConfigureSyncerTypes& other);
90 ~DoConfigureSyncerTypes(); 90 ~DoConfigureSyncerTypes();
91 ModelTypeSet to_download; 91 ModelTypeSet to_download;
92 ModelTypeSet to_purge; 92 ModelTypeSet to_purge;
93 ModelTypeSet to_journal; 93 ModelTypeSet to_journal;
94 ModelTypeSet to_unapply; 94 ModelTypeSet to_unapply;
95 }; 95 };
96 96
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 149
150 // Forwards an invalidation state change to the sync manager. 150 // Forwards an invalidation state change to the sync manager.
151 void DoOnInvalidatorStateChange(InvalidatorState state); 151 void DoOnInvalidatorStateChange(InvalidatorState state);
152 152
153 // Forwards an invalidation to the sync manager. 153 // Forwards an invalidation to the sync manager.
154 void DoOnIncomingInvalidation( 154 void DoOnIncomingInvalidation(
155 const ObjectIdInvalidationMap& invalidation_map); 155 const ObjectIdInvalidationMap& invalidation_map);
156 156
157 // Note: 157 // Note:
158 // 158 //
159 // The Do* methods are the various entry points from our 159 // The Do* methods are the various entry points from our SyncBackendHostImpl.
160 // SyncBackendHost. They are all called on the sync thread to 160 // They are all called on the sync thread to actually perform synchronous (and
161 // actually perform synchronous (and potentially blocking) syncapi 161 // potentially blocking) syncapi operations.
162 // operations.
163 // 162 //
164 // Called to perform initialization of the syncapi on behalf of 163 // Called to perform initialization of the syncapi on behalf of
165 // SyncBackendHost::Initialize. 164 // SyncEngine::Initialize.
166 void DoInitialize(std::unique_ptr<DoInitializeOptions> options); 165 void DoInitialize(std::unique_ptr<DoInitializeOptions> options);
167 166
168 // Called to perform credential update on behalf of 167 // Called to perform credential update on behalf of
169 // SyncBackendHost::UpdateCredentials. 168 // SyncEngine::UpdateCredentials.
170 void DoUpdateCredentials(const SyncCredentials& credentials); 169 void DoUpdateCredentials(const SyncCredentials& credentials);
171 170
172 // Called to tell the syncapi to start syncing (generally after 171 // Called to tell the syncapi to start syncing (generally after
173 // initialization and authentication). 172 // initialization and authentication).
174 void DoStartSyncing(const ModelSafeRoutingInfo& routing_info, 173 void DoStartSyncing(const ModelSafeRoutingInfo& routing_info,
175 base::Time last_poll_time); 174 base::Time last_poll_time);
176 175
177 // Called to set the passphrase for encryption. 176 // Called to set the passphrase for encryption.
178 void DoSetEncryptionPassphrase(const std::string& passphrase, 177 void DoSetEncryptionPassphrase(const std::string& passphrase,
179 bool is_explicit); 178 bool is_explicit);
180 179
181 // Called to decrypt the pending keys. 180 // Called to decrypt the pending keys.
182 void DoSetDecryptionPassphrase(const std::string& passphrase); 181 void DoSetDecryptionPassphrase(const std::string& passphrase);
183 182
184 // Called to turn on encryption of all sync data as well as 183 // Called to turn on encryption of all sync data as well as
185 // reencrypt everything. 184 // reencrypt everything.
186 void DoEnableEncryptEverything(); 185 void DoEnableEncryptEverything();
187 186
188 // Ask the syncer to check for updates for the specified types. 187 // Ask the syncer to check for updates for the specified types.
189 void DoRefreshTypes(ModelTypeSet types); 188 void DoRefreshTypes(ModelTypeSet types);
190 189
191 // Invoked if we failed to download the necessary control types at startup. 190 // Invoked if we failed to download the necessary control types at startup.
192 // Invokes SyncBackendHost::HandleControlTypesDownloadRetry. 191 // Invokes SyncEngine::HandleControlTypesDownloadRetry.
193 void OnControlTypesDownloadRetry(); 192 void OnControlTypesDownloadRetry();
194 193
195 // Called to perform tasks which require the control data to be downloaded. 194 // Called to perform tasks which require the control data to be downloaded.
196 // This includes refreshing encryption, etc. 195 // This includes refreshing encryption, etc.
197 void DoInitialProcessControlTypes(); 196 void DoInitialProcessControlTypes();
198 197
199 // The shutdown order is a bit complicated: 198 // The shutdown order is a bit complicated:
200 // 1) Call ShutdownOnUIThread() from |frontend_loop_| to request sync manager 199 // 1) Call ShutdownOnUIThread() from |frontend_loop_| to request sync manager
201 // to stop as soon as possible. 200 // to stop as soon as possible.
202 // 2) Post DoShutdown() to sync loop to clean up backend state, save 201 // 2) Post DoShutdown() to sync loop to clean up backend state, save
(...skipping 16 matching lines...) Expand all
219 218
220 // Set the base request context to use when making HTTP calls. 219 // Set the base request context to use when making HTTP calls.
221 // This method will add a reference to the context to persist it 220 // This method will add a reference to the context to persist it
222 // on the IO thread. Must be removed from IO thread. 221 // on the IO thread. Must be removed from IO thread.
223 222
224 SyncManager* sync_manager() { return sync_manager_.get(); } 223 SyncManager* sync_manager() { return sync_manager_.get(); }
225 224
226 void SendBufferedProtocolEventsAndEnableForwarding(); 225 void SendBufferedProtocolEventsAndEnableForwarding();
227 void DisableProtocolEventForwarding(); 226 void DisableProtocolEventForwarding();
228 227
229 // Enables the forwarding of directory type debug counters to the 228 // Enables the forwarding of directory type debug counters to the SyncEngine.
skym 2016/12/02 20:54:54 But, this class, SyncBackxendHostCore, is part of
maxbogue 2016/12/02 23:59:27 Fixed to SyncEngineHost (the thing listening to th
230 // SyncBackendHost. Also requests that updates to all counters be 229 // Also requests that updates to all counters be emitted right away to
231 // emitted right away to initialize any new listeners' states. 230 // initialize any new listeners' states.
232 void EnableDirectoryTypeDebugInfoForwarding(); 231 void EnableDirectoryTypeDebugInfoForwarding();
233 232
234 // Disables forwarding of directory type debug counters. 233 // Disables forwarding of directory type debug counters.
235 void DisableDirectoryTypeDebugInfoForwarding(); 234 void DisableDirectoryTypeDebugInfoForwarding();
236 235
237 // Delete the sync data folder to cleanup backend data. Happens the first 236 // Delete the sync data folder to cleanup backend data. Happens the first
238 // time sync is enabled for a user (to prevent accidentally reusing old 237 // time sync is enabled for a user (to prevent accidentally reusing old
239 // sync databases), as well as shutdown when you're no longer syncing. 238 // sync databases), as well as shutdown when you're no longer syncing.
240 void DeleteSyncDataFolder(); 239 void DeleteSyncDataFolder();
241 240
(...skipping 26 matching lines...) Expand all
268 void StartSavingChanges(); 267 void StartSavingChanges();
269 268
270 void ClearServerDataDone(const base::Closure& frontend_callback); 269 void ClearServerDataDone(const base::Closure& frontend_callback);
271 270
272 // Name used for debugging. 271 // Name used for debugging.
273 const std::string name_; 272 const std::string name_;
274 273
275 // Path of the folder that stores the sync data files. 274 // Path of the folder that stores the sync data files.
276 const base::FilePath sync_data_folder_path_; 275 const base::FilePath sync_data_folder_path_;
277 276
278 // Our parent SyncBackendHost. 277 // Our parent SyncBackendHostImpl.
279 WeakHandle<SyncBackendHostImpl> host_; 278 WeakHandle<SyncBackendHostImpl> host_;
280 279
281 // Our parent's registrar (not owned). Non-null only between 280 // Our parent's registrar (not owned). Non-null only between
282 // calls to DoInitialize() and DoShutdown(). 281 // calls to DoInitialize() and DoShutdown().
283 SyncBackendRegistrar* registrar_ = nullptr; 282 SyncBackendRegistrar* registrar_ = nullptr;
284 283
285 // The timer used to periodically call SaveChanges. 284 // The timer used to periodically call SaveChanges.
286 std::unique_ptr<base::RepeatingTimer> save_changes_timer_; 285 std::unique_ptr<base::RepeatingTimer> save_changes_timer_;
287 286
288 // Our encryptor, which uses Chrome's encryption functions. 287 // Our encryptor, which uses Chrome's encryption functions.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 base::ThreadChecker thread_checker_; 320 base::ThreadChecker thread_checker_;
322 321
323 base::WeakPtrFactory<SyncBackendHostCore> weak_ptr_factory_; 322 base::WeakPtrFactory<SyncBackendHostCore> weak_ptr_factory_;
324 323
325 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostCore); 324 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostCore);
326 }; 325 };
327 326
328 } // namespace syncer 327 } // namespace syncer
329 328
330 #endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_CORE_H_ 329 #endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_CORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698