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> |
| 9 |
8 #include "base/time.h" | 10 #include "base/time.h" |
9 #include "base/values.h" | 11 #include "base/values.h" |
10 #include "sync/base/sync_export.h" | 12 #include "sync/base/sync_export.h" |
11 #include "sync/internal_api/public/base/model_type.h" | 13 #include "sync/internal_api/public/base/model_type.h" |
12 #include "sync/internal_api/public/base/node_ordinal.h" | 14 #include "sync/internal_api/public/base/node_ordinal.h" |
13 #include "sync/internal_api/public/util/immutable.h" | 15 #include "sync/internal_api/public/util/immutable.h" |
14 #include "sync/protocol/sync.pb.h" | 16 #include "sync/protocol/sync.pb.h" |
15 #include "sync/syncable/metahandle_set.h" | 17 #include "sync/syncable/metahandle_set.h" |
16 #include "sync/syncable/syncable_id.h" | 18 #include "sync/syncable/syncable_id.h" |
17 #include "sync/util/time.h" | 19 #include "sync/util/time.h" |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 // Note: |cryptographer| is an optional parameter for use in decrypting | 318 // Note: |cryptographer| is an optional parameter for use in decrypting |
317 // encrypted specifics. If it is NULL or the specifics are not decryptsble, | 319 // encrypted specifics. If it is NULL or the specifics are not decryptsble, |
318 // they will be serialized as empty proto's. | 320 // they will be serialized as empty proto's. |
319 base::DictionaryValue* ToValue(Cryptographer* cryptographer) const; | 321 base::DictionaryValue* ToValue(Cryptographer* cryptographer) const; |
320 | 322 |
321 private: | 323 private: |
322 // Tracks whether this entry needs to be saved to the database. | 324 // Tracks whether this entry needs to be saved to the database. |
323 bool dirty_; | 325 bool dirty_; |
324 }; | 326 }; |
325 | 327 |
| 328 class EntryKernelLessByMetaHandle { |
| 329 public: |
| 330 inline bool operator()(const EntryKernel* a, |
| 331 const EntryKernel* b) const { |
| 332 return a->ref(META_HANDLE) < b->ref(META_HANDLE); |
| 333 } |
| 334 }; |
| 335 |
| 336 typedef std::set<const EntryKernel*, EntryKernelLessByMetaHandle> |
| 337 EntryKernelSet; |
| 338 |
326 struct EntryKernelMutation { | 339 struct EntryKernelMutation { |
327 EntryKernel original, mutated; | 340 EntryKernel original, mutated; |
328 }; | 341 }; |
329 | 342 |
330 typedef std::map<int64, EntryKernelMutation> EntryKernelMutationMap; | 343 typedef std::map<int64, EntryKernelMutation> EntryKernelMutationMap; |
331 | 344 |
332 typedef Immutable<EntryKernelMutationMap> ImmutableEntryKernelMutationMap; | 345 typedef Immutable<EntryKernelMutationMap> ImmutableEntryKernelMutationMap; |
333 | 346 |
334 // Caller owns the return value. | 347 // Caller owns the return value. |
335 base::DictionaryValue* EntryKernelMutationToValue( | 348 base::DictionaryValue* EntryKernelMutationToValue( |
336 const EntryKernelMutation& mutation); | 349 const EntryKernelMutation& mutation); |
337 | 350 |
338 // Caller owns the return value. | 351 // Caller owns the return value. |
339 base::ListValue* EntryKernelMutationMapToValue( | 352 base::ListValue* EntryKernelMutationMapToValue( |
340 const EntryKernelMutationMap& mutations); | 353 const EntryKernelMutationMap& mutations); |
341 | 354 |
342 } // namespace syncable | 355 } // namespace syncable |
343 } // namespace syncer | 356 } // namespace syncer |
344 | 357 |
345 #endif // SYNC_SYNCABLE_ENTRY_KERNEL_H_ | 358 #endif // SYNC_SYNCABLE_ENTRY_KERNEL_H_ |
OLD | NEW |