| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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_ENGINE_MODEL_SAFE_WORKER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_ENGINE_MODEL_SAFE_WORKER_H_ |
| 6 #define CHROME_BROWSER_SYNC_ENGINE_MODEL_SAFE_WORKER_H_ | 6 #define CHROME_BROWSER_SYNC_ENGINE_MODEL_SAFE_WORKER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/ref_counted.h" | 11 #include "base/ref_counted.h" |
| 12 #include "chrome/browser/sync/syncable/model_type.h" | 12 #include "chrome/browser/sync/syncable/model_type.h" |
| 13 #include "chrome/browser/sync/util/closure.h" | 13 #include "chrome/browser/sync/util/closure.h" |
| 14 #include "chrome/browser/sync/util/sync_types.h" | 14 #include "chrome/browser/sync/util/sync_types.h" |
| 15 | 15 |
| 16 namespace browser_sync { | 16 namespace browser_sync { |
| 17 | 17 |
| 18 enum ModelSafeGroup { | 18 enum ModelSafeGroup { |
| 19 GROUP_PASSIVE = 0, // Models that are just "passively" being synced; e.g. | 19 GROUP_PASSIVE = 0, // Models that are just "passively" being synced; e.g. |
| 20 // changes to these models don't need to be pushed to a | 20 // changes to these models don't need to be pushed to a |
| 21 // native model. | 21 // native model. |
| 22 GROUP_UI, // Models that live on UI thread and are being synced. | 22 GROUP_UI, // Models that live on UI thread and are being synced. |
| 23 GROUP_DB, // Models that live on DB thread and are being synced. | 23 GROUP_DB, // Models that live on DB thread and are being synced. |
| 24 GROUP_HISTORY, // Models that live on history thread and are being | 24 GROUP_HISTORY, // Models that live on history thread and are being |
| 25 // synced. | 25 // synced. |
| 26 GROUP_PASSWORD, // Models that live on the password thread and are |
| 27 // being synced. On windows and linux, this runs on the |
| 28 // DB thread. |
| 26 MODEL_SAFE_GROUP_COUNT, | 29 MODEL_SAFE_GROUP_COUNT, |
| 27 }; | 30 }; |
| 28 | 31 |
| 29 // The Syncer uses a ModelSafeWorker for all tasks that could potentially | 32 // The Syncer uses a ModelSafeWorker for all tasks that could potentially |
| 30 // modify syncable entries (e.g under a WriteTransaction). The ModelSafeWorker | 33 // modify syncable entries (e.g under a WriteTransaction). The ModelSafeWorker |
| 31 // only knows how to do one thing, and that is take some work (in a fully | 34 // only knows how to do one thing, and that is take some work (in a fully |
| 32 // pre-bound callback) and have it performed (as in Run()) from a thread which | 35 // pre-bound callback) and have it performed (as in Run()) from a thread which |
| 33 // is guaranteed to be "model-safe", where "safe" refers to not allowing us to | 36 // is guaranteed to be "model-safe", where "safe" refers to not allowing us to |
| 34 // cause an embedding application model to fall out of sync with the | 37 // cause an embedding application model to fall out of sync with the |
| 35 // syncable::Directory due to a race. | 38 // syncable::Directory due to a race. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 virtual void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) = 0; | 97 virtual void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) = 0; |
| 95 protected: | 98 protected: |
| 96 virtual ~ModelSafeWorkerRegistrar() {} | 99 virtual ~ModelSafeWorkerRegistrar() {} |
| 97 private: | 100 private: |
| 98 DISALLOW_COPY_AND_ASSIGN(ModelSafeWorkerRegistrar); | 101 DISALLOW_COPY_AND_ASSIGN(ModelSafeWorkerRegistrar); |
| 99 }; | 102 }; |
| 100 | 103 |
| 101 } // namespace browser_sync | 104 } // namespace browser_sync |
| 102 | 105 |
| 103 #endif // CHROME_BROWSER_SYNC_ENGINE_MODEL_SAFE_WORKER_H_ | 106 #endif // CHROME_BROWSER_SYNC_ENGINE_MODEL_SAFE_WORKER_H_ |
| OLD | NEW |