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 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
363 class Core; | 363 class Core; |
364 | 364 |
365 // An enum representing the steps to initializing the SyncBackendHost. | 365 // An enum representing the steps to initializing the SyncBackendHost. |
366 enum InitializationState { | 366 enum InitializationState { |
367 NOT_ATTEMPTED, | 367 NOT_ATTEMPTED, |
368 CREATING_SYNC_MANAGER, // We're waiting for the first callback from the | 368 CREATING_SYNC_MANAGER, // We're waiting for the first callback from the |
369 // sync thread to inform us that the sync manager | 369 // sync thread to inform us that the sync manager |
370 // has been created. | 370 // has been created. |
371 NOT_INITIALIZED, // Initialization hasn't completed, but we've | 371 NOT_INITIALIZED, // Initialization hasn't completed, but we've |
372 // constructed a SyncManager. | 372 // constructed a SyncManager. |
373 DOWNLOADING_NIGORI, // The SyncManager is initialized, but | 373 DOWNLOADING_METADATA, // The SyncManager is initialized, but |
Nicolas Zea
2012/09/14 19:15:08
how about calling these downloading and applying "
rlarocque
2012/09/15 01:36:37
Good idea. Done.
| |
374 // we're fetching sync encryption information. | 374 // we're fetching metadata, such as encryption |
375 ASSOCIATING_NIGORI, // The SyncManager is initialized, and we | 375 // information, from the server. |
376 // have the sync encryption information, but we | 376 PROCESSING_METADATA, // Running init tasks that require metadata to be |
377 // have to update the local encryption state. | 377 // available. This includes registering our device |
378 // information and refreshing encryption. | |
378 INITIALIZED, // Initialization is complete. | 379 INITIALIZED, // Initialization is complete. |
379 }; | 380 }; |
380 | 381 |
381 // Checks if we have received a notice to turn on experimental datatypes | 382 // Checks if we have received a notice to turn on experimental datatypes |
382 // (via the nigori node) and informs the frontend if that is the case. | 383 // (via the nigori node) and informs the frontend if that is the case. |
383 // Note: it is illegal to call this before the backend is initialized. | 384 // Note: it is illegal to call this before the backend is initialized. |
384 void AddExperimentalTypes(); | 385 void AddExperimentalTypes(); |
385 | 386 |
386 // Downloading of nigori failed and will be retried. | 387 // Downloading of nigori failed and will be retried. |
387 void OnNigoriDownloadRetry(); | 388 void OnNigoriDownloadRetry(); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
469 void HandleInvalidatorStateChangeOnFrontendLoop( | 470 void HandleInvalidatorStateChangeOnFrontendLoop( |
470 syncer::InvalidatorState state); | 471 syncer::InvalidatorState state); |
471 void HandleIncomingInvalidationOnFrontendLoop( | 472 void HandleIncomingInvalidationOnFrontendLoop( |
472 const syncer::ObjectIdStateMap& id_state_map, | 473 const syncer::ObjectIdStateMap& id_state_map, |
473 syncer::IncomingInvalidationSource source); | 474 syncer::IncomingInvalidationSource source); |
474 | 475 |
475 // Handles stopping the core's SyncManager, accounting for whether | 476 // Handles stopping the core's SyncManager, accounting for whether |
476 // initialization is done yet. | 477 // initialization is done yet. |
477 void StopSyncManagerForShutdown(const base::Closure& closure); | 478 void StopSyncManagerForShutdown(const base::Closure& closure); |
478 | 479 |
480 // Must be called on |frontend_loop_|. |done_callback| is called on | |
481 // |frontend_loop_|. | |
482 void InitialProcessMetadata(const base::Closure& done_callback); | |
483 | |
479 base::WeakPtrFactory<SyncBackendHost> weak_ptr_factory_; | 484 base::WeakPtrFactory<SyncBackendHost> weak_ptr_factory_; |
480 | 485 |
481 // A thread where all the sync operations happen. | 486 // A thread where all the sync operations happen. |
482 base::Thread sync_thread_; | 487 base::Thread sync_thread_; |
483 | 488 |
484 // A reference to the MessageLoop used to construct |this|, so we know how | 489 // A reference to the MessageLoop used to construct |this|, so we know how |
485 // to safely talk back to the SyncFrontend. | 490 // to safely talk back to the SyncFrontend. |
486 MessageLoop* const frontend_loop_; | 491 MessageLoop* const frontend_loop_; |
487 | 492 |
488 Profile* const profile_; | 493 Profile* const profile_; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
534 // it via OnBackendInitialized in the final state of | 539 // it via OnBackendInitialized in the final state of |
535 // HandleInitializationCompletedOnFrontendLoop. | 540 // HandleInitializationCompletedOnFrontendLoop. |
536 syncer::WeakHandle<syncer::JsBackend> js_backend_; | 541 syncer::WeakHandle<syncer::JsBackend> js_backend_; |
537 | 542 |
538 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); | 543 DISALLOW_COPY_AND_ASSIGN(SyncBackendHost); |
539 }; | 544 }; |
540 | 545 |
541 } // namespace browser_sync | 546 } // namespace browser_sync |
542 | 547 |
543 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ | 548 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_H_ |
OLD | NEW |