OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_SYNC_MODEL_ENTITY_DATA_H_ | 5 #ifndef COMPONENTS_SYNC_MODEL_ENTITY_DATA_H_ |
6 #define COMPONENTS_SYNC_MODEL_ENTITY_DATA_H_ | 6 #define COMPONENTS_SYNC_MODEL_ENTITY_DATA_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <string> | 10 #include <string> |
(...skipping 10 matching lines...) Expand all Loading... |
21 struct EntityData; | 21 struct EntityData; |
22 | 22 |
23 struct EntityDataTraits { | 23 struct EntityDataTraits { |
24 static void SwapValue(EntityData* dest, EntityData* src); | 24 static void SwapValue(EntityData* dest, EntityData* src); |
25 static bool HasValue(const EntityData& value); | 25 static bool HasValue(const EntityData& value); |
26 static const EntityData& DefaultValue(); | 26 static const EntityData& DefaultValue(); |
27 }; | 27 }; |
28 | 28 |
29 using EntityDataPtr = ProtoValuePtr<EntityData, EntityDataTraits>; | 29 using EntityDataPtr = ProtoValuePtr<EntityData, EntityDataTraits>; |
30 using EntityDataList = std::vector<EntityDataPtr>; | 30 using EntityDataList = std::vector<EntityDataPtr>; |
31 using EntityDataMap = std::map<std::string, EntityDataPtr>; | |
32 | 31 |
33 // A light-weight container for sync entity data which represents either | 32 // A light-weight container for sync entity data which represents either |
34 // local data created on the ModelTypeSyncBridge side or remote data created | 33 // local data created on the ModelTypeSyncBridge side or remote data created |
35 // on ModelTypeWorker. | 34 // on ModelTypeWorker. |
36 // EntityData is supposed to be wrapped and passed by reference. | 35 // EntityData is supposed to be wrapped and passed by reference. |
37 struct EntityData { | 36 struct EntityData { |
38 public: | 37 public: |
39 EntityData(); | 38 EntityData(); |
40 ~EntityData(); | 39 ~EntityData(); |
41 | 40 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 friend struct EntityDataTraits; | 85 friend struct EntityDataTraits; |
87 // Used to transfer the data without copying. | 86 // Used to transfer the data without copying. |
88 void Swap(EntityData* other); | 87 void Swap(EntityData* other); |
89 | 88 |
90 DISALLOW_COPY_AND_ASSIGN(EntityData); | 89 DISALLOW_COPY_AND_ASSIGN(EntityData); |
91 }; | 90 }; |
92 | 91 |
93 } // namespace syncer | 92 } // namespace syncer |
94 | 93 |
95 #endif // COMPONENTS_SYNC_MODEL_ENTITY_DATA_H_ | 94 #endif // COMPONENTS_SYNC_MODEL_ENTITY_DATA_H_ |
OLD | NEW |