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

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

Issue 226093005: Reduce unneeded policy fetches by detecting expired invalidations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 8 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.h
diff --git a/chrome/browser/policy/cloud/cloud_policy_invalidator.h b/chrome/browser/policy/cloud/cloud_policy_invalidator.h
index c9d99d198d914481f60921ca020ab8d74283ae7f..3a8745bf7a57da59a575ba9e81260078fb3601c9 100644
--- a/chrome/browser/policy/cloud/cloud_policy_invalidator.h
+++ b/chrome/browser/policy/cloud/cloud_policy_invalidator.h
@@ -48,6 +48,14 @@ class CloudPolicyInvalidator : public syncer::InvalidationHandler,
// once the invalidation service starts up.
static const int kInvalidationGracePeriod;
+ // Time, in seconds, for which unknown version invalidations are ignored after
+ // fetching a policy.
+ static const int kUnknownVersionIgnorePeriod;
+
+ // The max tolerated discrepancy, in seconds, between policy timestamps and
+ // invalidation timestamps when determining if an invalidation is expired.
+ static const int kMaxInvalidationTimeDelta;
+
// |core| is the cloud policy core which connects the various policy objects.
// It must remain valid until Shutdown is called.
// |task_runner| is used for scheduling delayed tasks. It must post tasks to
@@ -124,10 +132,18 @@ class CloudPolicyInvalidator : public syncer::InvalidationHandler,
// previous call.
bool IsPolicyChanged(const enterprise_management::PolicyData* policy);
+ // Determine if an invalidation has expired.
+ // |version| is the version of the invalidation, or zero for unknown.
+ bool IsInvalidationExpired(int64 version);
+
// Get the kMetricPolicyRefresh histogram metric which should be incremented
// when a policy is stored.
int GetPolicyRefreshMetric(bool policy_changed);
+ // Get the kMetricPolicyInvalidations histogram metric which should be
+ // incremented when an invalidation is received.
+ int GetInvalidationMetric(bool is_missing_payload, bool is_expired);
+
// Determine if invalidations have been enabled longer than the grace period.
bool GetInvalidationsEnabled();
« no previous file with comments | « chrome/browser/policy/cloud/cloud_policy_browsertest.cc ('k') | chrome/browser/policy/cloud/cloud_policy_invalidator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698