| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 | 7 |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <bitset> | 9 #include <bitset> |
| 10 #include <iosfwd> | 10 #include <iosfwd> |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 friend class WriteTransaction; | 651 friend class WriteTransaction; |
| 652 friend class SyncableDirectoryTest; | 652 friend class SyncableDirectoryTest; |
| 653 FRIEND_TEST(SyncableDirectoryTest, TakeSnapshotGetsAllDirtyHandlesTest); | 653 FRIEND_TEST(SyncableDirectoryTest, TakeSnapshotGetsAllDirtyHandlesTest); |
| 654 FRIEND_TEST(SyncableDirectoryTest, TakeSnapshotGetsOnlyDirtyHandlesTest); | 654 FRIEND_TEST(SyncableDirectoryTest, TakeSnapshotGetsOnlyDirtyHandlesTest); |
| 655 | 655 |
| 656 public: | 656 public: |
| 657 // Various data that the Directory::Kernel we are backing (persisting data | 657 // Various data that the Directory::Kernel we are backing (persisting data |
| 658 // for) needs saved across runs of the application. | 658 // for) needs saved across runs of the application. |
| 659 struct PersistedKernelInfo { | 659 struct PersistedKernelInfo { |
| 660 // Last sync timestamp fetched from the server. | 660 // Last sync timestamp fetched from the server. |
| 661 int64 last_sync_timestamp; | 661 int64 last_download_timestamp; |
| 662 // true iff we ever reached the end of the changelog. | 662 // true iff we ever reached the end of the changelog. |
| 663 bool initial_sync_ended; | 663 bool initial_sync_ended; |
| 664 // The store birthday we were given by the server. Contents are opaque to | 664 // The store birthday we were given by the server. Contents are opaque to |
| 665 // the client. | 665 // the client. |
| 666 std::string store_birthday; | 666 std::string store_birthday; |
| 667 // The next local ID that has not been used with this cache-GUID. | 667 // The next local ID that has not been used with this cache-GUID. |
| 668 int64 next_id; | 668 int64 next_id; |
| 669 PersistedKernelInfo() : last_sync_timestamp(0), | 669 PersistedKernelInfo() : last_download_timestamp(0), |
| 670 initial_sync_ended(false), | 670 initial_sync_ended(false), |
| 671 next_id(0) { | 671 next_id(0) { |
| 672 } | 672 } |
| 673 }; | 673 }; |
| 674 | 674 |
| 675 // What the Directory needs on initialization to create itself and its Kernel. | 675 // What the Directory needs on initialization to create itself and its Kernel. |
| 676 // Filled by DirectoryBackingStore::Load. | 676 // Filled by DirectoryBackingStore::Load. |
| 677 struct KernelLoadInfo { | 677 struct KernelLoadInfo { |
| 678 PersistedKernelInfo kernel_info; | 678 PersistedKernelInfo kernel_info; |
| 679 std::string cache_guid; // Created on first initialization, never changes. | 679 std::string cache_guid; // Created on first initialization, never changes. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 // Always returns a negative id. Positive client ids are generated | 713 // Always returns a negative id. Positive client ids are generated |
| 714 // by the server only. | 714 // by the server only. |
| 715 Id NextId(); | 715 Id NextId(); |
| 716 | 716 |
| 717 const FilePath& file_path() const { return kernel_->db_path; } | 717 const FilePath& file_path() const { return kernel_->db_path; } |
| 718 bool good() const { return NULL != store_; } | 718 bool good() const { return NULL != store_; } |
| 719 | 719 |
| 720 // The sync timestamp is an index into the list of changes for an account. | 720 // The sync timestamp is an index into the list of changes for an account. |
| 721 // It doesn't actually map to any time scale, it's name is an historical | 721 // It doesn't actually map to any time scale, it's name is an historical |
| 722 // anomaly. | 722 // anomaly. |
| 723 int64 last_sync_timestamp() const; | 723 int64 last_download_timestamp() const; |
| 724 void set_last_sync_timestamp(int64 timestamp); | 724 void set_last_download_timestamp(int64 timestamp); |
| 725 | 725 |
| 726 bool initial_sync_ended() const; | 726 bool initial_sync_ended() const; |
| 727 void set_initial_sync_ended(bool value); | 727 void set_initial_sync_ended(bool value); |
| 728 | 728 |
| 729 const std::string& name() const { return kernel_->name; } | 729 const std::string& name() const { return kernel_->name; } |
| 730 | 730 |
| 731 // (Account) Store birthday is opaque to the client, | 731 // (Account) Store birthday is opaque to the client, |
| 732 // so we keep it in the format it is in the proto buffer | 732 // so we keep it in the format it is in the proto buffer |
| 733 // in case we switch to a binary birthday later. | 733 // in case we switch to a binary birthday later. |
| 734 std::string store_birthday() const; | 734 std::string store_birthday() const; |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 void ZeroFields(EntryKernel* entry, int first_field); | 1129 void ZeroFields(EntryKernel* entry, int first_field); |
| 1130 | 1130 |
| 1131 } // namespace syncable | 1131 } // namespace syncable |
| 1132 | 1132 |
| 1133 std::ostream& operator <<(std::ostream&, const syncable::Blob&); | 1133 std::ostream& operator <<(std::ostream&, const syncable::Blob&); |
| 1134 | 1134 |
| 1135 browser_sync::FastDump& operator << | 1135 browser_sync::FastDump& operator << |
| 1136 (browser_sync::FastDump&, const syncable::Blob&); | 1136 (browser_sync::FastDump&, const syncable::Blob&); |
| 1137 | 1137 |
| 1138 #endif // CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_H_ | 1138 #endif // CHROME_BROWSER_SYNC_SYNCABLE_SYNCABLE_H_ |
| OLD | NEW |