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> |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
526 private: | 526 private: |
527 friend class SyncableDirectoryTest; | 527 friend class SyncableDirectoryTest; |
528 friend class syncer::TestUserShare; | 528 friend class syncer::TestUserShare; |
529 FRIEND_TEST_ALL_PREFIXES(SyncableDirectoryTest, ManageDeleteJournals); | 529 FRIEND_TEST_ALL_PREFIXES(SyncableDirectoryTest, ManageDeleteJournals); |
530 FRIEND_TEST_ALL_PREFIXES(SyncableDirectoryTest, | 530 FRIEND_TEST_ALL_PREFIXES(SyncableDirectoryTest, |
531 TakeSnapshotGetsAllDirtyHandlesTest); | 531 TakeSnapshotGetsAllDirtyHandlesTest); |
532 FRIEND_TEST_ALL_PREFIXES(SyncableDirectoryTest, | 532 FRIEND_TEST_ALL_PREFIXES(SyncableDirectoryTest, |
533 TakeSnapshotGetsOnlyDirtyHandlesTest); | 533 TakeSnapshotGetsOnlyDirtyHandlesTest); |
534 FRIEND_TEST_ALL_PREFIXES(SyncableDirectoryTest, | 534 FRIEND_TEST_ALL_PREFIXES(SyncableDirectoryTest, |
535 TakeSnapshotGetsMetahandlesToPurge); | 535 TakeSnapshotGetsMetahandlesToPurge); |
536 FRIEND_TEST_ALL_PREFIXES(SyncableDirectoryTest, CatastrophicError); | |
537 | 536 |
538 // You'll notice that some of the methods below are private overloads of the | 537 // You'll notice that some of the methods below are private overloads of the |
539 // public ones declared above. The general pattern is that the public overload | 538 // public ones declared above. The general pattern is that the public overload |
540 // constructs a ScopedKernelLock before calling the corresponding private | 539 // constructs a ScopedKernelLock before calling the corresponding private |
541 // overload with the held ScopedKernelLock. | 540 // overload with the held ScopedKernelLock. |
542 | 541 |
543 virtual EntryKernel* GetEntryByHandle(const ScopedKernelLock& lock, | 542 virtual EntryKernel* GetEntryByHandle(const ScopedKernelLock& lock, |
544 int64 metahandle); | 543 int64 metahandle); |
545 | 544 |
546 virtual EntryKernel* GetEntryById(const ScopedKernelLock& lock, const Id& id); | 545 virtual EntryKernel* GetEntryById(const ScopedKernelLock& lock, const Id& id); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 EntryKernel* entry, | 615 EntryKernel* entry, |
617 EntryKernelSet* entries_to_journal); | 616 EntryKernelSet* entries_to_journal); |
618 | 617 |
619 // A private version of the public GetMetaHandlesOfType for when you already | 618 // A private version of the public GetMetaHandlesOfType for when you already |
620 // have a ScopedKernelLock. | 619 // have a ScopedKernelLock. |
621 void GetMetaHandlesOfType(const ScopedKernelLock& lock, | 620 void GetMetaHandlesOfType(const ScopedKernelLock& lock, |
622 BaseTransaction* trans, | 621 BaseTransaction* trans, |
623 ModelType type, | 622 ModelType type, |
624 std::vector<int64>* result); | 623 std::vector<int64>* result); |
625 | 624 |
626 // Invoked by DirectoryBackingStore when a catastrophic database error is | |
627 // detected. | |
628 void OnCatastrophicError(); | |
629 | |
630 // Returns true if the initial sync for |type| has completed. | 625 // Returns true if the initial sync for |type| has completed. |
631 bool InitialSyncEndedForType(BaseTransaction* trans, ModelType type); | 626 bool InitialSyncEndedForType(BaseTransaction* trans, ModelType type); |
632 | 627 |
633 // Stops sending events to the delegate and the transaction | 628 // Stops sending events to the delegate and the transaction |
634 // observer. | 629 // observer. |
635 void Close(); | 630 void Close(); |
636 | 631 |
637 // Returns true if the directory had encountered an unrecoverable error. | 632 // Returns true if the directory had encountered an unrecoverable error. |
638 // Note: Any function in |Directory| that can be called without holding a | 633 // Note: Any function in |Directory| that can be called without holding a |
639 // transaction need to check if the Directory already has an unrecoverable | 634 // transaction need to check if the Directory already has an unrecoverable |
(...skipping 11 matching lines...) Expand all Loading... |
651 // Not owned. | 646 // Not owned. |
652 NigoriHandler* const nigori_handler_; | 647 NigoriHandler* const nigori_handler_; |
653 Cryptographer* const cryptographer_; | 648 Cryptographer* const cryptographer_; |
654 | 649 |
655 InvariantCheckLevel invariant_check_level_; | 650 InvariantCheckLevel invariant_check_level_; |
656 | 651 |
657 // Maintain deleted entries not in |kernel_| until it's verified that they | 652 // Maintain deleted entries not in |kernel_| until it's verified that they |
658 // are deleted in native models as well. | 653 // are deleted in native models as well. |
659 scoped_ptr<DeleteJournal> delete_journal_; | 654 scoped_ptr<DeleteJournal> delete_journal_; |
660 | 655 |
661 base::WeakPtrFactory<Directory> weak_ptr_factory_; | |
662 | |
663 DISALLOW_COPY_AND_ASSIGN(Directory); | 656 DISALLOW_COPY_AND_ASSIGN(Directory); |
664 }; | 657 }; |
665 | 658 |
666 } // namespace syncable | 659 } // namespace syncable |
667 } // namespace syncer | 660 } // namespace syncer |
668 | 661 |
669 #endif // SYNC_SYNCABLE_DIRECTORY_H_ | 662 #endif // SYNC_SYNCABLE_DIRECTORY_H_ |
OLD | NEW |