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

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

Issue 2388673002: Revert of [Sync] Move //components/sync to the syncer namespace. (patchset #5 id:40001 of https://co (Closed)
Patch Set: Created 4 years, 2 months 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>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/timer/timer.h" 16 #include "base/timer/timer.h"
17 #include "components/invalidation/public/invalidation.h" 17 #include "components/invalidation/public/invalidation.h"
18 #include "components/sync/base/cancelation_signal.h" 18 #include "components/sync/base/cancelation_signal.h"
19 #include "components/sync/core/shutdown_reason.h" 19 #include "components/sync/core/shutdown_reason.h"
20 #include "components/sync/core/sync_encryption_handler.h" 20 #include "components/sync/core/sync_encryption_handler.h"
21 #include "components/sync/driver/glue/sync_backend_host_impl.h" 21 #include "components/sync/driver/glue/sync_backend_host_impl.h"
22 #include "components/sync/driver/system_encryptor.h" 22 #include "components/sync/driver/system_encryptor.h"
23 #include "components/sync/engine/cycle/type_debug_info_observer.h" 23 #include "components/sync/engine/cycle/type_debug_info_observer.h"
24 #include "url/gurl.h" 24 #include "url/gurl.h"
25 25
26 namespace syncer { 26 namespace browser_sync {
27 27
28 class SyncBackendHostImpl; 28 class SyncBackendHostImpl;
29 29
30 // Utility struct for holding initialization options. 30 // Utility struct for holding initialization options.
31 struct DoInitializeOptions { 31 struct DoInitializeOptions {
32 DoInitializeOptions( 32 DoInitializeOptions(
33 base::MessageLoop* sync_loop, 33 base::MessageLoop* sync_loop,
34 SyncBackendRegistrar* registrar, 34 SyncBackendRegistrar* registrar,
35 const std::vector<scoped_refptr<ModelSafeWorker>>& workers, 35 const std::vector<scoped_refptr<syncer::ModelSafeWorker>>& workers,
36 const scoped_refptr<ExtensionsActivity>& extensions_activity, 36 const scoped_refptr<syncer::ExtensionsActivity>& extensions_activity,
37 const WeakHandle<JsEventHandler>& event_handler, 37 const syncer::WeakHandle<syncer::JsEventHandler>& event_handler,
38 const GURL& service_url, 38 const GURL& service_url,
39 const std::string& sync_user_agent, 39 const std::string& sync_user_agent,
40 std::unique_ptr<HttpPostProviderFactory> http_bridge_factory, 40 std::unique_ptr<syncer::HttpPostProviderFactory> http_bridge_factory,
41 const SyncCredentials& credentials, 41 const syncer::SyncCredentials& credentials,
42 const std::string& invalidator_client_id, 42 const std::string& invalidator_client_id,
43 std::unique_ptr<SyncManagerFactory> sync_manager_factory, 43 std::unique_ptr<syncer::SyncManagerFactory> sync_manager_factory,
44 bool delete_sync_data_folder, 44 bool delete_sync_data_folder,
45 const std::string& restored_key_for_bootstrapping, 45 const std::string& restored_key_for_bootstrapping,
46 const std::string& restored_keystore_key_for_bootstrapping, 46 const std::string& restored_keystore_key_for_bootstrapping,
47 std::unique_ptr<InternalComponentsFactory> internal_components_factory, 47 std::unique_ptr<syncer::InternalComponentsFactory>
48 const WeakHandle<UnrecoverableErrorHandler>& unrecoverable_error_handler, 48 internal_components_factory,
49 const syncer::WeakHandle<syncer::UnrecoverableErrorHandler>&
50 unrecoverable_error_handler,
49 const base::Closure& report_unrecoverable_error_function, 51 const base::Closure& report_unrecoverable_error_function,
50 std::unique_ptr<SyncEncryptionHandler::NigoriState> saved_nigori_state, 52 std::unique_ptr<syncer::SyncEncryptionHandler::NigoriState>
51 const std::map<ModelType, int64_t>& invalidation_versions); 53 saved_nigori_state,
54 const std::map<syncer::ModelType, int64_t>& invalidation_versions);
52 ~DoInitializeOptions(); 55 ~DoInitializeOptions();
53 56
54 base::MessageLoop* sync_loop; 57 base::MessageLoop* sync_loop;
55 SyncBackendRegistrar* registrar; 58 SyncBackendRegistrar* registrar;
56 std::vector<scoped_refptr<ModelSafeWorker>> workers; 59 std::vector<scoped_refptr<syncer::ModelSafeWorker>> workers;
57 scoped_refptr<ExtensionsActivity> extensions_activity; 60 scoped_refptr<syncer::ExtensionsActivity> extensions_activity;
58 WeakHandle<JsEventHandler> event_handler; 61 syncer::WeakHandle<syncer::JsEventHandler> event_handler;
59 GURL service_url; 62 GURL service_url;
60 std::string sync_user_agent; 63 std::string sync_user_agent;
61 // Overridden by tests. 64 // Overridden by tests.
62 std::unique_ptr<HttpPostProviderFactory> http_bridge_factory; 65 std::unique_ptr<syncer::HttpPostProviderFactory> http_bridge_factory;
63 SyncCredentials credentials; 66 syncer::SyncCredentials credentials;
64 const std::string invalidator_client_id; 67 const std::string invalidator_client_id;
65 std::unique_ptr<SyncManagerFactory> sync_manager_factory; 68 std::unique_ptr<syncer::SyncManagerFactory> sync_manager_factory;
66 std::string lsid; 69 std::string lsid;
67 bool delete_sync_data_folder; 70 bool delete_sync_data_folder;
68 std::string restored_key_for_bootstrapping; 71 std::string restored_key_for_bootstrapping;
69 std::string restored_keystore_key_for_bootstrapping; 72 std::string restored_keystore_key_for_bootstrapping;
70 std::unique_ptr<InternalComponentsFactory> internal_components_factory; 73 std::unique_ptr<syncer::InternalComponentsFactory>
71 const WeakHandle<UnrecoverableErrorHandler> unrecoverable_error_handler; 74 internal_components_factory;
75 const syncer::WeakHandle<syncer::UnrecoverableErrorHandler>
76 unrecoverable_error_handler;
72 base::Closure report_unrecoverable_error_function; 77 base::Closure report_unrecoverable_error_function;
73 std::unique_ptr<SyncEncryptionHandler::NigoriState> saved_nigori_state; 78 std::unique_ptr<syncer::SyncEncryptionHandler::NigoriState>
74 const std::map<ModelType, int64_t> invalidation_versions; 79 saved_nigori_state;
80 const std::map<syncer::ModelType, int64_t> invalidation_versions;
75 }; 81 };
76 82
77 // Helper struct to handle currying params to 83 // Helper struct to handle currying params to
78 // SyncBackendHost::Core::DoConfigureSyncer. 84 // SyncBackendHost::Core::DoConfigureSyncer.
79 struct DoConfigureSyncerTypes { 85 struct DoConfigureSyncerTypes {
80 DoConfigureSyncerTypes(); 86 DoConfigureSyncerTypes();
81 DoConfigureSyncerTypes(const DoConfigureSyncerTypes& other); 87 DoConfigureSyncerTypes(const DoConfigureSyncerTypes& other);
82 ~DoConfigureSyncerTypes(); 88 ~DoConfigureSyncerTypes();
83 ModelTypeSet to_download; 89 syncer::ModelTypeSet to_download;
84 ModelTypeSet to_purge; 90 syncer::ModelTypeSet to_purge;
85 ModelTypeSet to_journal; 91 syncer::ModelTypeSet to_journal;
86 ModelTypeSet to_unapply; 92 syncer::ModelTypeSet to_unapply;
87 }; 93 };
88 94
89 class SyncBackendHostCore 95 class SyncBackendHostCore
90 : public base::RefCountedThreadSafe<SyncBackendHostCore>, 96 : public base::RefCountedThreadSafe<SyncBackendHostCore>,
91 public SyncEncryptionHandler::Observer, 97 public syncer::SyncEncryptionHandler::Observer,
92 public SyncManager::Observer, 98 public syncer::SyncManager::Observer,
93 public TypeDebugInfoObserver { 99 public syncer::TypeDebugInfoObserver {
94 public: 100 public:
95 SyncBackendHostCore(const std::string& name, 101 SyncBackendHostCore(const std::string& name,
96 const base::FilePath& sync_data_folder_path, 102 const base::FilePath& sync_data_folder_path,
97 bool has_sync_setup_completed, 103 bool has_sync_setup_completed,
98 const base::WeakPtr<SyncBackendHostImpl>& backend); 104 const base::WeakPtr<SyncBackendHostImpl>& backend);
99 105
100 // SyncManager::Observer implementation. The Core just acts like an air 106 // SyncManager::Observer implementation. The Core just acts like an air
101 // traffic controller here, forwarding incoming messages to appropriate 107 // traffic controller here, forwarding incoming messages to appropriate
102 // landing threads. 108 // landing threads.
103 void OnSyncCycleCompleted(const SyncCycleSnapshot& snapshot) override; 109 void OnSyncCycleCompleted(const syncer::SyncCycleSnapshot& snapshot) override;
104 void OnInitializationComplete( 110 void OnInitializationComplete(
105 const WeakHandle<JsBackend>& js_backend, 111 const syncer::WeakHandle<syncer::JsBackend>& js_backend,
106 const WeakHandle<DataTypeDebugInfoListener>& debug_info_listener, 112 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>&
113 debug_info_listener,
107 bool success, 114 bool success,
108 ModelTypeSet restored_types) override; 115 syncer::ModelTypeSet restored_types) override;
109 void OnConnectionStatusChange(ConnectionStatus status) override; 116 void OnConnectionStatusChange(syncer::ConnectionStatus status) override;
110 void OnActionableError(const SyncProtocolError& sync_error) override; 117 void OnActionableError(const syncer::SyncProtocolError& sync_error) override;
111 void OnMigrationRequested(ModelTypeSet types) override; 118 void OnMigrationRequested(syncer::ModelTypeSet types) override;
112 void OnProtocolEvent(const ProtocolEvent& event) override; 119 void OnProtocolEvent(const syncer::ProtocolEvent& event) override;
113 120
114 // SyncEncryptionHandler::Observer implementation. 121 // SyncEncryptionHandler::Observer implementation.
115 void OnPassphraseRequired( 122 void OnPassphraseRequired(
116 PassphraseRequiredReason reason, 123 syncer::PassphraseRequiredReason reason,
117 const sync_pb::EncryptedData& pending_keys) override; 124 const sync_pb::EncryptedData& pending_keys) override;
118 void OnPassphraseAccepted() override; 125 void OnPassphraseAccepted() override;
119 void OnBootstrapTokenUpdated(const std::string& bootstrap_token, 126 void OnBootstrapTokenUpdated(const std::string& bootstrap_token,
120 BootstrapTokenType type) override; 127 syncer::BootstrapTokenType type) override;
121 void OnEncryptedTypesChanged(ModelTypeSet encrypted_types, 128 void OnEncryptedTypesChanged(syncer::ModelTypeSet encrypted_types,
122 bool encrypt_everything) override; 129 bool encrypt_everything) override;
123 void OnEncryptionComplete() override; 130 void OnEncryptionComplete() override;
124 void OnCryptographerStateChanged(Cryptographer* cryptographer) override; 131 void OnCryptographerStateChanged(
125 void OnPassphraseTypeChanged(PassphraseType type, 132 syncer::Cryptographer* cryptographer) override;
133 void OnPassphraseTypeChanged(syncer::PassphraseType type,
126 base::Time passphrase_time) override; 134 base::Time passphrase_time) override;
127 void OnLocalSetPassphraseEncryption( 135 void OnLocalSetPassphraseEncryption(
128 const SyncEncryptionHandler::NigoriState& nigori_state) override; 136 const syncer::SyncEncryptionHandler::NigoriState& nigori_state) override;
129 137
130 // TypeDebugInfoObserver implementation 138 // TypeDebugInfoObserver implementation
131 void OnCommitCountersUpdated(ModelType type, 139 void OnCommitCountersUpdated(syncer::ModelType type,
132 const CommitCounters& counters) override; 140 const syncer::CommitCounters& counters) override;
133 void OnUpdateCountersUpdated(ModelType type, 141 void OnUpdateCountersUpdated(syncer::ModelType type,
134 const UpdateCounters& counters) override; 142 const syncer::UpdateCounters& counters) override;
135 void OnStatusCountersUpdated(ModelType type, 143 void OnStatusCountersUpdated(syncer::ModelType type,
136 const StatusCounters& counters) override; 144 const syncer::StatusCounters& counters) override;
137 145
138 // Forwards an invalidation state change to the sync manager. 146 // Forwards an invalidation state change to the sync manager.
139 void DoOnInvalidatorStateChange(InvalidatorState state); 147 void DoOnInvalidatorStateChange(syncer::InvalidatorState state);
140 148
141 // Forwards an invalidation to the sync manager. 149 // Forwards an invalidation to the sync manager.
142 void DoOnIncomingInvalidation( 150 void DoOnIncomingInvalidation(
143 const ObjectIdInvalidationMap& invalidation_map); 151 const syncer::ObjectIdInvalidationMap& invalidation_map);
144 152
145 // Note: 153 // Note:
146 // 154 //
147 // The Do* methods are the various entry points from our 155 // The Do* methods are the various entry points from our
148 // SyncBackendHost. They are all called on the sync thread to 156 // SyncBackendHost. They are all called on the sync thread to
149 // actually perform synchronous (and potentially blocking) syncapi 157 // actually perform synchronous (and potentially blocking) syncapi
150 // operations. 158 // operations.
151 // 159 //
152 // Called to perform initialization of the syncapi on behalf of 160 // Called to perform initialization of the syncapi on behalf of
153 // SyncBackendHost::Initialize. 161 // SyncBackendHost::Initialize.
154 void DoInitialize(std::unique_ptr<DoInitializeOptions> options); 162 void DoInitialize(std::unique_ptr<DoInitializeOptions> options);
155 163
156 // Called to perform credential update on behalf of 164 // Called to perform credential update on behalf of
157 // SyncBackendHost::UpdateCredentials. 165 // SyncBackendHost::UpdateCredentials.
158 void DoUpdateCredentials(const SyncCredentials& credentials); 166 void DoUpdateCredentials(const syncer::SyncCredentials& credentials);
159 167
160 // Called to tell the syncapi to start syncing (generally after 168 // Called to tell the syncapi to start syncing (generally after
161 // initialization and authentication). 169 // initialization and authentication).
162 void DoStartSyncing(const ModelSafeRoutingInfo& routing_info, 170 void DoStartSyncing(const syncer::ModelSafeRoutingInfo& routing_info,
163 base::Time last_poll_time); 171 base::Time last_poll_time);
164 172
165 // Called to set the passphrase for encryption. 173 // Called to set the passphrase for encryption.
166 void DoSetEncryptionPassphrase(const std::string& passphrase, 174 void DoSetEncryptionPassphrase(const std::string& passphrase,
167 bool is_explicit); 175 bool is_explicit);
168 176
169 // Called to decrypt the pending keys. 177 // Called to decrypt the pending keys.
170 void DoSetDecryptionPassphrase(const std::string& passphrase); 178 void DoSetDecryptionPassphrase(const std::string& passphrase);
171 179
172 // Called to turn on encryption of all sync data as well as 180 // Called to turn on encryption of all sync data as well as
173 // reencrypt everything. 181 // reencrypt everything.
174 void DoEnableEncryptEverything(); 182 void DoEnableEncryptEverything();
175 183
176 // Ask the syncer to check for updates for the specified types. 184 // Ask the syncer to check for updates for the specified types.
177 void DoRefreshTypes(ModelTypeSet types); 185 void DoRefreshTypes(syncer::ModelTypeSet types);
178 186
179 // Invoked if we failed to download the necessary control types at startup. 187 // Invoked if we failed to download the necessary control types at startup.
180 // Invokes SyncBackendHost::HandleControlTypesDownloadRetry. 188 // Invokes SyncBackendHost::HandleControlTypesDownloadRetry.
181 void OnControlTypesDownloadRetry(); 189 void OnControlTypesDownloadRetry();
182 190
183 // Called to perform tasks which require the control data to be downloaded. 191 // Called to perform tasks which require the control data to be downloaded.
184 // This includes refreshing encryption, etc. 192 // This includes refreshing encryption, etc.
185 void DoInitialProcessControlTypes(); 193 void DoInitialProcessControlTypes();
186 194
187 // The shutdown order is a bit complicated: 195 // The shutdown order is a bit complicated:
188 // 1) Call ShutdownOnUIThread() from |frontend_loop_| to request sync manager 196 // 1) Call ShutdownOnUIThread() from |frontend_loop_| to request sync manager
189 // to stop as soon as possible. 197 // to stop as soon as possible.
190 // 2) Post DoShutdown() to sync loop to clean up backend state, save 198 // 2) Post DoShutdown() to sync loop to clean up backend state, save
191 // directory and destroy sync manager. 199 // directory and destroy sync manager.
192 void ShutdownOnUIThread(); 200 void ShutdownOnUIThread();
193 void DoShutdown(ShutdownReason reason); 201 void DoShutdown(syncer::ShutdownReason reason);
194 void DoDestroySyncManager(ShutdownReason reason); 202 void DoDestroySyncManager(syncer::ShutdownReason reason);
195 203
196 // Configuration methods that must execute on sync loop. 204 // Configuration methods that must execute on sync loop.
197 void DoConfigureSyncer( 205 void DoConfigureSyncer(
198 ConfigureReason reason, 206 syncer::ConfigureReason reason,
199 const DoConfigureSyncerTypes& config_types, 207 const DoConfigureSyncerTypes& config_types,
200 const ModelSafeRoutingInfo routing_info, 208 const syncer::ModelSafeRoutingInfo routing_info,
201 const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task, 209 const base::Callback<void(syncer::ModelTypeSet, syncer::ModelTypeSet)>&
210 ready_task,
202 const base::Closure& retry_callback); 211 const base::Closure& retry_callback);
203 void DoFinishConfigureDataTypes( 212 void DoFinishConfigureDataTypes(
204 ModelTypeSet types_to_config, 213 syncer::ModelTypeSet types_to_config,
205 const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task); 214 const base::Callback<void(syncer::ModelTypeSet, syncer::ModelTypeSet)>&
215 ready_task);
206 void DoRetryConfiguration(const base::Closure& retry_callback); 216 void DoRetryConfiguration(const base::Closure& retry_callback);
207 217
208 // Set the base request context to use when making HTTP calls. 218 // Set the base request context to use when making HTTP calls.
209 // This method will add a reference to the context to persist it 219 // This method will add a reference to the context to persist it
210 // on the IO thread. Must be removed from IO thread. 220 // on the IO thread. Must be removed from IO thread.
211 221
212 SyncManager* sync_manager() { return sync_manager_.get(); } 222 syncer::SyncManager* sync_manager() { return sync_manager_.get(); }
213 223
214 void SendBufferedProtocolEventsAndEnableForwarding(); 224 void SendBufferedProtocolEventsAndEnableForwarding();
215 void DisableProtocolEventForwarding(); 225 void DisableProtocolEventForwarding();
216 226
217 // Enables the forwarding of directory type debug counters to the 227 // Enables the forwarding of directory type debug counters to the
218 // SyncBackendHost. Also requests that updates to all counters be 228 // SyncBackendHost. Also requests that updates to all counters be
219 // emitted right away to initialize any new listeners' states. 229 // emitted right away to initialize any new listeners' states.
220 void EnableDirectoryTypeDebugInfoForwarding(); 230 void EnableDirectoryTypeDebugInfoForwarding();
221 231
222 // Disables forwarding of directory type debug counters. 232 // Disables forwarding of directory type debug counters.
223 void DisableDirectoryTypeDebugInfoForwarding(); 233 void DisableDirectoryTypeDebugInfoForwarding();
224 234
225 // Delete the sync data folder to cleanup backend data. Happens the first 235 // Delete the sync data folder to cleanup backend data. Happens the first
226 // time sync is enabled for a user (to prevent accidentally reusing old 236 // time sync is enabled for a user (to prevent accidentally reusing old
227 // sync databases), as well as shutdown when you're no longer syncing. 237 // sync databases), as well as shutdown when you're no longer syncing.
228 void DeleteSyncDataFolder(); 238 void DeleteSyncDataFolder();
229 239
230 // We expose this member because it's required in the construction of the 240 // We expose this member because it's required in the construction of the
231 // HttpBridgeFactory. 241 // HttpBridgeFactory.
232 CancelationSignal* GetRequestContextCancelationSignal() { 242 syncer::CancelationSignal* GetRequestContextCancelationSignal() {
233 return &release_request_context_signal_; 243 return &release_request_context_signal_;
234 } 244 }
235 245
236 // Tell the sync manager to persist its state by writing to disk. 246 // Tell the sync manager to persist its state by writing to disk.
237 // Called on the sync thread, both by a timer and, on Android, when the 247 // Called on the sync thread, both by a timer and, on Android, when the
238 // application is backgrounded. 248 // application is backgrounded.
239 void SaveChanges(); 249 void SaveChanges();
240 250
241 void DoClearServerData( 251 void DoClearServerData(
242 const SyncManager::ClearServerDataCallback& frontend_callback); 252 const syncer::SyncManager::ClearServerDataCallback& frontend_callback);
243 253
244 // Notify the syncer that the cookie jar has changed. 254 // Notify the syncer that the cookie jar has changed.
245 void DoOnCookieJarChanged(bool account_mismatch, bool empty_jar); 255 void DoOnCookieJarChanged(bool account_mismatch, bool empty_jar);
246 256
247 private: 257 private:
248 friend class base::RefCountedThreadSafe<SyncBackendHostCore>; 258 friend class base::RefCountedThreadSafe<SyncBackendHostCore>;
249 259
250 ~SyncBackendHostCore() override; 260 ~SyncBackendHostCore() override;
251 261
252 // Invoked when initialization of syncapi is complete and we can start 262 // Invoked when initialization of syncapi is complete and we can start
253 // our timer. 263 // our timer.
254 // This must be called from the thread on which SaveChanges is intended to 264 // This must be called from the thread on which SaveChanges is intended to
255 // be run on; the host's |registrar_->sync_thread()|. 265 // be run on; the host's |registrar_->sync_thread()|.
256 void StartSavingChanges(); 266 void StartSavingChanges();
257 267
258 void ClearServerDataDone(const base::Closure& frontend_callback); 268 void ClearServerDataDone(const base::Closure& frontend_callback);
259 269
260 // Name used for debugging. 270 // Name used for debugging.
261 const std::string name_; 271 const std::string name_;
262 272
263 // Path of the folder that stores the sync data files. 273 // Path of the folder that stores the sync data files.
264 const base::FilePath sync_data_folder_path_; 274 const base::FilePath sync_data_folder_path_;
265 275
266 // Our parent SyncBackendHost. 276 // Our parent SyncBackendHost.
267 WeakHandle<SyncBackendHostImpl> host_; 277 syncer::WeakHandle<SyncBackendHostImpl> host_;
268 278
269 // The loop where all the sync backend operations happen. 279 // The loop where all the sync backend operations happen.
270 // Non-NULL only between calls to DoInitialize() and ~Core(). 280 // Non-NULL only between calls to DoInitialize() and ~Core().
271 base::MessageLoop* sync_loop_; 281 base::MessageLoop* sync_loop_;
272 282
273 // Our parent's registrar (not owned). Non-NULL only between 283 // Our parent's registrar (not owned). Non-NULL only between
274 // calls to DoInitialize() and DoShutdown(). 284 // calls to DoInitialize() and DoShutdown().
275 SyncBackendRegistrar* registrar_; 285 SyncBackendRegistrar* registrar_;
276 286
277 // The timer used to periodically call SaveChanges. 287 // The timer used to periodically call SaveChanges.
278 std::unique_ptr<base::RepeatingTimer> save_changes_timer_; 288 std::unique_ptr<base::RepeatingTimer> save_changes_timer_;
279 289
280 // Our encryptor, which uses Chrome's encryption functions. 290 // Our encryptor, which uses Chrome's encryption functions.
281 SystemEncryptor encryptor_; 291 sync_driver::SystemEncryptor encryptor_;
282 292
283 // The top-level syncapi entry point. Lives on the sync thread. 293 // The top-level syncapi entry point. Lives on the sync thread.
284 std::unique_ptr<SyncManager> sync_manager_; 294 std::unique_ptr<syncer::SyncManager> sync_manager_;
285 295
286 // Temporary holder of sync manager's initialization results. Set by 296 // Temporary holder of sync manager's initialization results. Set by
287 // OnInitializeComplete, and consumed when we pass it via OnBackendInitialized 297 // OnInitializeComplete, and consumed when we pass it via OnBackendInitialized
288 // in the final state of HandleInitializationSuccessOnFrontendLoop. 298 // in the final state of HandleInitializationSuccessOnFrontendLoop.
289 WeakHandle<JsBackend> js_backend_; 299 syncer::WeakHandle<syncer::JsBackend> js_backend_;
290 WeakHandle<DataTypeDebugInfoListener> debug_info_listener_; 300 syncer::WeakHandle<syncer::DataTypeDebugInfoListener> debug_info_listener_;
291 301
292 // These signals allow us to send requests to shut down the HttpBridgeFactory 302 // These signals allow us to send requests to shut down the HttpBridgeFactory
293 // and ServerConnectionManager without having to wait for those classes to 303 // and ServerConnectionManager without having to wait for those classes to
294 // finish initializing first. 304 // finish initializing first.
295 // 305 //
296 // See comments in SyncBackendHostCore::ShutdownOnUIThread() for more details. 306 // See comments in SyncBackendHostCore::ShutdownOnUIThread() for more details.
297 CancelationSignal release_request_context_signal_; 307 syncer::CancelationSignal release_request_context_signal_;
298 CancelationSignal stop_syncing_signal_; 308 syncer::CancelationSignal stop_syncing_signal_;
299 309
300 // Matches the value of SyncPref's IsFirstSetupComplete() flag at init time. 310 // Matches the value of SyncPref's IsFirstSetupComplete() flag at init time.
301 // Should not be used for anything except for UMAs and logging. 311 // Should not be used for anything except for UMAs and logging.
302 const bool has_sync_setup_completed_; 312 const bool has_sync_setup_completed_;
303 313
304 // Set when we've been asked to forward sync protocol events to the frontend. 314 // Set when we've been asked to forward sync protocol events to the frontend.
305 bool forward_protocol_events_; 315 bool forward_protocol_events_;
306 316
307 // Set when the forwarding of per-type debug counters is enabled. 317 // Set when the forwarding of per-type debug counters is enabled.
308 bool forward_type_info_; 318 bool forward_type_info_;
309 319
310 // A map of data type -> invalidation version to track the most recently 320 // A map of data type -> invalidation version to track the most recently
311 // received invalidation version for each type. 321 // received invalidation version for each type.
312 // This allows dropping any invalidations with versions older than those 322 // This allows dropping any invalidations with versions older than those
313 // most recently received for that data type. 323 // most recently received for that data type.
314 std::map<ModelType, int64_t> last_invalidation_versions_; 324 std::map<syncer::ModelType, int64_t> last_invalidation_versions_;
315 325
316 base::WeakPtrFactory<SyncBackendHostCore> weak_ptr_factory_; 326 base::WeakPtrFactory<SyncBackendHostCore> weak_ptr_factory_;
317 327
318 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostCore); 328 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostCore);
319 }; 329 };
320 330
321 } // namespace syncer 331 } // namespace browser_sync
322 332
323 #endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_CORE_H_ 333 #endif // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_CORE_H_
OLDNEW
« no previous file with comments | « components/sync/driver/glue/sync_backend_host.cc ('k') | components/sync/driver/glue/sync_backend_host_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698