| 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_REGISTRAR_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_REGISTRAR_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_REGISTRAR_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_REGISTRAR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // | 51 // |
| 52 // 1) On the UI thread, call RequestWorkerStopOnUIThread(). | 52 // 1) On the UI thread, call RequestWorkerStopOnUIThread(). |
| 53 // 2) UI posts task to shut down syncer on sync thread. | 53 // 2) UI posts task to shut down syncer on sync thread. |
| 54 // 3) If sync is disabled, call ReleaseSyncThread() on the UI thread. | 54 // 3) If sync is disabled, call ReleaseSyncThread() on the UI thread. |
| 55 // 3) UI posts SyncBackendRegistrar::ShutDown() on sync thread to | 55 // 3) UI posts SyncBackendRegistrar::ShutDown() on sync thread to |
| 56 // unregister workers from observing destruction of their working loops. | 56 // unregister workers from observing destruction of their working loops. |
| 57 // 4) Workers notify registrar when unregistration finishes or working | 57 // 4) Workers notify registrar when unregistration finishes or working |
| 58 // loops are destroyed. Registrar destroys itself on last worker | 58 // loops are destroyed. Registrar destroys itself on last worker |
| 59 // notification. Sync thread will be stopped if ownership was not | 59 // notification. Sync thread will be stopped if ownership was not |
| 60 // released. | 60 // released. |
| 61 virtual ~SyncBackendRegistrar(); | 61 ~SyncBackendRegistrar() override; |
| 62 | 62 |
| 63 // Informs the SyncBackendRegistrar of the currently enabled set of types. | 63 // Informs the SyncBackendRegistrar of the currently enabled set of types. |
| 64 // These types will be placed in the passive group. This function should be | 64 // These types will be placed in the passive group. This function should be |
| 65 // called exactly once during startup. | 65 // called exactly once during startup. |
| 66 void SetInitialTypes(syncer::ModelTypeSet initial_types); | 66 void SetInitialTypes(syncer::ModelTypeSet initial_types); |
| 67 | 67 |
| 68 // Returns whether or not we are currently syncing encryption keys. | 68 // Returns whether or not we are currently syncing encryption keys. |
| 69 // Must be called on the UI thread. | 69 // Must be called on the UI thread. |
| 70 bool IsNigoriEnabled() const; | 70 bool IsNigoriEnabled() const; |
| 71 | 71 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 98 // UI thread and not |type|'s native thread. Yes, this is | 98 // UI thread and not |type|'s native thread. Yes, this is |
| 99 // surprising: see http://crbug.com/92804. | 99 // surprising: see http://crbug.com/92804. |
| 100 void DeactivateDataType(syncer::ModelType type); | 100 void DeactivateDataType(syncer::ModelType type); |
| 101 | 101 |
| 102 // Returns true only between calls to ActivateDataType(type, ...) | 102 // Returns true only between calls to ActivateDataType(type, ...) |
| 103 // and DeactivateDataType(type). Used only by tests. | 103 // and DeactivateDataType(type). Used only by tests. |
| 104 bool IsTypeActivatedForTest(syncer::ModelType type) const; | 104 bool IsTypeActivatedForTest(syncer::ModelType type) const; |
| 105 | 105 |
| 106 // SyncManager::ChangeDelegate implementation. May be called from | 106 // SyncManager::ChangeDelegate implementation. May be called from |
| 107 // any thread. | 107 // any thread. |
| 108 virtual void OnChangesApplied( | 108 void OnChangesApplied( |
| 109 syncer::ModelType model_type, | 109 syncer::ModelType model_type, |
| 110 int64 model_version, | 110 int64 model_version, |
| 111 const syncer::BaseTransaction* trans, | 111 const syncer::BaseTransaction* trans, |
| 112 const syncer::ImmutableChangeRecordList& changes) override; | 112 const syncer::ImmutableChangeRecordList& changes) override; |
| 113 virtual void OnChangesComplete(syncer::ModelType model_type) override; | 113 void OnChangesComplete(syncer::ModelType model_type) override; |
| 114 | 114 |
| 115 void GetWorkers(std::vector<scoped_refptr<syncer::ModelSafeWorker> >* out); | 115 void GetWorkers(std::vector<scoped_refptr<syncer::ModelSafeWorker> >* out); |
| 116 void GetModelSafeRoutingInfo(syncer::ModelSafeRoutingInfo* out); | 116 void GetModelSafeRoutingInfo(syncer::ModelSafeRoutingInfo* out); |
| 117 | 117 |
| 118 // syncer::WorkerLoopDestructionObserver implementation. | 118 // syncer::WorkerLoopDestructionObserver implementation. |
| 119 virtual void OnWorkerLoopDestroyed(syncer::ModelSafeGroup group) override; | 119 void OnWorkerLoopDestroyed(syncer::ModelSafeGroup group) override; |
| 120 | 120 |
| 121 // Release ownership of |sync_thread_|. Called when sync is disabled. | 121 // Release ownership of |sync_thread_|. Called when sync is disabled. |
| 122 scoped_ptr<base::Thread> ReleaseSyncThread(); | 122 scoped_ptr<base::Thread> ReleaseSyncThread(); |
| 123 | 123 |
| 124 // Unregister workers from loop destruction observation. | 124 // Unregister workers from loop destruction observation. |
| 125 void Shutdown(); | 125 void Shutdown(); |
| 126 | 126 |
| 127 base::Thread* sync_thread(); | 127 base::Thread* sync_thread(); |
| 128 | 128 |
| 129 private: | 129 private: |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 // e.g. Shutdown() depends on |lock_|, SyncManager::Init() depends on | 189 // e.g. Shutdown() depends on |lock_|, SyncManager::Init() depends on |
| 190 // workers, etc. | 190 // workers, etc. |
| 191 scoped_ptr<base::Thread> sync_thread_; | 191 scoped_ptr<base::Thread> sync_thread_; |
| 192 | 192 |
| 193 DISALLOW_COPY_AND_ASSIGN(SyncBackendRegistrar); | 193 DISALLOW_COPY_AND_ASSIGN(SyncBackendRegistrar); |
| 194 }; | 194 }; |
| 195 | 195 |
| 196 } // namespace browser_sync | 196 } // namespace browser_sync |
| 197 | 197 |
| 198 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_REGISTRAR_H_ | 198 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_REGISTRAR_H_ |
| OLD | NEW |