Chromium Code Reviews| Index: sync/syncable/entry_kernel.h |
| diff --git a/sync/syncable/entry_kernel.h b/sync/syncable/entry_kernel.h |
| index 383ffd71c00349b1136f3ea0fbc5a7474dd351a5..1e3e8967897a68e4ce9b122534584706d4c6e420 100644 |
| --- a/sync/syncable/entry_kernel.h |
| +++ b/sync/syncable/entry_kernel.h |
| @@ -8,6 +8,7 @@ |
| #include "base/time.h" |
| #include "base/values.h" |
| #include "sync/internal_api/public/base/model_type.h" |
| +#include "sync/internal_api/public/base/node_ordinal.h" |
| #include "sync/internal_api/public/util/immutable.h" |
| #include "sync/protocol/sync.pb.h" |
| #include "sync/syncable/metahandle_set.h" |
| @@ -21,8 +22,8 @@ namespace syncable { |
| // - EntryKernel struct in this file |
| // - syncable_columns.h |
| // - syncable_enum_conversions{.h,.cc,_unittest.cc} |
| -// - EntryKernel::EntryKernel(), EntryKernel::ToValue(), operator<< |
| -// for Entry in syncable.cc |
| +// - EntryKernel::EntryKernel(), EntryKernel::ToValue() in entry_kernel.cc |
| +// - operator<< in Entry.cc |
| // - BindFields() and UnpackEntry() in directory_backing_store.cc |
| // - TestSimpleFieldsPreservedDuringSaveChanges in syncable_unittest.cc |
| @@ -48,13 +49,8 @@ enum BaseVersion { |
| enum Int64Field { |
| SERVER_VERSION = BASE_VERSION + 1, |
|
rlarocque
2012/10/05 19:02:55
nit: Might as well delete this line, too, to keep
vishwath
2012/10/05 21:05:48
Done.
|
| - // A numeric position value that indicates the relative ordering of |
| - // this object among its siblings. |
| - SERVER_POSITION_IN_PARENT, |
| - |
| LOCAL_EXTERNAL_ID, // ID of an item in the external local storage that this |
| // entry is associated with. (such as bookmarks.js) |
| - |
| INT64_FIELDS_END |
| }; |
| @@ -143,9 +139,21 @@ enum ProtoField { |
| }; |
| enum { |
| - FIELD_COUNT = PROTO_FIELDS_END, |
| + ORDINAL_FIELDS_BEGIN = PROTO_FIELDS_END |
| +}; |
| + |
| +enum OrdinalField { |
| + // An Ordinal that identifies the relative ordering of this object |
| + // among its siblings. |
| + SERVER_ORDINAL_IN_PARENT = ORDINAL_FIELDS_BEGIN, |
| + ORDINAL_FIELDS_END |
| +}; |
| + |
| +enum { |
| + ORDINAL_FIELDS_COUNT = ORDINAL_FIELDS_END - ORDINAL_FIELDS_BEGIN, |
| + FIELD_COUNT = ORDINAL_FIELDS_END, |
| // Past this point we have temporaries, stored in memory only. |
| - BEGIN_TEMPS = PROTO_FIELDS_END, |
| + BEGIN_TEMPS = ORDINAL_FIELDS_END, |
| BIT_TEMPS_BEGIN = BEGIN_TEMPS, |
| }; |
| @@ -172,6 +180,7 @@ struct EntryKernel { |
| int64 int64_fields[INT64_FIELDS_COUNT]; |
| base::Time time_fields[TIME_FIELDS_COUNT]; |
| Id id_fields[ID_FIELDS_COUNT]; |
| + NodeOrdinal ordinal_fields[ORDINAL_FIELDS_COUNT]; |
| std::bitset<BIT_FIELDS_COUNT> bit_fields; |
| std::bitset<BIT_TEMPS_COUNT> bit_temps; |
| @@ -239,6 +248,9 @@ struct EntryKernel { |
| inline void put(ProtoField field, const sync_pb::EntitySpecifics& value) { |
| specifics_fields[field - PROTO_FIELDS_BEGIN].CopyFrom(value); |
| } |
| + inline void put(OrdinalField field, const NodeOrdinal& value) { |
| + ordinal_fields[field - ORDINAL_FIELDS_BEGIN] = value; |
| + } |
| inline void put(BitTemp field, bool value) { |
| bit_temps[field - BIT_TEMPS_BEGIN] = value; |
| } |
| @@ -274,6 +286,9 @@ struct EntryKernel { |
| inline const sync_pb::EntitySpecifics& ref(ProtoField field) const { |
| return specifics_fields[field - PROTO_FIELDS_BEGIN]; |
| } |
| + inline const NodeOrdinal& ref(OrdinalField field) const { |
| + return ordinal_fields[field - ORDINAL_FIELDS_BEGIN]; |
| + } |
| inline bool ref(BitTemp field) const { |
| return bit_temps[field - BIT_TEMPS_BEGIN]; |
| } |
| @@ -288,6 +303,9 @@ struct EntryKernel { |
| inline Id& mutable_ref(IdField field) { |
| return id_fields[field - ID_FIELDS_BEGIN]; |
| } |
| + inline NodeOrdinal& mutable_ref(OrdinalField field) { |
| + return ordinal_fields[field - ORDINAL_FIELDS_BEGIN]; |
| + } |
| ModelType GetServerModelType() const; |