| OLD | NEW | 
|---|
| 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 75   const base::FilePath local_sync_backend_folder; | 75   const base::FilePath local_sync_backend_folder; | 
| 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 |  | 
| 86 // SyncBackendHostCore::DoConfigureSyncer. |  | 
| 87 struct DoConfigureSyncerTypes { |  | 
| 88   DoConfigureSyncerTypes(); |  | 
| 89   DoConfigureSyncerTypes(const DoConfigureSyncerTypes& other); |  | 
| 90   ~DoConfigureSyncerTypes(); |  | 
| 91   ModelTypeSet to_download; |  | 
| 92   ModelTypeSet to_purge; |  | 
| 93   ModelTypeSet to_journal; |  | 
| 94   ModelTypeSet to_unapply; |  | 
| 95 }; |  | 
| 96 |  | 
| 97 class SyncBackendHostCore | 85 class SyncBackendHostCore | 
| 98     : public base::RefCountedThreadSafe<SyncBackendHostCore>, | 86     : public base::RefCountedThreadSafe<SyncBackendHostCore>, | 
| 99       public base::trace_event::MemoryDumpProvider, | 87       public base::trace_event::MemoryDumpProvider, | 
| 100       public SyncEncryptionHandler::Observer, | 88       public SyncEncryptionHandler::Observer, | 
| 101       public SyncManager::Observer, | 89       public SyncManager::Observer, | 
| 102       public TypeDebugInfoObserver { | 90       public TypeDebugInfoObserver { | 
| 103  public: | 91  public: | 
| 104   SyncBackendHostCore(const std::string& name, | 92   SyncBackendHostCore(const std::string& name, | 
| 105                       const base::FilePath& sync_data_folder_path, | 93                       const base::FilePath& sync_data_folder_path, | 
| 106                       const base::WeakPtr<SyncBackendHostImpl>& backend); | 94                       const base::WeakPtr<SyncBackendHostImpl>& backend); | 
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 198   // The shutdown order is a bit complicated: | 186   // The shutdown order is a bit complicated: | 
| 199   // 1) Call ShutdownOnUIThread() from |frontend_loop_| to request sync manager | 187   // 1) Call ShutdownOnUIThread() from |frontend_loop_| to request sync manager | 
| 200   //    to stop as soon as possible. | 188   //    to stop as soon as possible. | 
| 201   // 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 | 
| 202   //    directory and destroy sync manager. | 190   //    directory and destroy sync manager. | 
| 203   void ShutdownOnUIThread(); | 191   void ShutdownOnUIThread(); | 
| 204   void DoShutdown(ShutdownReason reason); | 192   void DoShutdown(ShutdownReason reason); | 
| 205   void DoDestroySyncManager(ShutdownReason reason); | 193   void DoDestroySyncManager(ShutdownReason reason); | 
| 206 | 194 | 
| 207   // Configuration methods that must execute on sync loop. | 195   // Configuration methods that must execute on sync loop. | 
|  | 196   void DoPurgeDisabledTypes(const ModelTypeSet& to_purge, | 
|  | 197                             const ModelTypeSet& to_journal, | 
|  | 198                             const ModelTypeSet& to_unapply); | 
| 208   void DoConfigureSyncer( | 199   void DoConfigureSyncer( | 
| 209       ConfigureReason reason, | 200       ConfigureReason reason, | 
| 210       const DoConfigureSyncerTypes& config_types, | 201       const ModelTypeSet& to_download, | 
| 211       const ModelSafeRoutingInfo routing_info, | 202       const ModelSafeRoutingInfo routing_info, | 
| 212       const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task, | 203       const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task, | 
| 213       const base::Closure& retry_callback); | 204       const base::Closure& retry_callback); | 
| 214   void DoFinishConfigureDataTypes( | 205   void DoFinishConfigureDataTypes( | 
| 215       ModelTypeSet types_to_config, | 206       ModelTypeSet types_to_config, | 
| 216       const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task); | 207       const base::Callback<void(ModelTypeSet, ModelTypeSet)>& ready_task); | 
| 217   void DoRetryConfiguration(const base::Closure& retry_callback); | 208   void DoRetryConfiguration(const base::Closure& retry_callback); | 
| 218 | 209 | 
| 219   // Set the base request context to use when making HTTP calls. | 210   // Set the base request context to use when making HTTP calls. | 
| 220   // 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 | 
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 320   base::ThreadChecker thread_checker_; | 311   base::ThreadChecker thread_checker_; | 
| 321 | 312 | 
| 322   base::WeakPtrFactory<SyncBackendHostCore> weak_ptr_factory_; | 313   base::WeakPtrFactory<SyncBackendHostCore> weak_ptr_factory_; | 
| 323 | 314 | 
| 324   DISALLOW_COPY_AND_ASSIGN(SyncBackendHostCore); | 315   DISALLOW_COPY_AND_ASSIGN(SyncBackendHostCore); | 
| 325 }; | 316 }; | 
| 326 | 317 | 
| 327 }  // namespace syncer | 318 }  // namespace syncer | 
| 328 | 319 | 
| 329 #endif  // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_CORE_H_ | 320 #endif  // COMPONENTS_SYNC_DRIVER_GLUE_SYNC_BACKEND_HOST_CORE_H_ | 
| OLD | NEW | 
|---|