Chromium Code Reviews

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: patch uploaded to debug why try servers have problem applying this patch. Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
« no previous file with comments | « chrome/browser/sync/syncable/model_type.cc ('k') | chrome/browser/sync/syncable/syncable.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
11 #include <iosfwd> 11 #include <iosfwd>
12 #include <limits> 12 #include <limits>
13 #include <set> 13 #include <set>
14 #include <string> 14 #include <string>
15 #include <vector> 15 #include <vector>
16 16
17 #include "base/atomicops.h" 17 #include "base/atomicops.h"
18 #include "base/basictypes.h" 18 #include "base/basictypes.h"
19 #include "base/file_path.h" 19 #include "base/file_path.h"
20 #include "base/gtest_prod_util.h" 20 #include "base/gtest_prod_util.h"
21 #include "base/lock.h" 21 #include "base/lock.h"
22 #include "base/time.h" 22 #include "base/time.h"
23 #include "chrome/browser/sync/protocol/sync.pb.h" 23 #include "chrome/browser/sync/protocol/sync.pb.h"
24 #include "chrome/browser/sync/syncable/autofill_migration.h"
24 #include "chrome/browser/sync/syncable/blob.h" 25 #include "chrome/browser/sync/syncable/blob.h"
25 #include "chrome/browser/sync/syncable/dir_open_result.h" 26 #include "chrome/browser/sync/syncable/dir_open_result.h"
26 #include "chrome/browser/sync/syncable/directory_event.h" 27 #include "chrome/browser/sync/syncable/directory_event.h"
27 #include "chrome/browser/sync/syncable/path_name_cmp.h" 28 #include "chrome/browser/sync/syncable/path_name_cmp.h"
28 #include "chrome/browser/sync/syncable/syncable_id.h" 29 #include "chrome/browser/sync/syncable/syncable_id.h"
29 #include "chrome/browser/sync/syncable/model_type.h" 30 #include "chrome/browser/sync/syncable/model_type.h"
30 #include "chrome/browser/sync/util/channel.h" 31 #include "chrome/browser/sync/util/channel.h"
31 #include "chrome/browser/sync/util/dbgq.h" 32 #include "chrome/browser/sync/util/dbgq.h"
32 #include "chrome/common/deprecated/event_sys.h" 33 #include "chrome/common/deprecated/event_sys.h"
33 34
(...skipping 619 matching lines...)
653 FRIEND_TEST_ALL_PREFIXES(SyncableDirectoryTest, TestPurgeEntriesWithTypeIn); 654 FRIEND_TEST_ALL_PREFIXES(SyncableDirectoryTest, TestPurgeEntriesWithTypeIn);
654 FRIEND_TEST_ALL_PREFIXES(SyncableDirectoryTest, 655 FRIEND_TEST_ALL_PREFIXES(SyncableDirectoryTest,
655 TakeSnapshotGetsMetahandlesToPurge); 656 TakeSnapshotGetsMetahandlesToPurge);
656 657
657 public: 658 public:
658 class EventListenerHookup; 659 class EventListenerHookup;
659 660
660 // Various data that the Directory::Kernel we are backing (persisting data 661 // Various data that the Directory::Kernel we are backing (persisting data
661 // for) needs saved across runs of the application. 662 // for) needs saved across runs of the application.
662 struct PersistedKernelInfo { 663 struct PersistedKernelInfo {
664 AutofillMigrationDebugInfo autofill_migration_debug_info;
665
663 PersistedKernelInfo(); 666 PersistedKernelInfo();
664 ~PersistedKernelInfo(); 667 ~PersistedKernelInfo();
665 668
666 // Last sync timestamp fetched from the server. 669 // Last sync timestamp fetched from the server.
667 int64 last_download_timestamp[MODEL_TYPE_COUNT]; 670 int64 last_download_timestamp[MODEL_TYPE_COUNT];
668 // true iff we ever reached the end of the changelog. 671 // true iff we ever reached the end of the changelog.
669 ModelTypeBitSet initial_sync_ended; 672 ModelTypeBitSet initial_sync_ended;
670 // The store birthday we were given by the server. Contents are opaque to 673 // The store birthday we were given by the server. Contents are opaque to
671 // the client. 674 // the client.
672 std::string store_birthday; 675 std::string store_birthday;
673 // The next local ID that has not been used with this cache-GUID. 676 // The next local ID that has not been used with this cache-GUID.
674 int64 next_id; 677 int64 next_id;
675 // The persisted notification state. 678 // The persisted notification state.
676 std::string notification_state; 679 std::string notification_state;
680
681 AutofillMigrationState autofill_migration_state;
677 }; 682 };
678 683
679 // What the Directory needs on initialization to create itself and its Kernel. 684 // What the Directory needs on initialization to create itself and its Kernel.
680 // Filled by DirectoryBackingStore::Load. 685 // Filled by DirectoryBackingStore::Load.
681 struct KernelLoadInfo { 686 struct KernelLoadInfo {
682 PersistedKernelInfo kernel_info; 687 PersistedKernelInfo kernel_info;
683 std::string cache_guid; // Created on first initialization, never changes. 688 std::string cache_guid; // Created on first initialization, never changes.
684 int64 max_metahandle; // Computed (using sql MAX aggregate) on init. 689 int64 max_metahandle; // Computed (using sql MAX aggregate) on init.
685 KernelLoadInfo() : max_metahandle(0) { 690 KernelLoadInfo() : max_metahandle(0) {
686 } 691 }
(...skipping 60 matching lines...)
747 result.timestamp = stamp; 752 result.timestamp = stamp;
748 } 753 }
749 if (stamp == result.timestamp) 754 if (stamp == result.timestamp)
750 result.data_types.set(i); 755 result.data_types.set(i);
751 } 756 }
752 return result; 757 return result;
753 } 758 }
754 759
755 bool initial_sync_ended_for_type(ModelType type) const; 760 bool initial_sync_ended_for_type(ModelType type) const;
756 void set_initial_sync_ended_for_type(ModelType type, bool value); 761 void set_initial_sync_ended_for_type(ModelType type, bool value);
762 AutofillMigrationState get_autofill_migration_state() const;
763
764 AutofillMigrationDebugInfo get_autofill_migration_debug_info() const;
765
766 void set_autofill_migration_state(AutofillMigrationState state);
767
768 void set_autofill_migration_state_debug_info(
769 syncable::AutofillMigrationDebugInfo::PropertyToSet property_to_set,
770 const syncable::AutofillMigrationDebugInfo& info);
757 771
758 const std::string& name() const { return kernel_->name; } 772 const std::string& name() const { return kernel_->name; }
759 773
760 // (Account) Store birthday is opaque to the client, 774 // (Account) Store birthday is opaque to the client,
761 // so we keep it in the format it is in the proto buffer 775 // so we keep it in the format it is in the proto buffer
762 // in case we switch to a binary birthday later. 776 // in case we switch to a binary birthday later.
763 std::string store_birthday() const; 777 std::string store_birthday() const;
764 void set_store_birthday(std::string store_birthday); 778 void set_store_birthday(std::string store_birthday);
765 779
766 std::string GetAndClearNotificationState(); 780 std::string GetAndClearNotificationState();
(...skipping 30 matching lines...)
797 const std::string& dir_name, 811 const std::string& dir_name,
798 const FilePath& backing_filepath); 812 const FilePath& backing_filepath);
799 813
800 private: 814 private:
801 // These private versions expect the kernel lock to already be held 815 // These private versions expect the kernel lock to already be held
802 // before calling. 816 // before calling.
803 EntryKernel* GetEntryById(const Id& id, ScopedKernelLock* const lock); 817 EntryKernel* GetEntryById(const Id& id, ScopedKernelLock* const lock);
804 818
805 DirOpenResult OpenImpl(const FilePath& file_path, const std::string& name); 819 DirOpenResult OpenImpl(const FilePath& file_path, const std::string& name);
806 820
821 template <class T> void TestAndSet(T* kernel_data, const T* data_to_set);
822
807 struct DirectoryEventTraits { 823 struct DirectoryEventTraits {
808 typedef DirectoryEvent EventType; 824 typedef DirectoryEvent EventType;
809 static inline bool IsChannelShutdownEvent(const DirectoryEvent& event) { 825 static inline bool IsChannelShutdownEvent(const DirectoryEvent& event) {
810 return DIRECTORY_DESTROYED == event; 826 return DIRECTORY_DESTROYED == event;
811 } 827 }
812 }; 828 };
813 public: 829 public:
814 typedef EventChannel<DirectoryEventTraits, Lock> Channel; 830 typedef EventChannel<DirectoryEventTraits, Lock> Channel;
815 typedef std::vector<int64> ChildHandles; 831 typedef std::vector<int64> ChildHandles;
816 832
(...skipping 321 matching lines...)
1138 void ZeroFields(EntryKernel* entry, int first_field); 1154 void ZeroFields(EntryKernel* entry, int first_field);
1139 1155
1140 } // namespace syncable 1156 } // namespace syncable
1141 1157
1142 std::ostream& operator <<(std::ostream&, const syncable::Blob&); 1158 std::ostream& operator <<(std::ostream&, const syncable::Blob&);
1143 1159
1144 browser_sync::FastDump& operator << 1160 browser_sync::FastDump& operator <<
1145 (browser_sync::FastDump&, const syncable::Blob&); 1161 (browser_sync::FastDump&, const syncable::Blob&);
1146 1162
1147 #endif // CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_H_ 1163 #endif // CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/syncable/model_type.cc ('k') | chrome/browser/sync/syncable/syncable.cc » ('j') | no next file with comments »

Powered by Google App Engine