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

Unified Diff: chrome/browser/policy/cloud/cloud_policy_invalidator.cc

Issue 460573005: Pass highest handled invalidation version between invalidators (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code and tests done. Ready for review. Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/cloud/cloud_policy_invalidator.cc
diff --git a/chrome/browser/policy/cloud/cloud_policy_invalidator.cc b/chrome/browser/policy/cloud/cloud_policy_invalidator.cc
index ee83bbec10818a9ff1394a64093f5545bc254fa5..ffa38d45e50216f6b5f0fe4f13dfdee6f6abde30 100644
--- a/chrome/browser/policy/cloud/cloud_policy_invalidator.cc
+++ b/chrome/browser/policy/cloud/cloud_policy_invalidator.cc
@@ -34,7 +34,8 @@ CloudPolicyInvalidator::CloudPolicyInvalidator(
enterprise_management::DeviceRegisterRequest::Type type,
CloudPolicyCore* core,
const scoped_refptr<base::SequencedTaskRunner>& task_runner,
- scoped_ptr<base::Clock> clock)
+ scoped_ptr<base::Clock> clock,
+ int64 highest_handled_invalidation_version)
: state_(UNINITIALIZED),
type_(type),
core_(core),
@@ -47,6 +48,8 @@ CloudPolicyInvalidator::CloudPolicyInvalidator(
invalid_(false),
invalidation_version_(0),
unknown_version_invalidation_count_(0),
+ highest_handled_invalidation_version_(
+ highest_handled_invalidation_version),
weak_factory_(this),
max_fetch_delay_(kMaxFetchDelayDefault),
policy_hash_value_(0) {
@@ -154,10 +157,16 @@ void CloudPolicyInvalidator::OnStoreLoaded(CloudPolicyStore* store) {
METRIC_POLICY_REFRESH_SIZE);
}
+ const int64 store_invalidation_version = store->invalidation_version();
+
// If the policy was invalid and the version stored matches the latest
// invalidation version, acknowledge the latest invalidation.
- if (invalid_ && store->invalidation_version() == invalidation_version_)
+ if (invalid_ && store_invalidation_version == invalidation_version_)
AcknowledgeInvalidation();
+
+ // Update the highest invalidation version that was handled already.
+ if (store_invalidation_version > highest_handled_invalidation_version_)
+ highest_handled_invalidation_version_ = store_invalidation_version;
}
UpdateRegistration(store->policy());
@@ -175,6 +184,14 @@ void CloudPolicyInvalidator::HandleInvalidation(
return;
}
+ if (!invalidation.is_unknown_version() &&
+ invalidation.version() <= highest_handled_invalidation_version_) {
+ // If this invalidation version was handled already, acknowledge the
+ // invalidation but ignore it otherwise.
+ invalidation.Acknowledge();
+ return;
+ }
+
// If there is still a pending invalidation, acknowledge it, since we only
// care about the latest invalidation.
if (invalid_)

Powered by Google App Engine
This is Rietveld 408576698