| 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 15 matching lines...) Expand all Loading... |
| 26 namespace browser_sync { | 26 namespace browser_sync { |
| 27 | 27 |
| 28 class ChangeProcessor; | 28 class ChangeProcessor; |
| 29 class UIModelWorker; | 29 class UIModelWorker; |
| 30 | 30 |
| 31 // A class that keep track of the workers, change processors, and | 31 // A class that keep track of the workers, change processors, and |
| 32 // routing info for the enabled sync types, and also routes change | 32 // routing info for the enabled sync types, and also routes change |
| 33 // events to the right processors. | 33 // events to the right processors. |
| 34 class SyncBackendRegistrar : public syncer::SyncManager::ChangeDelegate { | 34 class SyncBackendRegistrar : public syncer::SyncManager::ChangeDelegate { |
| 35 public: | 35 public: |
| 36 // |initial_types| contains the initial set of types to sync | 36 // |name| is used for debugging. Does not take ownership of |profile| or |
| 37 // (initially put in the passive group). |name| is used for | 37 // |sync_loop|. Must be created on the UI thread. |
| 38 // debugging. Does not take ownership of |profile| or |sync_loop|. | 38 SyncBackendRegistrar(const std::string& name, |
| 39 // Must be created on the UI thread. | |
| 40 SyncBackendRegistrar(syncer::ModelTypeSet initial_types, | |
| 41 const std::string& name, | |
| 42 Profile* profile, | 39 Profile* profile, |
| 43 MessageLoop* sync_loop); | 40 MessageLoop* sync_loop); |
| 44 | 41 |
| 42 // Informs the SyncBackendRegistrar of the currently enabled set of types. |
| 43 // These types will be placed in the passive group. This function should be |
| 44 // called exactly once during startup. |
| 45 void SetInitialTypes(syncer::ModelTypeSet initial_types); |
| 46 |
| 45 // SyncBackendRegistrar must be destroyed as follows: | 47 // SyncBackendRegistrar must be destroyed as follows: |
| 46 // | 48 // |
| 47 // 1) On the sync thread, call OnSyncerShutdownComplete() after | 49 // 1) On the sync thread, call OnSyncerShutdownComplete() after |
| 48 // the syncer is shutdown. | 50 // the syncer is shutdown. |
| 49 // 2) Meanwhile, on the UI thread, call StopOnUIThread(), which | 51 // 2) Meanwhile, on the UI thread, call StopOnUIThread(), which |
| 50 // blocks until OnSyncerShutdownComplete() is called. | 52 // blocks until OnSyncerShutdownComplete() is called. |
| 51 // 3) Destroy the SyncBackendRegistrar. | 53 // 3) Destroy the SyncBackendRegistrar. |
| 52 // | 54 // |
| 53 // This is to handle the complicated shutdown requirements of the | 55 // This is to handle the complicated shutdown requirements of the |
| 54 // UIModelWorker (since the UI thread is both the main thread and a | 56 // UIModelWorker (since the UI thread is both the main thread and a |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 | 151 |
| 150 // The change processors that handle the different data types. | 152 // The change processors that handle the different data types. |
| 151 std::map<syncer::ModelType, ChangeProcessor*> processors_; | 153 std::map<syncer::ModelType, ChangeProcessor*> processors_; |
| 152 | 154 |
| 153 DISALLOW_COPY_AND_ASSIGN(SyncBackendRegistrar); | 155 DISALLOW_COPY_AND_ASSIGN(SyncBackendRegistrar); |
| 154 }; | 156 }; |
| 155 | 157 |
| 156 } // namespace browser_sync | 158 } // namespace browser_sync |
| 157 | 159 |
| 158 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_REGISTRAR_H_ | 160 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_REGISTRAR_H_ |
| OLD | NEW |