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

Side by Side Diff: chrome/browser/sync/invalidations/invalidator_storage.h

Issue 11570009: Split PrefService into PrefService, PrefServiceSimple and PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to head again, previous had unrelated broken win_rel test. Created 8 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) 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_
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "base/threading/thread_checker.h" 15 #include "base/threading/thread_checker.h"
16 #include "sync/notifier/invalidation_state_tracker.h" 16 #include "sync/notifier/invalidation_state_tracker.h"
17 17
18 class PrefService; 18 class PrefServiceSyncable;
19 19
20 namespace base { 20 namespace base {
21 class DictionaryValue; 21 class DictionaryValue;
22 class ListValue; 22 class ListValue;
23 } 23 }
24 24
25 namespace browser_sync { 25 namespace browser_sync {
26 26
27 // TODO(tim): Bug 124137. We may want to move this outside of sync/ into a 27 // TODO(tim): Bug 124137. We may want to move this outside of sync/ into a
28 // browser/invalidations directory, or re-organize to have a browser 28 // browser/invalidations directory, or re-organize to have a browser
29 // subdirectory that contains signin/ sync/ invalidations/ and other cloud 29 // subdirectory that contains signin/ sync/ invalidations/ and other cloud
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(PrefService* 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. 40 // Erases invalidation versions and state stored on disk.
41 void Clear(); 41 void Clear();
42 42
43 // InvalidationStateTracker implementation. 43 // InvalidationStateTracker implementation.
44 virtual syncer::InvalidationStateMap GetAllInvalidationStates() const 44 virtual syncer::InvalidationStateMap GetAllInvalidationStates() const
45 OVERRIDE; 45 OVERRIDE;
46 virtual void SetMaxVersionAndPayload(const invalidation::ObjectId& id, 46 virtual void SetMaxVersionAndPayload(const invalidation::ObjectId& id,
47 int64 max_version, 47 int64 max_version,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 const syncer::InvalidationStateMap& state_map, 87 const syncer::InvalidationStateMap& state_map,
88 base::ListValue* state_map_list); 88 base::ListValue* state_map_list);
89 89
90 // Code for migrating from old MaxInvalidationVersions pref, which was a map 90 // Code for migrating from old MaxInvalidationVersions pref, which was a map
91 // from sync types to max invalidation versions. 91 // from sync types to max invalidation versions.
92 void MigrateMaxInvalidationVersionsPref(); 92 void MigrateMaxInvalidationVersionsPref();
93 static void DeserializeMap(const base::DictionaryValue* max_versions_dict, 93 static void DeserializeMap(const base::DictionaryValue* max_versions_dict,
94 syncer::InvalidationStateMap* map); 94 syncer::InvalidationStateMap* map);
95 95
96 // May be NULL. 96 // May be NULL.
97 PrefService* const pref_service_; 97 PrefServiceSyncable* const pref_service_;
98 98
99 DISALLOW_COPY_AND_ASSIGN(InvalidatorStorage); 99 DISALLOW_COPY_AND_ASSIGN(InvalidatorStorage);
100 }; 100 };
101 101
102 } // namespace browser_sync 102 } // namespace browser_sync
103 103
104 #endif // CHROME_BROWSER_SYNC_INVALIDATIONS_INVALIDATOR_STORAGE_H_ 104 #endif // CHROME_BROWSER_SYNC_INVALIDATIONS_INVALIDATOR_STORAGE_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/session_model_associator.cc ('k') | chrome/browser/sync/invalidations/invalidator_storage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698