| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 COMPONENTS_SYNC_SYNCABLE_ENTRY_KERNEL_H_ | 5 #ifndef COMPONENTS_SYNC_SYNCABLE_ENTRY_KERNEL_H_ |
| 6 #define COMPONENTS_SYNC_SYNCABLE_ENTRY_KERNEL_H_ | 6 #define COMPONENTS_SYNC_SYNCABLE_ENTRY_KERNEL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 // and was therefore in the middle of a commit operation. | 188 // and was therefore in the middle of a commit operation. |
| 189 // Note: must only be set if SYNCING is true. | 189 // Note: must only be set if SYNCING is true. |
| 190 DIRTY_SYNC, | 190 DIRTY_SYNC, |
| 191 BIT_TEMPS_END, | 191 BIT_TEMPS_END, |
| 192 }; | 192 }; |
| 193 | 193 |
| 194 enum { BIT_TEMPS_COUNT = BIT_TEMPS_END - BIT_TEMPS_BEGIN }; | 194 enum { BIT_TEMPS_COUNT = BIT_TEMPS_END - BIT_TEMPS_BEGIN }; |
| 195 | 195 |
| 196 struct EntryKernel { | 196 struct EntryKernel { |
| 197 private: | 197 private: |
| 198 typedef ProtoValuePtr<sync_pb::EntitySpecifics> EntitySpecificsPtr; | 198 using EntitySpecificsPtr = ProtoValuePtr<sync_pb::EntitySpecifics>; |
| 199 typedef ProtoValuePtr<sync_pb::AttachmentMetadata> AttachmentMetadataPtr; | 199 using AttachmentMetadataPtr = ProtoValuePtr<sync_pb::AttachmentMetadata>; |
| 200 | 200 |
| 201 std::string string_fields[STRING_FIELDS_COUNT]; | 201 std::string string_fields[STRING_FIELDS_COUNT]; |
| 202 EntitySpecificsPtr specifics_fields[PROTO_FIELDS_COUNT]; | 202 EntitySpecificsPtr specifics_fields[PROTO_FIELDS_COUNT]; |
| 203 int64_t int64_fields[INT64_FIELDS_COUNT]; | 203 int64_t int64_fields[INT64_FIELDS_COUNT]; |
| 204 base::Time time_fields[TIME_FIELDS_COUNT]; | 204 base::Time time_fields[TIME_FIELDS_COUNT]; |
| 205 Id id_fields[ID_FIELDS_COUNT]; | 205 Id id_fields[ID_FIELDS_COUNT]; |
| 206 UniquePosition unique_position_fields[UNIQUE_POSITION_FIELDS_COUNT]; | 206 UniquePosition unique_position_fields[UNIQUE_POSITION_FIELDS_COUNT]; |
| 207 AttachmentMetadataPtr | 207 AttachmentMetadataPtr |
| 208 attachment_metadata_fields[ATTACHMENT_METADATA_FIELDS_COUNT]; | 208 attachment_metadata_fields[ATTACHMENT_METADATA_FIELDS_COUNT]; |
| 209 std::bitset<BIT_FIELDS_COUNT> bit_fields; | 209 std::bitset<BIT_FIELDS_COUNT> bit_fields; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 }; | 388 }; |
| 389 | 389 |
| 390 template <typename T> | 390 template <typename T> |
| 391 class EntryKernelLessByMetaHandle { | 391 class EntryKernelLessByMetaHandle { |
| 392 public: | 392 public: |
| 393 inline bool operator()(T a, T b) const { | 393 inline bool operator()(T a, T b) const { |
| 394 return a->ref(META_HANDLE) < b->ref(META_HANDLE); | 394 return a->ref(META_HANDLE) < b->ref(META_HANDLE); |
| 395 } | 395 } |
| 396 }; | 396 }; |
| 397 | 397 |
| 398 typedef std::set<const EntryKernel*, | 398 using EntryKernelSet = |
| 399 EntryKernelLessByMetaHandle<const EntryKernel*>> | 399 std::set<const EntryKernel*, |
| 400 EntryKernelSet; | 400 EntryKernelLessByMetaHandle<const EntryKernel*>>; |
| 401 | 401 |
| 402 typedef std::set< | 402 using OwnedEntryKernelSet = |
| 403 std::unique_ptr<EntryKernel>, | 403 std::set<std::unique_ptr<EntryKernel>, |
| 404 EntryKernelLessByMetaHandle<const std::unique_ptr<EntryKernel>&>> | 404 EntryKernelLessByMetaHandle<const std::unique_ptr<EntryKernel>&>>; |
| 405 OwnedEntryKernelSet; | |
| 406 | 405 |
| 407 struct EntryKernelMutation { | 406 struct EntryKernelMutation { |
| 408 EntryKernel original, mutated; | 407 EntryKernel original, mutated; |
| 409 }; | 408 }; |
| 410 | 409 |
| 411 typedef std::map<int64_t, EntryKernelMutation> EntryKernelMutationMap; | 410 using EntryKernelMutationMap = std::map<int64_t, EntryKernelMutation>; |
| 412 | 411 |
| 413 typedef Immutable<EntryKernelMutationMap> ImmutableEntryKernelMutationMap; | 412 using ImmutableEntryKernelMutationMap = Immutable<EntryKernelMutationMap>; |
| 414 | 413 |
| 415 std::unique_ptr<base::DictionaryValue> EntryKernelMutationToValue( | 414 std::unique_ptr<base::DictionaryValue> EntryKernelMutationToValue( |
| 416 const EntryKernelMutation& mutation); | 415 const EntryKernelMutation& mutation); |
| 417 | 416 |
| 418 std::unique_ptr<base::ListValue> EntryKernelMutationMapToValue( | 417 std::unique_ptr<base::ListValue> EntryKernelMutationMapToValue( |
| 419 const EntryKernelMutationMap& mutations); | 418 const EntryKernelMutationMap& mutations); |
| 420 | 419 |
| 421 std::ostream& operator<<(std::ostream& os, const EntryKernel& entry_kernel); | 420 std::ostream& operator<<(std::ostream& os, const EntryKernel& entry_kernel); |
| 422 | 421 |
| 423 } // namespace syncable | 422 } // namespace syncable |
| 424 } // namespace syncer | 423 } // namespace syncer |
| 425 | 424 |
| 426 #endif // COMPONENTS_SYNC_SYNCABLE_ENTRY_KERNEL_H_ | 425 #endif // COMPONENTS_SYNC_SYNCABLE_ENTRY_KERNEL_H_ |
| OLD | NEW |