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