OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Wraps PrefService in an InvalidationStateTracker to allow SyncNotifiers | 5 // Wraps PrefService in an InvalidationStateTracker to allow SyncNotifiers |
6 // to use PrefService as persistence for invalidation state. It is not thread | 6 // to use PrefService as persistence for invalidation state. It is not thread |
7 // safe, and lives on the UI thread. | 7 // safe, and lives on the UI thread. |
8 | 8 |
9 #ifndef CHROME_BROWSER_SYNC_INVALIDATIONS_INVALIDATOR_STORAGE_H_ | 9 #ifndef CHROME_BROWSER_SYNC_INVALIDATIONS_INVALIDATOR_STORAGE_H_ |
10 #define CHROME_BROWSER_SYNC_INVALIDATIONS_INVALIDATOR_STORAGE_H_ | 10 #define CHROME_BROWSER_SYNC_INVALIDATIONS_INVALIDATOR_STORAGE_H_ |
(...skipping 19 matching lines...) Expand all Loading... |
30 // services. For now this is still tied to sync while we refactor, so minimize | 30 // services. For now this is still tied to sync while we refactor, so minimize |
31 // churn and keep it here. | 31 // churn and keep it here. |
32 class InvalidatorStorage : public base::SupportsWeakPtr<InvalidatorStorage>, | 32 class InvalidatorStorage : public base::SupportsWeakPtr<InvalidatorStorage>, |
33 public syncer::InvalidationStateTracker { | 33 public syncer::InvalidationStateTracker { |
34 public: | 34 public: |
35 // |pref_service| may be NULL (for unit tests), but in that case no setter | 35 // |pref_service| may be NULL (for unit tests), but in that case no setter |
36 // methods should be called. Does not own |pref_service|. | 36 // methods should be called. Does not own |pref_service|. |
37 explicit InvalidatorStorage(PrefServiceSyncable* pref_service); | 37 explicit InvalidatorStorage(PrefServiceSyncable* pref_service); |
38 virtual ~InvalidatorStorage(); | 38 virtual ~InvalidatorStorage(); |
39 | 39 |
40 // Erases invalidation versions and state stored on disk. | |
41 void Clear(); | |
42 | |
43 // InvalidationStateTracker implementation. | 40 // InvalidationStateTracker implementation. |
44 virtual syncer::InvalidationStateMap GetAllInvalidationStates() const | 41 virtual syncer::InvalidationStateMap GetAllInvalidationStates() const |
45 OVERRIDE; | 42 OVERRIDE; |
46 virtual void SetMaxVersionAndPayload(const invalidation::ObjectId& id, | 43 virtual void SetMaxVersionAndPayload(const invalidation::ObjectId& id, |
47 int64 max_version, | 44 int64 max_version, |
48 const std::string& payload) OVERRIDE; | 45 const std::string& payload) OVERRIDE; |
49 virtual void Forget(const syncer::ObjectIdSet& ids) OVERRIDE; | 46 virtual void Forget(const syncer::ObjectIdSet& ids) OVERRIDE; |
| 47 virtual void SetInvalidatorClientId(const std::string& client_id) OVERRIDE; |
| 48 virtual std::string GetInvalidatorClientId() const OVERRIDE; |
50 virtual void SetBootstrapData(const std::string& data) OVERRIDE; | 49 virtual void SetBootstrapData(const std::string& data) OVERRIDE; |
51 virtual std::string GetBootstrapData() const OVERRIDE; | 50 virtual std::string GetBootstrapData() const OVERRIDE; |
| 51 virtual void Clear() OVERRIDE; |
52 virtual void GenerateAckHandles( | 52 virtual void GenerateAckHandles( |
53 const syncer::ObjectIdSet& ids, | 53 const syncer::ObjectIdSet& ids, |
54 const scoped_refptr<base::TaskRunner>& task_runner, | 54 const scoped_refptr<base::TaskRunner>& task_runner, |
55 base::Callback<void(const syncer::AckHandleMap&)> callback) OVERRIDE; | 55 base::Callback<void(const syncer::AckHandleMap&)> callback) OVERRIDE; |
56 virtual void Acknowledge(const invalidation::ObjectId& id, | 56 virtual void Acknowledge(const invalidation::ObjectId& id, |
57 const syncer::AckHandle& ack_handle) OVERRIDE; | 57 const syncer::AckHandle& ack_handle) OVERRIDE; |
58 | 58 |
59 private: | 59 private: |
60 FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, SerializeEmptyMap); | 60 FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, SerializeEmptyMap); |
61 FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, | 61 FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 94 |
95 // May be NULL. | 95 // May be NULL. |
96 PrefServiceSyncable* const pref_service_; | 96 PrefServiceSyncable* const pref_service_; |
97 | 97 |
98 DISALLOW_COPY_AND_ASSIGN(InvalidatorStorage); | 98 DISALLOW_COPY_AND_ASSIGN(InvalidatorStorage); |
99 }; | 99 }; |
100 | 100 |
101 } // namespace browser_sync | 101 } // namespace browser_sync |
102 | 102 |
103 #endif // CHROME_BROWSER_SYNC_INVALIDATIONS_INVALIDATOR_STORAGE_H_ | 103 #endif // CHROME_BROWSER_SYNC_INVALIDATIONS_INVALIDATOR_STORAGE_H_ |
OLD | NEW |