diff options
author | xhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-24 20:08:46 +0000 |
---|---|---|
committer | xhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-24 20:08:46 +0000 |
commit | be4c04011b1f50da5aaeff601cf023a5b80a70f8 (patch) | |
tree | b4b4d31d51478d6594ebafb9c20786cc710b8bcd /components/invalidation | |
parent | 959bf2da8863a5a1ba733a3d4c63b82ec20fb4e7 (diff) | |
download | chromium_src-be4c04011b1f50da5aaeff601cf023a5b80a70f8.zip chromium_src-be4c04011b1f50da5aaeff601cf023a5b80a70f8.tar.gz chromium_src-be4c04011b1f50da5aaeff601cf023a5b80a70f8.tar.bz2 |
Revert 279461 "Add device policy invalidation"
Suspect this is the cause of failing
InvalidatorRegistrarTest.RegisteredHandlerOnDestruction test.
http://build.chromium.org/p/chromium.mac/buildstatus?builder=Mac10.7%20Tests%20%282%29&number=28062
> Add device policy invalidation
>
> This CL adds device policy invalidation: Instead of reyling on polling,
> DMServer can send Ticl invalidations to inform devices that their policy
> has changed.
>
> To receive device policy invalidations, a device-global Ticl connection
> is spun up when a device boots. If a user logs in and a Ticl connection
> is successfully established for that user, device policy invalidation
> spins down the device-global connection and switches to the user's
> Ticl connection, thereby conserving server resources.
>
> The core policy invalidation mechanims is shared with user policy
> invalidations which have been present in Chrome for several releases.
>
> BUG=358699
> TEST=Updated unit tests; manual
>
> Review URL: https://codereview.chromium.org/342683005
TBR=bartfab@chromium.org
Review URL: https://codereview.chromium.org/356603002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@279476 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components/invalidation')
-rw-r--r-- | components/invalidation/invalidator_registrar.cc | 1 | ||||
-rw-r--r-- | components/invalidation/invalidator_registrar.h | 2 | ||||
-rw-r--r-- | components/invalidation/invalidator_storage.cc | 28 | ||||
-rw-r--r-- | components/invalidation/invalidator_storage.h | 49 |
4 files changed, 45 insertions, 35 deletions
diff --git a/components/invalidation/invalidator_registrar.cc b/components/invalidation/invalidator_registrar.cc index 4019f2b..c22f259 100644 --- a/components/invalidation/invalidator_registrar.cc +++ b/components/invalidation/invalidator_registrar.cc @@ -18,6 +18,7 @@ InvalidatorRegistrar::InvalidatorRegistrar() InvalidatorRegistrar::~InvalidatorRegistrar() { DCHECK(thread_checker_.CalledOnValidThread()); + CHECK(!handlers_.might_have_observers()); CHECK(handler_to_ids_map_.empty()); } diff --git a/components/invalidation/invalidator_registrar.h b/components/invalidation/invalidator_registrar.h index c7df237..854de60 100644 --- a/components/invalidation/invalidator_registrar.h +++ b/components/invalidation/invalidator_registrar.h @@ -85,7 +85,7 @@ class INVALIDATION_EXPORT InvalidatorRegistrar { typedef std::map<InvalidationHandler*, ObjectIdSet> HandlerIdsMap; base::ThreadChecker thread_checker_; - ObserverList<InvalidationHandler, true> handlers_; + ObserverList<InvalidationHandler> handlers_; HandlerIdsMap handler_to_ids_map_; InvalidatorState state_; diff --git a/components/invalidation/invalidator_storage.cc b/components/invalidation/invalidator_storage.cc index cb24a4a..2f59efa 100644 --- a/components/invalidation/invalidator_storage.cc +++ b/components/invalidation/invalidator_storage.cc @@ -4,26 +4,25 @@ #include "components/invalidation/invalidator_storage.h" -#include <string> -#include <utility> - #include "base/base64.h" -#include "base/basictypes.h" +#include "base/bind.h" +#include "base/callback.h" +#include "base/location.h" #include "base/logging.h" -#include "base/memory/scoped_ptr.h" -#include "base/prefs/pref_registry_simple.h" +#include "base/metrics/histogram.h" #include "base/prefs/pref_service.h" +#include "base/strings/string_number_conversions.h" +#include "base/task_runner.h" #include "base/values.h" #include "components/invalidation/invalidation_prefs.h" #include "components/pref_registry/pref_registry_syncable.h" -#include "google/cacheinvalidation/types.pb.h" -#include "sync/notifier/unacked_invalidation_set.h" namespace { const char kInvalidatorMaxInvalidationVersions[] = "invalidator.max_invalidation_versions"; + bool ValueToUnackedInvalidationStorageMap( const base::ListValue& value, syncer::UnackedInvalidationsMap* map) { @@ -74,19 +73,10 @@ void InvalidatorStorage::RegisterProfilePrefs( user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); } -// static -void InvalidatorStorage::RegisterPrefs(PrefRegistrySimple* registry) { - registry->RegisterListPref(prefs::kInvalidatorSavedInvalidations); - registry->RegisterStringPref(prefs::kInvalidatorInvalidationState, - std::string()); - registry->RegisterStringPref(prefs::kInvalidatorClientId, std::string()); -} - InvalidatorStorage::InvalidatorStorage(PrefService* pref_service) : pref_service_(pref_service) { - DCHECK(pref_service_); - if (pref_service_->FindPreference(kInvalidatorMaxInvalidationVersions)) - pref_service_->ClearPref(kInvalidatorMaxInvalidationVersions); + DCHECK(pref_service); + pref_service_->ClearPref(kInvalidatorMaxInvalidationVersions); } InvalidatorStorage::~InvalidatorStorage() { diff --git a/components/invalidation/invalidator_storage.h b/components/invalidation/invalidator_storage.h index f1e330b..0101137 100644 --- a/components/invalidation/invalidator_storage.h +++ b/components/invalidation/invalidator_storage.h @@ -1,40 +1,40 @@ // Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// +// Wraps PrefService in an InvalidationStateTracker to allow SyncNotifiers +// to use PrefService as persistence for invalidation state. It is not thread +// safe, and lives on the UI thread. #ifndef COMPONENTS_INVALIDATION_INVALIDATOR_STORAGE_H_ #define COMPONENTS_INVALIDATION_INVALIDATOR_STORAGE_H_ -#include "base/compiler_specific.h" -#include "base/macros.h" +#include "base/basictypes.h" +#include "base/gtest_prod_util.h" #include "base/threading/thread_checker.h" #include "sync/notifier/invalidation_state_tracker.h" +#include "sync/notifier/unacked_invalidation_set.h" -class PrefRegistrySimple; class PrefService; +namespace base { +class DictionaryValue; +class ListValue; +} + namespace user_prefs { class PrefRegistrySyncable; } namespace invalidation { -// Wraps PrefService in an InvalidationStateTracker to allow SyncNotifiers -// to use PrefService as persistence for invalidation state. It is not thread -// safe, and lives on the UI thread. class InvalidatorStorage : public syncer::InvalidationStateTracker { public: - // |pref_service| may not be NULL and must outlive |this|. - explicit InvalidatorStorage(PrefService* pref_service); - virtual ~InvalidatorStorage(); - - // Register prefs to be used by per-Profile instances of this class which - // store invalidation state in Profile prefs. static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); - // Register prefs to be used by a device-global instance of this class which - // stores invalidation state in local state. This is used on Chrome OS only. - static void RegisterPrefs(PrefRegistrySimple* registry); + // |pref_service| may not be NULL. Does not own |pref_service|. + explicit InvalidatorStorage(PrefService* pref_service); + virtual ~InvalidatorStorage(); // InvalidationStateTracker implementation. virtual void ClearAndSetNewClientId(const std::string& client_id) OVERRIDE; @@ -48,6 +48,25 @@ class InvalidatorStorage : public syncer::InvalidationStateTracker { virtual void Clear() OVERRIDE; private: + FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, SerializeEmptyMap); + FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, + DeserializeFromListOutOfRange); + FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, + DeserializeFromListInvalidFormat); + FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, + DeserializeFromListWithDuplicates); + FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, + DeserializeFromEmptyList); + FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, DeserializeFromListBasic); + FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, + DeserializeFromListMissingOptionalValues); + FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, DeserializeMapOutOfRange); + FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, DeserializeMapInvalidFormat); + FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, + DeserializeMapEmptyDictionary); + FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, DeserializeMapBasic); + FRIEND_TEST_ALL_PREFIXES(InvalidatorStorageTest, MigrateLegacyPreferences); + base::ThreadChecker thread_checker_; PrefService* const pref_service_; |