| 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 SYNC_SYNCABLE_DIRECTORY_H_ | 5 #ifndef SYNC_SYNCABLE_DIRECTORY_H_ |
| 6 #define SYNC_SYNCABLE_DIRECTORY_H_ | 6 #define SYNC_SYNCABLE_DIRECTORY_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "base/containers/hash_tables.h" | 14 #include "base/containers/hash_tables.h" |
| 15 #include "base/files/file_util.h" | 15 #include "base/files/file_util.h" |
| 16 #include "base/gtest_prod_util.h" | 16 #include "base/gtest_prod_util.h" |
| 17 #include "base/values.h" | 17 #include "base/values.h" |
| 18 #include "sync/api/attachments/attachment_id.h" |
| 18 #include "sync/base/sync_export.h" | 19 #include "sync/base/sync_export.h" |
| 19 #include "sync/internal_api/public/util/report_unrecoverable_error_function.h" | 20 #include "sync/internal_api/public/util/report_unrecoverable_error_function.h" |
| 20 #include "sync/internal_api/public/util/weak_handle.h" | 21 #include "sync/internal_api/public/util/weak_handle.h" |
| 21 #include "sync/syncable/dir_open_result.h" | 22 #include "sync/syncable/dir_open_result.h" |
| 22 #include "sync/syncable/entry.h" | 23 #include "sync/syncable/entry.h" |
| 23 #include "sync/syncable/entry_kernel.h" | 24 #include "sync/syncable/entry_kernel.h" |
| 24 #include "sync/syncable/metahandle_set.h" | 25 #include "sync/syncable/metahandle_set.h" |
| 25 #include "sync/syncable/parent_child_index.h" | 26 #include "sync/syncable/parent_child_index.h" |
| 26 #include "sync/syncable/syncable_delete_journal.h" | 27 #include "sync/syncable/syncable_delete_journal.h" |
| 27 | 28 |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 void GetMetahandlesByAttachmentId( | 407 void GetMetahandlesByAttachmentId( |
| 407 BaseTransaction* trans, | 408 BaseTransaction* trans, |
| 408 const sync_pb::AttachmentIdProto& attachment_id_proto, | 409 const sync_pb::AttachmentIdProto& attachment_id_proto, |
| 409 Metahandles* result); | 410 Metahandles* result); |
| 410 | 411 |
| 411 // Change entry to not dirty. Used in special case when we don't want to | 412 // Change entry to not dirty. Used in special case when we don't want to |
| 412 // persist modified entry on disk. e.g. SyncBackupManager uses this to | 413 // persist modified entry on disk. e.g. SyncBackupManager uses this to |
| 413 // preserve sync preferences in DB on disk. | 414 // preserve sync preferences in DB on disk. |
| 414 void UnmarkDirtyEntry(WriteTransaction* trans, Entry* entry); | 415 void UnmarkDirtyEntry(WriteTransaction* trans, Entry* entry); |
| 415 | 416 |
| 417 // Clears |id_set| and fills it with the ids of attachments that need to be |
| 418 // uploaded to the sync server. |
| 419 void GetAttachmentIdsToUpload(BaseTransaction* trans, |
| 420 ModelType type, |
| 421 AttachmentIdSet* id_set); |
| 422 |
| 416 protected: // for friends, mainly used by Entry constructors | 423 protected: // for friends, mainly used by Entry constructors |
| 417 virtual EntryKernel* GetEntryByHandle(int64 handle); | 424 virtual EntryKernel* GetEntryByHandle(int64 handle); |
| 418 virtual EntryKernel* GetEntryByHandle(int64 metahandle, | 425 virtual EntryKernel* GetEntryByHandle(int64 metahandle, |
| 419 ScopedKernelLock* lock); | 426 ScopedKernelLock* lock); |
| 420 virtual EntryKernel* GetEntryById(const Id& id); | 427 virtual EntryKernel* GetEntryById(const Id& id); |
| 421 EntryKernel* GetEntryByServerTag(const std::string& tag); | 428 EntryKernel* GetEntryByServerTag(const std::string& tag); |
| 422 virtual EntryKernel* GetEntryByClientTag(const std::string& tag); | 429 virtual EntryKernel* GetEntryByClientTag(const std::string& tag); |
| 423 bool ReindexId(BaseWriteTransaction* trans, EntryKernel* const entry, | 430 bool ReindexId(BaseWriteTransaction* trans, EntryKernel* const entry, |
| 424 const Id& new_id); | 431 const Id& new_id); |
| 425 bool ReindexParentId(BaseWriteTransaction* trans, EntryKernel* const entry, | 432 bool ReindexParentId(BaseWriteTransaction* trans, EntryKernel* const entry, |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 void RemoveFromAttachmentIndex( | 603 void RemoveFromAttachmentIndex( |
| 597 const int64 metahandle, | 604 const int64 metahandle, |
| 598 const sync_pb::AttachmentMetadata& attachment_metadata, | 605 const sync_pb::AttachmentMetadata& attachment_metadata, |
| 599 const ScopedKernelLock& lock); | 606 const ScopedKernelLock& lock); |
| 600 // Add each of |metahandle|'s attachment ids to the index_by_attachment_id. | 607 // Add each of |metahandle|'s attachment ids to the index_by_attachment_id. |
| 601 void AddToAttachmentIndex( | 608 void AddToAttachmentIndex( |
| 602 const int64 metahandle, | 609 const int64 metahandle, |
| 603 const sync_pb::AttachmentMetadata& attachment_metadata, | 610 const sync_pb::AttachmentMetadata& attachment_metadata, |
| 604 const ScopedKernelLock& lock); | 611 const ScopedKernelLock& lock); |
| 605 | 612 |
| 613 // A private version of the public GetMetaHandlesOfType for when you already |
| 614 // have a ScopedKernelLock. |
| 615 void GetMetaHandlesOfType(const ScopedKernelLock& lock, |
| 616 BaseTransaction* trans, |
| 617 ModelType type, |
| 618 std::vector<int64>* result); |
| 619 |
| 606 Kernel* kernel_; | 620 Kernel* kernel_; |
| 607 | 621 |
| 608 scoped_ptr<DirectoryBackingStore> store_; | 622 scoped_ptr<DirectoryBackingStore> store_; |
| 609 | 623 |
| 610 UnrecoverableErrorHandler* const unrecoverable_error_handler_; | 624 UnrecoverableErrorHandler* const unrecoverable_error_handler_; |
| 611 const ReportUnrecoverableErrorFunction report_unrecoverable_error_function_; | 625 const ReportUnrecoverableErrorFunction report_unrecoverable_error_function_; |
| 612 bool unrecoverable_error_set_; | 626 bool unrecoverable_error_set_; |
| 613 | 627 |
| 614 // Not owned. | 628 // Not owned. |
| 615 NigoriHandler* const nigori_handler_; | 629 NigoriHandler* const nigori_handler_; |
| 616 Cryptographer* const cryptographer_; | 630 Cryptographer* const cryptographer_; |
| 617 | 631 |
| 618 InvariantCheckLevel invariant_check_level_; | 632 InvariantCheckLevel invariant_check_level_; |
| 619 | 633 |
| 620 // Maintain deleted entries not in |kernel_| until it's verified that they | 634 // Maintain deleted entries not in |kernel_| until it's verified that they |
| 621 // are deleted in native models as well. | 635 // are deleted in native models as well. |
| 622 scoped_ptr<DeleteJournal> delete_journal_; | 636 scoped_ptr<DeleteJournal> delete_journal_; |
| 623 | 637 |
| 624 DISALLOW_COPY_AND_ASSIGN(Directory); | 638 DISALLOW_COPY_AND_ASSIGN(Directory); |
| 625 }; | 639 }; |
| 626 | 640 |
| 627 } // namespace syncable | 641 } // namespace syncable |
| 628 } // namespace syncer | 642 } // namespace syncer |
| 629 | 643 |
| 630 #endif // SYNC_SYNCABLE_DIRECTORY_H_ | 644 #endif // SYNC_SYNCABLE_DIRECTORY_H_ |
| OLD | NEW |