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_PROFILE_SYNC_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 6 #define CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 | 618 |
619 // ProfileKeyedService implementation. This must be called exactly | 619 // ProfileKeyedService implementation. This must be called exactly |
620 // once (before this object is destroyed). | 620 // once (before this object is destroyed). |
621 virtual void Shutdown() OVERRIDE; | 621 virtual void Shutdown() OVERRIDE; |
622 | 622 |
623 // Simulate an incoming notification for the given id and payload. | 623 // Simulate an incoming notification for the given id and payload. |
624 void EmitInvalidationForTest( | 624 void EmitInvalidationForTest( |
625 const invalidation::ObjectId& id, | 625 const invalidation::ObjectId& id, |
626 const std::string& payload); | 626 const std::string& payload); |
627 | 627 |
| 628 // Called when a datatype (SyncableService) has a need for sync to start |
| 629 // ASAP, presumably because a local change event has occurred but we're |
| 630 // still in deferred start mode, meaning the SyncableService hasn't been |
| 631 // told to MergeDataAndStartSyncing yet. |
| 632 void OnDataTypeRequestsSyncStartup(syncer::ModelType type); |
| 633 |
628 protected: | 634 protected: |
629 // Used by test classes that derive from ProfileSyncService. | 635 // Used by test classes that derive from ProfileSyncService. |
630 virtual browser_sync::SyncBackendHost* GetBackendForTest(); | 636 virtual browser_sync::SyncBackendHost* GetBackendForTest(); |
631 | 637 |
632 // Helper to configure the priority data types. | 638 // Helper to configure the priority data types. |
633 void ConfigurePriorityDataTypes(); | 639 void ConfigurePriorityDataTypes(); |
634 | 640 |
635 // Helper to install and configure a data type manager. | 641 // Helper to install and configure a data type manager. |
636 void ConfigureDataTypeManager(); | 642 void ConfigureDataTypeManager(); |
637 | 643 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 void ClearStaleErrors(); | 741 void ClearStaleErrors(); |
736 | 742 |
737 void ClearUnrecoverableError(); | 743 void ClearUnrecoverableError(); |
738 | 744 |
739 enum StartUpDeferredOption { | 745 enum StartUpDeferredOption { |
740 STARTUP_BACKEND_DEFERRED, | 746 STARTUP_BACKEND_DEFERRED, |
741 STARTUP_IMMEDIATE | 747 STARTUP_IMMEDIATE |
742 }; | 748 }; |
743 void StartUp(StartUpDeferredOption deferred_option); | 749 void StartUp(StartUpDeferredOption deferred_option); |
744 | 750 |
745 // Starts up the backend sync components. |deferred_option| specifies whether | 751 // Starts up the backend sync components. |
746 // this is being called as part of an immediate startup or startup was | 752 void StartUpSlowBackendComponents(); |
747 // originally deferred and we're finally getting around to finishing. | |
748 void StartUpSlowBackendComponents(StartUpDeferredOption deferred_option); | |
749 | 753 |
750 // About-flags experiment names for datatypes that aren't enabled by default | 754 // About-flags experiment names for datatypes that aren't enabled by default |
751 // yet. | 755 // yet. |
752 static std::string GetExperimentNameForDataType( | 756 static std::string GetExperimentNameForDataType( |
753 syncer::ModelType data_type); | 757 syncer::ModelType data_type); |
754 | 758 |
755 // Create and register a new datatype controller. | 759 // Create and register a new datatype controller. |
756 void RegisterNewDataType(syncer::ModelType data_type); | 760 void RegisterNewDataType(syncer::ModelType data_type); |
757 | 761 |
758 // Helper method to process SyncConfigureDone after unwinding the stack that | 762 // Helper method to process SyncConfigureDone after unwinding the stack that |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 | 822 |
819 // The last time we detected a successful transition from SYNCING state. | 823 // The last time we detected a successful transition from SYNCING state. |
820 // Our backend notifies us whenever we should take a new snapshot. | 824 // Our backend notifies us whenever we should take a new snapshot. |
821 base::Time last_synced_time_; | 825 base::Time last_synced_time_; |
822 | 826 |
823 // The time that StartUp() is called. This member is zero if StartUp() has | 827 // The time that StartUp() is called. This member is zero if StartUp() has |
824 // never been called, and is reset to zero once OnBackendInitialized() is | 828 // never been called, and is reset to zero once OnBackendInitialized() is |
825 // called. | 829 // called. |
826 base::Time start_up_time_; | 830 base::Time start_up_time_; |
827 | 831 |
| 832 // Whether we have received a signal from a SyncableService requesting that |
| 833 // sync starts as soon as possible. |
| 834 // TODO(tim): Move this and other TryStart related logic + state to separate |
| 835 // class. Bug 80149. |
| 836 bool data_type_requested_sync_startup_; |
| 837 |
828 // The time that OnConfigureStart is called. This member is zero if | 838 // The time that OnConfigureStart is called. This member is zero if |
829 // OnConfigureStart has not yet been called, and is reset to zero once | 839 // OnConfigureStart has not yet been called, and is reset to zero once |
830 // OnConfigureDone is called. | 840 // OnConfigureDone is called. |
831 base::Time sync_configure_start_time_; | 841 base::Time sync_configure_start_time_; |
832 | 842 |
833 // Indicates if this is the first time sync is being configured. This value | 843 // Indicates if this is the first time sync is being configured. This value |
834 // is equal to !HasSyncSetupCompleted() at the time of OnBackendInitialized(). | 844 // is equal to !HasSyncSetupCompleted() at the time of OnBackendInitialized(). |
835 bool is_first_time_sync_configure_; | 845 bool is_first_time_sync_configure_; |
836 | 846 |
837 // List of available data type controllers. | 847 // List of available data type controllers. |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 syncer::WeakHandle<syncer::DataTypeDebugInfoListener> debug_info_listener_; | 947 syncer::WeakHandle<syncer::DataTypeDebugInfoListener> debug_info_listener_; |
938 | 948 |
939 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); | 949 DISALLOW_COPY_AND_ASSIGN(ProfileSyncService); |
940 }; | 950 }; |
941 | 951 |
942 bool ShouldShowActionOnUI( | 952 bool ShouldShowActionOnUI( |
943 const syncer::SyncProtocolError& error); | 953 const syncer::SyncProtocolError& error); |
944 | 954 |
945 | 955 |
946 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ | 956 #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_SERVICE_H_ |
OLD | NEW |