| 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 SYNC_ENGINE_MODEL_SAFE_WORKER_H_ | 5 #ifndef SYNC_ENGINE_MODEL_SAFE_WORKER_H_ |
| 6 #define SYNC_ENGINE_MODEL_SAFE_WORKER_H_ | 6 #define SYNC_ENGINE_MODEL_SAFE_WORKER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 // Caller takes ownership of return value. | 72 // Caller takes ownership of return value. |
| 73 base::DictionaryValue* ModelSafeRoutingInfoToValue( | 73 base::DictionaryValue* ModelSafeRoutingInfoToValue( |
| 74 const ModelSafeRoutingInfo& routing_info); | 74 const ModelSafeRoutingInfo& routing_info); |
| 75 | 75 |
| 76 std::string ModelSafeRoutingInfoToString( | 76 std::string ModelSafeRoutingInfoToString( |
| 77 const ModelSafeRoutingInfo& routing_info); | 77 const ModelSafeRoutingInfo& routing_info); |
| 78 | 78 |
| 79 syncable::ModelTypeSet GetRoutingInfoTypes( | 79 syncable::ModelTypeSet GetRoutingInfoTypes( |
| 80 const ModelSafeRoutingInfo& routing_info); | 80 const ModelSafeRoutingInfo& routing_info); |
| 81 | 81 |
| 82 // Extracts a ModelTypeSet containing all types that map to |group| in |
| 83 // |routing_info|. |
| 84 syncable::FullModelTypeSet GetModelTypesForGroup( |
| 85 ModelSafeGroup group, |
| 86 const ModelSafeRoutingInfo& routing_info); |
| 87 |
| 82 ModelSafeGroup GetGroupForModelType(const syncable::ModelType type, | 88 ModelSafeGroup GetGroupForModelType(const syncable::ModelType type, |
| 83 const ModelSafeRoutingInfo& routes); | 89 const ModelSafeRoutingInfo& routes); |
| 84 | 90 |
| 85 // Maintain the up-to-date state regarding which ModelSafeWorkers exist and | 91 // Maintain the up-to-date state regarding which ModelSafeWorkers exist and |
| 86 // which types get routed to which worker. When a sync session begins, it will | 92 // which types get routed to which worker. When a sync session begins, it will |
| 87 // snapshot the state at that instant, and will use that for the entire | 93 // snapshot the state at that instant, and will use that for the entire |
| 88 // session. This means if a model becomes synced (or unsynced) by the user | 94 // session. This means if a model becomes synced (or unsynced) by the user |
| 89 // during a sync session, that session will complete and be unaware of this | 95 // during a sync session, that session will complete and be unaware of this |
| 90 // change -- it will only get picked up for the next session. | 96 // change -- it will only get picked up for the next session. |
| 91 // TODO(tim): That's really the only way I can make sense of it in the Syncer | 97 // TODO(tim): That's really the only way I can make sense of it in the Syncer |
| (...skipping 11 matching lines...) Expand all Loading... |
| 103 virtual void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) = 0; | 109 virtual void GetModelSafeRoutingInfo(ModelSafeRoutingInfo* out) = 0; |
| 104 protected: | 110 protected: |
| 105 virtual ~ModelSafeWorkerRegistrar() {} | 111 virtual ~ModelSafeWorkerRegistrar() {} |
| 106 private: | 112 private: |
| 107 DISALLOW_COPY_AND_ASSIGN(ModelSafeWorkerRegistrar); | 113 DISALLOW_COPY_AND_ASSIGN(ModelSafeWorkerRegistrar); |
| 108 }; | 114 }; |
| 109 | 115 |
| 110 } // namespace browser_sync | 116 } // namespace browser_sync |
| 111 | 117 |
| 112 #endif // SYNC_ENGINE_MODEL_SAFE_WORKER_H_ | 118 #endif // SYNC_ENGINE_MODEL_SAFE_WORKER_H_ |
| OLD | NEW |