| 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 SYNC_SYNCABLE_ENTRY_KERNEL_H_ | 5 #ifndef SYNC_SYNCABLE_ENTRY_KERNEL_H_ |
| 6 #define SYNC_SYNCABLE_ENTRY_KERNEL_H_ | 6 #define SYNC_SYNCABLE_ENTRY_KERNEL_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 117 |
| 118 enum StringField { | 118 enum StringField { |
| 119 // Name, will be truncated by server. Can be duplicated in a folder. | 119 // Name, will be truncated by server. Can be duplicated in a folder. |
| 120 NON_UNIQUE_NAME = STRING_FIELDS_BEGIN, | 120 NON_UNIQUE_NAME = STRING_FIELDS_BEGIN, |
| 121 // The server version of |NON_UNIQUE_NAME|. | 121 // The server version of |NON_UNIQUE_NAME|. |
| 122 SERVER_NON_UNIQUE_NAME, | 122 SERVER_NON_UNIQUE_NAME, |
| 123 | 123 |
| 124 // A tag string which identifies this node as a particular top-level | 124 // A tag string which identifies this node as a particular top-level |
| 125 // permanent object. The tag can be thought of as a unique key that | 125 // permanent object. The tag can be thought of as a unique key that |
| 126 // identifies a singleton instance. | 126 // identifies a singleton instance. |
| 127 UNIQUE_SERVER_TAG, // Tagged by the server | 127 UNIQUE_SERVER_TAG, // Tagged by the server |
| 128 UNIQUE_CLIENT_TAG, // Tagged by the client | 128 UNIQUE_CLIENT_TAG, // Tagged by the client |
| 129 UNIQUE_BOOKMARK_TAG, // Client tags for bookmark items | 129 UNIQUE_BOOKMARK_TAG, // Client tags for bookmark items |
| 130 STRING_FIELDS_END, | 130 STRING_FIELDS_END, |
| 131 }; | 131 }; |
| 132 | 132 |
| 133 enum { | 133 enum { |
| 134 STRING_FIELDS_COUNT = STRING_FIELDS_END - STRING_FIELDS_BEGIN, | 134 STRING_FIELDS_COUNT = STRING_FIELDS_END - STRING_FIELDS_BEGIN, |
| 135 PROTO_FIELDS_BEGIN = STRING_FIELDS_END | 135 PROTO_FIELDS_BEGIN = STRING_FIELDS_END |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 // From looking at the sqlite3 docs, it's not directly stated, but it | 138 // From looking at the sqlite3 docs, it's not directly stated, but it |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 // and was therefore in the middle of a commit operation. | 184 // and was therefore in the middle of a commit operation. |
| 185 // Note: must only be set if SYNCING is true. | 185 // Note: must only be set if SYNCING is true. |
| 186 DIRTY_SYNC, | 186 DIRTY_SYNC, |
| 187 BIT_TEMPS_END, | 187 BIT_TEMPS_END, |
| 188 }; | 188 }; |
| 189 | 189 |
| 190 enum { | 190 enum { |
| 191 BIT_TEMPS_COUNT = BIT_TEMPS_END - BIT_TEMPS_BEGIN | 191 BIT_TEMPS_COUNT = BIT_TEMPS_END - BIT_TEMPS_BEGIN |
| 192 }; | 192 }; |
| 193 | 193 |
| 194 | |
| 195 | |
| 196 struct SYNC_EXPORT_PRIVATE EntryKernel { | 194 struct SYNC_EXPORT_PRIVATE EntryKernel { |
| 197 private: | 195 private: |
| 198 std::string string_fields[STRING_FIELDS_COUNT]; | 196 std::string string_fields[STRING_FIELDS_COUNT]; |
| 199 EntitySpecificsPtr specifics_fields[PROTO_FIELDS_COUNT]; | 197 EntitySpecificsPtr specifics_fields[PROTO_FIELDS_COUNT]; |
| 200 int64 int64_fields[INT64_FIELDS_COUNT]; | 198 int64 int64_fields[INT64_FIELDS_COUNT]; |
| 201 base::Time time_fields[TIME_FIELDS_COUNT]; | 199 base::Time time_fields[TIME_FIELDS_COUNT]; |
| 202 Id id_fields[ID_FIELDS_COUNT]; | 200 Id id_fields[ID_FIELDS_COUNT]; |
| 203 UniquePosition unique_position_fields[UNIQUE_POSITION_FIELDS_COUNT]; | 201 UniquePosition unique_position_fields[UNIQUE_POSITION_FIELDS_COUNT]; |
| 204 AttachmentMetadataPtr | 202 AttachmentMetadataPtr |
| 205 attachment_metadata_fields[ATTACHMENT_METADATA_FIELDS_COUNT]; | 203 attachment_metadata_fields[ATTACHMENT_METADATA_FIELDS_COUNT]; |
| 206 std::bitset<BIT_FIELDS_COUNT> bit_fields; | 204 std::bitset<BIT_FIELDS_COUNT> bit_fields; |
| 207 std::bitset<BIT_TEMPS_COUNT> bit_temps; | 205 std::bitset<BIT_TEMPS_COUNT> bit_temps; |
| 208 | 206 |
| 207 friend std::ostream& operator<<(std::ostream& s, const EntryKernel& e); |
| 208 |
| 209 public: | 209 public: |
| 210 EntryKernel(); | 210 EntryKernel(); |
| 211 ~EntryKernel(); | 211 ~EntryKernel(); |
| 212 | 212 |
| 213 // Set the dirty bit, and optionally add this entry's metahandle to | 213 // Set the dirty bit, and optionally add this entry's metahandle to |
| 214 // a provided index on dirty bits in |dirty_index|. Parameter may be null, | 214 // a provided index on dirty bits in |dirty_index|. Parameter may be null, |
| 215 // and will result only in setting the dirty bit of this entry. | 215 // and will result only in setting the dirty bit of this entry. |
| 216 inline void mark_dirty(syncable::MetahandleSet* dirty_index) { | 216 inline void mark_dirty(syncable::MetahandleSet* dirty_index) { |
| 217 if (!dirty_ && dirty_index) { | 217 if (!dirty_ && dirty_index) { |
| 218 DCHECK_NE(0, ref(META_HANDLE)); | 218 DCHECK_NE(0, ref(META_HANDLE)); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 typedef Immutable<EntryKernelMutationMap> ImmutableEntryKernelMutationMap; | 386 typedef Immutable<EntryKernelMutationMap> ImmutableEntryKernelMutationMap; |
| 387 | 387 |
| 388 // Caller owns the return value. | 388 // Caller owns the return value. |
| 389 base::DictionaryValue* EntryKernelMutationToValue( | 389 base::DictionaryValue* EntryKernelMutationToValue( |
| 390 const EntryKernelMutation& mutation); | 390 const EntryKernelMutation& mutation); |
| 391 | 391 |
| 392 // Caller owns the return value. | 392 // Caller owns the return value. |
| 393 base::ListValue* EntryKernelMutationMapToValue( | 393 base::ListValue* EntryKernelMutationMapToValue( |
| 394 const EntryKernelMutationMap& mutations); | 394 const EntryKernelMutationMap& mutations); |
| 395 | 395 |
| 396 std::ostream& operator<<(std::ostream& os, const EntryKernel& entry_kernel); |
| 397 |
| 396 } // namespace syncable | 398 } // namespace syncable |
| 397 } // namespace syncer | 399 } // namespace syncer |
| 398 | 400 |
| 399 #endif // SYNC_SYNCABLE_ENTRY_KERNEL_H_ | 401 #endif // SYNC_SYNCABLE_ENTRY_KERNEL_H_ |
| OLD | NEW |