Chromium Code Reviews| 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 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 232 syncer::CancelationSignal* GetRequestContextCancelationSignal() { | 232 syncer::CancelationSignal* GetRequestContextCancelationSignal() { |
| 233 return &release_request_context_signal_; | 233 return &release_request_context_signal_; |
| 234 } | 234 } |
| 235 | 235 |
| 236 void GetAllNodesForTypes( | 236 void GetAllNodesForTypes( |
| 237 syncer::ModelTypeSet types, | 237 syncer::ModelTypeSet types, |
| 238 scoped_refptr<base::SequencedTaskRunner> task_runner, | 238 scoped_refptr<base::SequencedTaskRunner> task_runner, |
| 239 base::Callback<void(const std::vector<syncer::ModelType>& type, | 239 base::Callback<void(const std::vector<syncer::ModelType>& type, |
| 240 ScopedVector<base::ListValue>) > callback); | 240 ScopedVector<base::ListValue>) > callback); |
| 241 | 241 |
| 242 // Tell the syncapi to persist its state by writing to disk. | |
|
Nicolas Zea
2014/09/30 21:20:22
nit: syncapi -> sync manager
maxbogue
2014/09/30 21:59:34
Done.
| |
| 243 // Called on the sync thread, both by a timer and, on Android, when the | |
| 244 // application is backgrounded. | |
| 245 void SaveChanges(); | |
| 246 | |
| 242 private: | 247 private: |
| 243 friend class base::RefCountedThreadSafe<SyncBackendHostCore>; | 248 friend class base::RefCountedThreadSafe<SyncBackendHostCore>; |
| 244 friend class SyncBackendHostForProfileSyncTest; | 249 friend class SyncBackendHostForProfileSyncTest; |
| 245 | 250 |
| 246 virtual ~SyncBackendHostCore(); | 251 virtual ~SyncBackendHostCore(); |
| 247 | 252 |
| 248 // Invoked when initialization of syncapi is complete and we can start | 253 // Invoked when initialization of syncapi is complete and we can start |
| 249 // our timer. | 254 // our timer. |
| 250 // This must be called from the thread on which SaveChanges is intended to | 255 // This must be called from the thread on which SaveChanges is intended to |
| 251 // be run on; the host's |registrar_->sync_thread()|. | 256 // be run on; the host's |registrar_->sync_thread()|. |
| 252 void StartSavingChanges(); | 257 void StartSavingChanges(); |
| 253 | 258 |
| 254 // Invoked periodically to tell the syncapi to persist its state | |
| 255 // by writing to disk. | |
| 256 // This is called from the thread we were created on (which is sync thread), | |
| 257 // using a repeating timer that is kicked off as soon as the SyncManager | |
| 258 // tells us it completed initialization. | |
| 259 void SaveChanges(); | |
| 260 | |
| 261 // Name used for debugging. | 259 // Name used for debugging. |
| 262 const std::string name_; | 260 const std::string name_; |
| 263 | 261 |
| 264 // Path of the folder that stores the sync data files. | 262 // Path of the folder that stores the sync data files. |
| 265 const base::FilePath sync_data_folder_path_; | 263 const base::FilePath sync_data_folder_path_; |
| 266 | 264 |
| 267 // Our parent SyncBackendHost. | 265 // Our parent SyncBackendHost. |
| 268 syncer::WeakHandle<SyncBackendHostImpl> host_; | 266 syncer::WeakHandle<SyncBackendHostImpl> host_; |
| 269 | 267 |
| 270 // The loop where all the sync backend operations happen. | 268 // The loop where all the sync backend operations happen. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 309 bool forward_type_info_; | 307 bool forward_type_info_; |
| 310 | 308 |
| 311 base::WeakPtrFactory<SyncBackendHostCore> weak_ptr_factory_; | 309 base::WeakPtrFactory<SyncBackendHostCore> weak_ptr_factory_; |
| 312 | 310 |
| 313 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostCore); | 311 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostCore); |
| 314 }; | 312 }; |
| 315 | 313 |
| 316 } // namespace browser_sync | 314 } // namespace browser_sync |
| 317 | 315 |
| 318 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_CORE_H_ | 316 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_CORE_H_ |
| OLD | NEW |