OLD | NEW |
---|---|
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...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 | |
763 get_autofill_migration_state() const; | |
tim (not reviewing)
2010/12/15 20:11:42
nit - previous line or fix indent.
lipalani
2010/12/15 21:28:15
Done.
| |
764 | |
765 AutofillMigrationDebugInfo get_autofill_migration_debug_info() const; | |
766 | |
767 void set_autofill_migration_state(AutofillMigrationState state); | |
768 | |
769 template <class T> void TestAndSet(T* kernel_data, const T* data_to_set); | |
tim (not reviewing)
2010/12/15 20:11:42
does this really need to be in public section?
lipalani
2010/12/15 21:28:15
Done.
| |
770 | |
771 void set_autofill_migration_state_debug_info( | |
772 syncable::AutofillMigrationDebugInfo::PropertyToSet property_to_set, | |
773 const syncable::AutofillMigrationDebugInfo& info); | |
757 | 774 |
758 const std::string& name() const { return kernel_->name; } | 775 const std::string& name() const { return kernel_->name; } |
759 | 776 |
760 // (Account) Store birthday is opaque to the client, | 777 // (Account) Store birthday is opaque to the client, |
761 // so we keep it in the format it is in the proto buffer | 778 // so we keep it in the format it is in the proto buffer |
762 // in case we switch to a binary birthday later. | 779 // in case we switch to a binary birthday later. |
763 std::string store_birthday() const; | 780 std::string store_birthday() const; |
764 void set_store_birthday(std::string store_birthday); | 781 void set_store_birthday(std::string store_birthday); |
765 | 782 |
766 std::string GetAndClearNotificationState(); | 783 std::string GetAndClearNotificationState(); |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1138 void ZeroFields(EntryKernel* entry, int first_field); | 1155 void ZeroFields(EntryKernel* entry, int first_field); |
1139 | 1156 |
1140 } // namespace syncable | 1157 } // namespace syncable |
1141 | 1158 |
1142 std::ostream& operator <<(std::ostream&, const syncable::Blob&); | 1159 std::ostream& operator <<(std::ostream&, const syncable::Blob&); |
1143 | 1160 |
1144 browser_sync::FastDump& operator << | 1161 browser_sync::FastDump& operator << |
1145 (browser_sync::FastDump&, const syncable::Blob&); | 1162 (browser_sync::FastDump&, const syncable::Blob&); |
1146 | 1163 |
1147 #endif // CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_H_ | 1164 #endif // CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_H_ |
OLD | NEW |