Make sure webrtc::VideoSource is released when WebRtcVideoTrackAdapter is destroyed.
[chromium-blink-merge.git] / components / invalidation / invalidator_storage.h
blob0101137843e7e5acf158062533ae3a40fd8fa9ff
1 // Copyright 2014 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.
9 #ifndef COMPONENTS_INVALIDATION_INVALIDATOR_STORAGE_H_
10 #define COMPONENTS_INVALIDATION_INVALIDATOR_STORAGE_H_
12 #include "base/basictypes.h"
13 #include "base/gtest_prod_util.h"
14 #include "base/threading/thread_checker.h"
15 #include "sync/notifier/invalidation_state_tracker.h"
16 #include "sync/notifier/unacked_invalidation_set.h"
18 class PrefService;
20 namespace base {
21 class DictionaryValue;
22 class ListValue;
25 namespace user_prefs {
26 class PrefRegistrySyncable;
29 namespace invalidation {
31 class InvalidatorStorage : public syncer::InvalidationStateTracker {
32 public:
33 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
35 // |pref_service| may not be NULL. Does not own |pref_service|.
36 explicit InvalidatorStorage(PrefService* pref_service);
37 virtual ~InvalidatorStorage();
39 // InvalidationStateTracker implementation.
40 virtual void ClearAndSetNewClientId(const std::string& client_id) OVERRIDE;
41 virtual std::string GetInvalidatorClientId() const OVERRIDE;
42 virtual void SetBootstrapData(const std::string& data) OVERRIDE;
43 virtual std::string GetBootstrapData() const OVERRIDE;
44 virtual void SetSavedInvalidations(
45 const syncer::UnackedInvalidationsMap& map) OVERRIDE;
46 virtual syncer::UnackedInvalidationsMap GetSavedInvalidations()
47 const OVERRIDE;
48 virtual void Clear() OVERRIDE;
50 private:
51 FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, SerializeEmptyMap);
52 FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest,
53 DeserializeFromListOutOfRange);
54 FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest,
55 DeserializeFromListInvalidFormat);
56 FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest,
57 DeserializeFromListWithDuplicates);
58 FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest,
59 DeserializeFromEmptyList);
60 FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, DeserializeFromListBasic);
61 FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest,
62 DeserializeFromListMissingOptionalValues);
63 FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, DeserializeMapOutOfRange);
64 FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, DeserializeMapInvalidFormat);
65 FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest,
66 DeserializeMapEmptyDictionary);
67 FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, DeserializeMapBasic);
68 FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, MigrateLegacyPreferences);
70 base::ThreadChecker thread_checker_;
72 PrefService* const pref_service_;
74 DISALLOW_COPY_AND_ASSIGN(InvalidatorStorage);
77 } // namespace invalidation
79 #endif // COMPONENTS_INVALIDATION_INVALIDATOR_STORAGE_H_