Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(666)

Side by Side Diff: chrome/browser/sync/syncable/syncable.h

Issue 5159001: Rest of the autofill work. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Autofill code after fixing the lint errors. Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_H_ 5 #ifndef CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_H_
6 #define CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_H_ 6 #define CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <bitset> 10 #include <bitset>
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 // All methods which require the kernel lock to be already held take a 629 // All methods which require the kernel lock to be already held take a
630 // ScopeKernelLock* argument. 630 // ScopeKernelLock* argument.
631 // 631 //
632 // To prevent deadlock, the reader writer transaction lock must always 632 // To prevent deadlock, the reader writer transaction lock must always
633 // be held before acquiring the kernel lock. 633 // be held before acquiring the kernel lock.
634 class ScopedKernelLock; 634 class ScopedKernelLock;
635 class IdFilter; 635 class IdFilter;
636 class DirectoryManager; 636 class DirectoryManager;
637 struct PathMatcher; 637 struct PathMatcher;
638 638
639 struct AutofillMigrationDebugInfo {
640 enum PropertyToSet {
641 MIGRATION_TIME,
642 BOOKMARK_ADDED,
643 ENTRIES_ADDED,
644 PROFILES_ADDED
645 };
646 int64 autofill_migration_time;
647 int bookmarks_added_during_migration;
648 int autofill_entries_added_during_migration;
649 int autofill_profile_added_during_migration;
650 };
651
639 class Directory { 652 class Directory {
640 friend class BaseTransaction; 653 friend class BaseTransaction;
641 friend class Entry; 654 friend class Entry;
642 friend class MutableEntry; 655 friend class MutableEntry;
643 friend class ReadTransaction; 656 friend class ReadTransaction;
644 friend class ReadTransactionWithoutDB; 657 friend class ReadTransactionWithoutDB;
645 friend class ScopedKernelLock; 658 friend class ScopedKernelLock;
646 friend class ScopedKernelUnlock; 659 friend class ScopedKernelUnlock;
647 friend class WriteTransaction; 660 friend class WriteTransaction;
648 friend class SyncableDirectoryTest; 661 friend class SyncableDirectoryTest;
649 FRIEND_TEST_ALL_PREFIXES(SyncableDirectoryTest, 662 FRIEND_TEST_ALL_PREFIXES(SyncableDirectoryTest,
650 TakeSnapshotGetsAllDirtyHandlesTest); 663 TakeSnapshotGetsAllDirtyHandlesTest);
651 FRIEND_TEST_ALL_PREFIXES(SyncableDirectoryTest, 664 FRIEND_TEST_ALL_PREFIXES(SyncableDirectoryTest,
652 TakeSnapshotGetsOnlyDirtyHandlesTest); 665 TakeSnapshotGetsOnlyDirtyHandlesTest);
653 FRIEND_TEST_ALL_PREFIXES(SyncableDirectoryTest, TestPurgeEntriesWithTypeIn); 666 FRIEND_TEST_ALL_PREFIXES(SyncableDirectoryTest, TestPurgeEntriesWithTypeIn);
654 FRIEND_TEST_ALL_PREFIXES(SyncableDirectoryTest, 667 FRIEND_TEST_ALL_PREFIXES(SyncableDirectoryTest,
655 TakeSnapshotGetsMetahandlesToPurge); 668 TakeSnapshotGetsMetahandlesToPurge);
656 669
657 public: 670 public:
658 class EventListenerHookup; 671 class EventListenerHookup;
659 672
660 // Various data that the Directory::Kernel we are backing (persisting data 673 // Various data that the Directory::Kernel we are backing (persisting data
661 // for) needs saved across runs of the application. 674 // for) needs saved across runs of the application.
662 struct PersistedKernelInfo { 675 struct PersistedKernelInfo {
676 enum AutofillMigrationState {
677 NOT_DETERMINED,
678 NOT_MIGRATED,
679 MIGRATED,
680 INSUFFICIENT_INFO_TO_DETERMINE
681 };
682
683 AutofillMigrationDebugInfo autofill_migration_debug_info;
684
663 PersistedKernelInfo(); 685 PersistedKernelInfo();
664 ~PersistedKernelInfo(); 686 ~PersistedKernelInfo();
665 687
666 // Last sync timestamp fetched from the server. 688 // Last sync timestamp fetched from the server.
667 int64 last_download_timestamp[MODEL_TYPE_COUNT]; 689 int64 last_download_timestamp[MODEL_TYPE_COUNT];
668 // true iff we ever reached the end of the changelog. 690 // true iff we ever reached the end of the changelog.
669 ModelTypeBitSet initial_sync_ended; 691 ModelTypeBitSet initial_sync_ended;
670 // The store birthday we were given by the server. Contents are opaque to 692 // The store birthday we were given by the server. Contents are opaque to
671 // the client. 693 // the client.
672 std::string store_birthday; 694 std::string store_birthday;
673 // The next local ID that has not been used with this cache-GUID. 695 // The next local ID that has not been used with this cache-GUID.
674 int64 next_id; 696 int64 next_id;
675 // The persisted notification state. 697 // The persisted notification state.
676 std::string notification_state; 698 std::string notification_state;
699
700 AutofillMigrationState autofill_migration_state;
677 }; 701 };
678 702
679 // What the Directory needs on initialization to create itself and its Kernel. 703 // What the Directory needs on initialization to create itself and its Kernel.
680 // Filled by DirectoryBackingStore::Load. 704 // Filled by DirectoryBackingStore::Load.
681 struct KernelLoadInfo { 705 struct KernelLoadInfo {
682 PersistedKernelInfo kernel_info; 706 PersistedKernelInfo kernel_info;
683 std::string cache_guid; // Created on first initialization, never changes. 707 std::string cache_guid; // Created on first initialization, never changes.
684 int64 max_metahandle; // Computed (using sql MAX aggregate) on init. 708 int64 max_metahandle; // Computed (using sql MAX aggregate) on init.
685 KernelLoadInfo() : max_metahandle(0) { 709 KernelLoadInfo() : max_metahandle(0) {
686 } 710 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 result.timestamp = stamp; 771 result.timestamp = stamp;
748 } 772 }
749 if (stamp == result.timestamp) 773 if (stamp == result.timestamp)
750 result.data_types.set(i); 774 result.data_types.set(i);
751 } 775 }
752 return result; 776 return result;
753 } 777 }
754 778
755 bool initial_sync_ended_for_type(ModelType type) const; 779 bool initial_sync_ended_for_type(ModelType type) const;
756 void set_initial_sync_ended_for_type(ModelType type, bool value); 780 void set_initial_sync_ended_for_type(ModelType type, bool value);
781 PersistedKernelInfo::AutofillMigrationState
782 get_autofill_migration_state() const;
783
784 AutofillMigrationDebugInfo get_autofill_migration_debug_info() const;
785
786 void set_autofill_migration_state(
787 PersistedKernelInfo::AutofillMigrationState state);
788
789 template <class T> void TestAndSet(T* kernel_data, const T* data_to_set);
790
791 void set_autofill_migration_state_debug_info(
792 syncable::AutofillMigrationDebugInfo::PropertyToSet property_to_set,
793 const syncable::AutofillMigrationDebugInfo& info);
757 794
758 const std::string& name() const { return kernel_->name; } 795 const std::string& name() const { return kernel_->name; }
759 796
760 // (Account) Store birthday is opaque to the client, 797 // (Account) Store birthday is opaque to the client,
761 // so we keep it in the format it is in the proto buffer 798 // so we keep it in the format it is in the proto buffer
762 // in case we switch to a binary birthday later. 799 // in case we switch to a binary birthday later.
763 std::string store_birthday() const; 800 std::string store_birthday() const;
764 void set_store_birthday(std::string store_birthday); 801 void set_store_birthday(std::string store_birthday);
765 802
766 std::string GetAndClearNotificationState(); 803 std::string GetAndClearNotificationState();
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
1138 void ZeroFields(EntryKernel* entry, int first_field); 1175 void ZeroFields(EntryKernel* entry, int first_field);
1139 1176
1140 } // namespace syncable 1177 } // namespace syncable
1141 1178
1142 std::ostream& operator <<(std::ostream&, const syncable::Blob&); 1179 std::ostream& operator <<(std::ostream&, const syncable::Blob&);
1143 1180
1144 browser_sync::FastDump& operator << 1181 browser_sync::FastDump& operator <<
1145 (browser_sync::FastDump&, const syncable::Blob&); 1182 (browser_sync::FastDump&, const syncable::Blob&);
1146 1183
1147 #endif // CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_H_ 1184 #endif // CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698