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

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

Issue 10451058: sync: move invalidation version prefs out of SyncPrefs into InvalidatorStorage. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: init Created 8 years, 6 months 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
(Empty)
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
3 // found in the LICENSE file.
4 //
5 // Wraps PrefService in an InvalidationStateTracker to allow SyncNotifiers
6 // to use PrefService as persistence for invalidation state. It is not thread
7 // safe, and lives on the UI thread.
8
9 #ifndef CHROME_BROWSER_SYNC_INVALIDATIONS_INVALIDATOR_STORAGE_H_
10 #define CHROME_BROWSER_SYNC_INVALIDATIONS_INVALIDATOR_STORAGE_H_
11
12 #include "base/basictypes.h"
13 #include "base/memory/weak_ptr.h"
14 #include "base/threading/non_thread_safe.h"
15 #include "sync/notifier/invalidation_state_tracker.h"
16 #include "sync/syncable/model_type.h"
17
18 class PrefService;
19
20 namespace browser_sync {
21
22 // TODO(tim): Bug 124137. We may want to move this outside of sync/ into a
23 // browser/invalidations directory, or re-organize to have a browser
24 // subdirectory that contains signin/ sync/ invalidations/ and other cloud
25 // services. For now this is still tied to sync while we refactor, so minimize
26 // churn and keep it here.
27 class InvalidatorStorage : public base::SupportsWeakPtr<InvalidatorStorage>,
28 public sync_notifier::InvalidationStateTracker {
29 public:
30 // |pref_service| may be NULL (for unit tests), but in that case no setter
31 // methods should be called. Does not own |pref_service|.
32 explicit InvalidatorStorage(PrefService* pref_service);
33 virtual ~InvalidatorStorage();
34
35 // Erases invalidation versions and state stored on disk.
36 void Clear();
37
38 // InvalidationStateTracker implementation.
39 virtual sync_notifier::InvalidationVersionMap GetAllMaxVersions() const
40 OVERRIDE;
41 virtual void SetMaxVersion(syncable::ModelType model_type,
42 int64 max_version) OVERRIDE;
43 // TODO(tim): These are not yet used. Bug 124140.
44 virtual void SetInvalidationState(const std::string& state) OVERRIDE;
45 virtual std::string GetInvalidationState() const OVERRIDE;
46
47 private:
48 base::NonThreadSafe non_thread_safe_;
49
50 // May be NULL.
51 PrefService* const pref_service_;
52
53 DISALLOW_COPY_AND_ASSIGN(InvalidatorStorage);
54 };
55
56 } // namespace browser_sync
57
58 #endif // CHROME_BROWSER_SYNC_INVALIDATIONS_INVALIDATOR_STORAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698