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

Side by Side Diff: chrome/browser/sync/glue/sync_backend_host_core.h

Issue 566623003: Refactor syncable DEVICE_INFO type from ChangeProcessor to SyncableService - part 3. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unit test fixes Created 6 years, 3 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 CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_CORE_H_ 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_CORE_H_
6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_CORE_H_ 6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_CORE_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 9
10 #include "base/timer/timer.h" 10 #include "base/timer/timer.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 void DoEnableEncryptEverything(); 173 void DoEnableEncryptEverything();
174 174
175 // Ask the syncer to check for updates for the specified types. 175 // Ask the syncer to check for updates for the specified types.
176 void DoRefreshTypes(syncer::ModelTypeSet types); 176 void DoRefreshTypes(syncer::ModelTypeSet types);
177 177
178 // Invoked if we failed to download the necessary control types at startup. 178 // Invoked if we failed to download the necessary control types at startup.
179 // Invokes SyncBackendHost::HandleControlTypesDownloadRetry. 179 // Invokes SyncBackendHost::HandleControlTypesDownloadRetry.
180 void OnControlTypesDownloadRetry(); 180 void OnControlTypesDownloadRetry();
181 181
182 // Called to perform tasks which require the control data to be downloaded. 182 // Called to perform tasks which require the control data to be downloaded.
183 // This includes refreshing encryption, setting up the device info change 183 // This includes refreshing encryption, etc.
184 // processor, etc.
185 void DoInitialProcessControlTypes(); 184 void DoInitialProcessControlTypes();
186 185
187 // Some parts of DoInitialProcessControlTypes() may be executed on a different
188 // thread. This function asynchronously continues the work started in
189 // DoInitialProcessControlTypes() once that other thread gets back to us.
190 void DoFinishInitialProcessControlTypes();
191
192 // The shutdown order is a bit complicated: 186 // The shutdown order is a bit complicated:
193 // 1) Call ShutdownOnUIThread() from |frontend_loop_| to request sync manager 187 // 1) Call ShutdownOnUIThread() from |frontend_loop_| to request sync manager
194 // to stop as soon as possible. 188 // to stop as soon as possible.
195 // 2) Post DoShutdown() to sync loop to clean up backend state, save 189 // 2) Post DoShutdown() to sync loop to clean up backend state, save
196 // directory and destroy sync manager. 190 // directory and destroy sync manager.
197 void ShutdownOnUIThread(); 191 void ShutdownOnUIThread();
198 void DoShutdown(syncer::ShutdownReason reason); 192 void DoShutdown(syncer::ShutdownReason reason);
199 void DoDestroySyncManager(syncer::ShutdownReason reason); 193 void DoDestroySyncManager(syncer::ShutdownReason reason);
200 194
201 // Configuration methods that must execute on sync loop. 195 // Configuration methods that must execute on sync loop.
(...skipping 10 matching lines...) Expand all
212 syncer::ModelTypeSet)>& ready_task); 206 syncer::ModelTypeSet)>& ready_task);
213 void DoRetryConfiguration( 207 void DoRetryConfiguration(
214 const base::Closure& retry_callback); 208 const base::Closure& retry_callback);
215 209
216 // Set the base request context to use when making HTTP calls. 210 // Set the base request context to use when making HTTP calls.
217 // This method will add a reference to the context to persist it 211 // This method will add a reference to the context to persist it
218 // on the IO thread. Must be removed from IO thread. 212 // on the IO thread. Must be removed from IO thread.
219 213
220 syncer::SyncManager* sync_manager() { return sync_manager_.get(); } 214 syncer::SyncManager* sync_manager() { return sync_manager_.get(); }
221 215
222 SyncedDeviceTracker* synced_device_tracker() {
223 return synced_device_tracker_.get();
224 }
225
226 void SendBufferedProtocolEventsAndEnableForwarding(); 216 void SendBufferedProtocolEventsAndEnableForwarding();
227 void DisableProtocolEventForwarding(); 217 void DisableProtocolEventForwarding();
228 218
229 // Enables the forwarding of directory type debug counters to the 219 // Enables the forwarding of directory type debug counters to the
230 // SyncBackendHost. Also requests that updates to all counters be 220 // SyncBackendHost. Also requests that updates to all counters be
231 // emitted right away to initialize any new listeners' states. 221 // emitted right away to initialize any new listeners' states.
232 void EnableDirectoryTypeDebugInfoForwarding(); 222 void EnableDirectoryTypeDebugInfoForwarding();
233 223
234 // Disables forwarding of directory type debug counters. 224 // Disables forwarding of directory type debug counters.
235 void DisableDirectoryTypeDebugInfoForwarding(); 225 void DisableDirectoryTypeDebugInfoForwarding();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 // Our parent's registrar (not owned). Non-NULL only between 276 // Our parent's registrar (not owned). Non-NULL only between
287 // calls to DoInitialize() and DoShutdown(). 277 // calls to DoInitialize() and DoShutdown().
288 SyncBackendRegistrar* registrar_; 278 SyncBackendRegistrar* registrar_;
289 279
290 // The timer used to periodically call SaveChanges. 280 // The timer used to periodically call SaveChanges.
291 scoped_ptr<base::RepeatingTimer<SyncBackendHostCore> > save_changes_timer_; 281 scoped_ptr<base::RepeatingTimer<SyncBackendHostCore> > save_changes_timer_;
292 282
293 // Our encryptor, which uses Chrome's encryption functions. 283 // Our encryptor, which uses Chrome's encryption functions.
294 sync_driver::SystemEncryptor encryptor_; 284 sync_driver::SystemEncryptor encryptor_;
295 285
296 // A special ChangeProcessor that tracks the DEVICE_INFO type for us.
297 scoped_ptr<SyncedDeviceTracker> synced_device_tracker_;
298
299 // The top-level syncapi entry point. Lives on the sync thread. 286 // The top-level syncapi entry point. Lives on the sync thread.
300 scoped_ptr<syncer::SyncManager> sync_manager_; 287 scoped_ptr<syncer::SyncManager> sync_manager_;
301 288
302 // Temporary holder of sync manager's initialization results. Set by 289 // Temporary holder of sync manager's initialization results. Set by
303 // OnInitializeComplete, and consumed when we pass it via OnBackendInitialized 290 // OnInitializeComplete, and consumed when we pass it via OnBackendInitialized
304 // in the final state of HandleInitializationSuccessOnFrontendLoop. 291 // in the final state of HandleInitializationSuccessOnFrontendLoop.
305 syncer::WeakHandle<syncer::JsBackend> js_backend_; 292 syncer::WeakHandle<syncer::JsBackend> js_backend_;
306 syncer::WeakHandle<syncer::DataTypeDebugInfoListener> debug_info_listener_; 293 syncer::WeakHandle<syncer::DataTypeDebugInfoListener> debug_info_listener_;
307 294
308 // These signals allow us to send requests to shut down the HttpBridgeFactory 295 // These signals allow us to send requests to shut down the HttpBridgeFactory
309 // and ServerConnectionManager without having to wait for those classes to 296 // and ServerConnectionManager without having to wait for those classes to
310 // finish initializing first. 297 // finish initializing first.
311 // 298 //
312 // See comments in SyncBackendHostCore::ShutdownOnUIThread() for more details. 299 // See comments in SyncBackendHostCore::ShutdownOnUIThread() for more details.
313 syncer::CancelationSignal release_request_context_signal_; 300 syncer::CancelationSignal release_request_context_signal_;
314 syncer::CancelationSignal stop_syncing_signal_; 301 syncer::CancelationSignal stop_syncing_signal_;
315 302
316 // Matches the value of SyncPref's HasSyncSetupCompleted() flag at init time. 303 // Matches the value of SyncPref's HasSyncSetupCompleted() flag at init time.
317 // Should not be used for anything except for UMAs and logging. 304 // Should not be used for anything except for UMAs and logging.
318 const bool has_sync_setup_completed_; 305 const bool has_sync_setup_completed_;
319 306
320 // Set when we've been asked to forward sync protocol events to the frontend. 307 // Set when we've been asked to forward sync protocol events to the frontend.
321 bool forward_protocol_events_; 308 bool forward_protocol_events_;
322 309
323 // Set when the forwarding of per-type debug counters is enabled. 310 // Set when the forwarding of per-type debug counters is enabled.
324 bool forward_type_info_; 311 bool forward_type_info_;
325 312
313 // TODO: do we still need this?
pavely 2014/09/17 23:04:38 No, we don't.
stanisc 2014/09/18 22:46:54 Done.
326 // Obtained from SigninClient::GetSigninScopedDeviceId(). Stored here just to 314 // Obtained from SigninClient::GetSigninScopedDeviceId(). Stored here just to
327 // pass from SyncBackendHostImpl to SyncedDeviceTracker. 315 // pass from SyncBackendHostImpl to SyncedDeviceTracker.
328 std::string signin_scoped_device_id_; 316 std::string signin_scoped_device_id_;
329 317
330 base::WeakPtrFactory<SyncBackendHostCore> weak_ptr_factory_; 318 base::WeakPtrFactory<SyncBackendHostCore> weak_ptr_factory_;
331 319
332 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostCore); 320 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostCore);
333 }; 321 };
334 322
335 } // namespace browser_sync 323 } // namespace browser_sync
336 324
337 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_CORE_H_ 325 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_CORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698