OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_DIRECTORY_H_ | 5 #ifndef COMPONENTS_SYNC_SYNCABLE_DIRECTORY_H_ |
6 #define COMPONENTS_SYNC_SYNCABLE_DIRECTORY_H_ | 6 #define COMPONENTS_SYNC_SYNCABLE_DIRECTORY_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 // preserve sync preferences in DB on disk. | 493 // preserve sync preferences in DB on disk. |
494 void UnmarkDirtyEntry(WriteTransaction* trans, Entry* entry); | 494 void UnmarkDirtyEntry(WriteTransaction* trans, Entry* entry); |
495 | 495 |
496 // Clears |ids| and fills it with the ids of attachments that need to be | 496 // Clears |ids| and fills it with the ids of attachments that need to be |
497 // uploaded to the sync server. | 497 // uploaded to the sync server. |
498 void GetAttachmentIdsToUpload(BaseTransaction* trans, | 498 void GetAttachmentIdsToUpload(BaseTransaction* trans, |
499 ModelType type, | 499 ModelType type, |
500 AttachmentIdList* ids); | 500 AttachmentIdList* ids); |
501 | 501 |
502 // For new entry creation only. | 502 // For new entry creation only. |
503 bool InsertEntry(BaseWriteTransaction* trans, EntryKernel* entry); | 503 bool InsertEntry(BaseWriteTransaction* trans, |
| 504 std::unique_ptr<EntryKernel> entry); |
504 | 505 |
505 // Update the attachment index for |metahandle| removing it from the index | 506 // Update the attachment index for |metahandle| removing it from the index |
506 // under |old_metadata| entries and add it under |new_metadata| entries. | 507 // under |old_metadata| entries and add it under |new_metadata| entries. |
507 void UpdateAttachmentIndex(const int64_t metahandle, | 508 void UpdateAttachmentIndex(const int64_t metahandle, |
508 const sync_pb::AttachmentMetadata& old_metadata, | 509 const sync_pb::AttachmentMetadata& old_metadata, |
509 const sync_pb::AttachmentMetadata& new_metadata); | 510 const sync_pb::AttachmentMetadata& new_metadata); |
510 | 511 |
511 virtual EntryKernel* GetEntryById(const Id& id); | 512 virtual EntryKernel* GetEntryById(const Id& id); |
512 virtual EntryKernel* GetEntryByClientTag(const std::string& tag); | 513 virtual EntryKernel* GetEntryByClientTag(const std::string& tag); |
513 EntryKernel* GetEntryByServerTag(const std::string& tag); | 514 EntryKernel* GetEntryByServerTag(const std::string& tag); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 // constructs a ScopedKernelLock before calling the corresponding private | 551 // constructs a ScopedKernelLock before calling the corresponding private |
551 // overload with the held ScopedKernelLock. | 552 // overload with the held ScopedKernelLock. |
552 | 553 |
553 virtual EntryKernel* GetEntryByHandle(const ScopedKernelLock& lock, | 554 virtual EntryKernel* GetEntryByHandle(const ScopedKernelLock& lock, |
554 int64_t metahandle); | 555 int64_t metahandle); |
555 | 556 |
556 virtual EntryKernel* GetEntryById(const ScopedKernelLock& lock, const Id& id); | 557 virtual EntryKernel* GetEntryById(const ScopedKernelLock& lock, const Id& id); |
557 | 558 |
558 bool InsertEntry(const ScopedKernelLock& lock, | 559 bool InsertEntry(const ScopedKernelLock& lock, |
559 BaseWriteTransaction* trans, | 560 BaseWriteTransaction* trans, |
560 EntryKernel* entry); | 561 std::unique_ptr<EntryKernel> entry); |
561 | 562 |
562 // Remove each of |metahandle|'s attachment ids from index_by_attachment_id. | 563 // Remove each of |metahandle|'s attachment ids from index_by_attachment_id. |
563 void RemoveFromAttachmentIndex( | 564 void RemoveFromAttachmentIndex( |
564 const ScopedKernelLock& lock, | 565 const ScopedKernelLock& lock, |
565 const int64_t metahandle, | 566 const int64_t metahandle, |
566 const sync_pb::AttachmentMetadata& attachment_metadata); | 567 const sync_pb::AttachmentMetadata& attachment_metadata); |
567 | 568 |
568 // Add each of |metahandle|'s attachment ids to the index_by_attachment_id. | 569 // Add each of |metahandle|'s attachment ids to the index_by_attachment_id. |
569 void AddToAttachmentIndex( | 570 void AddToAttachmentIndex( |
570 const ScopedKernelLock& lock, | 571 const ScopedKernelLock& lock, |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 | 668 |
668 base::WeakPtrFactory<Directory> weak_ptr_factory_; | 669 base::WeakPtrFactory<Directory> weak_ptr_factory_; |
669 | 670 |
670 DISALLOW_COPY_AND_ASSIGN(Directory); | 671 DISALLOW_COPY_AND_ASSIGN(Directory); |
671 }; | 672 }; |
672 | 673 |
673 } // namespace syncable | 674 } // namespace syncable |
674 } // namespace syncer | 675 } // namespace syncer |
675 | 676 |
676 #endif // COMPONENTS_SYNC_SYNCABLE_DIRECTORY_H_ | 677 #endif // COMPONENTS_SYNC_SYNCABLE_DIRECTORY_H_ |
OLD | NEW |