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

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

Issue 213743014: Add an extra delay for policy invalidations to be available. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/policy/cloud/cloud_policy_invalidator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5192277eedaaa530403c5599a54e23f81f1b0e91..c9d99d198d914481f60921ca020ab8d74283ae7f 100644
--- a/chrome/browser/policy/cloud/cloud_policy_invalidator.h
+++ b/chrome/browser/policy/cloud/cloud_policy_invalidator.h
@@ -20,6 +20,7 @@
#include "sync/notifier/invalidation_handler.h"
namespace base {
+class Clock;
class SequencedTaskRunner;
}
@@ -43,13 +44,19 @@ class CloudPolicyInvalidator : public syncer::InvalidationHandler,
static const int kMaxFetchDelayMin;
static const int kMaxFetchDelayMax;
+ // The grace period, in seconds, to allow for invalidations to be received
+ // once the invalidation service starts up.
+ static const int kInvalidationGracePeriod;
+
// |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
// the main policy thread.
+ // |clock| is used to get the current time.
CloudPolicyInvalidator(
CloudPolicyCore* core,
- const scoped_refptr<base::SequencedTaskRunner>& task_runner);
+ const scoped_refptr<base::SequencedTaskRunner>& task_runner,
+ scoped_ptr<base::Clock> clock);
virtual ~CloudPolicyInvalidator();
// Initializes the invalidator. No invalidations will be generated before this
@@ -92,7 +99,7 @@ class CloudPolicyInvalidator : public syncer::InvalidationHandler,
void UpdateRegistration(const enterprise_management::PolicyData* policy);
// Registers the given object with the invalidation service.
- void Register(int64 timestamp, const invalidation::ObjectId& object_id);
+ void Register(const invalidation::ObjectId& object_id);
// Unregisters the current object with the invalidation service.
void Unregister();
@@ -121,6 +128,9 @@ class CloudPolicyInvalidator : public syncer::InvalidationHandler,
// when a policy is stored.
int GetPolicyRefreshMetric(bool policy_changed);
+ // Determine if invalidations have been enabled longer than the grace period.
+ bool GetInvalidationsEnabled();
+
// The state of the object.
enum State {
UNINITIALIZED,
@@ -136,6 +146,9 @@ class CloudPolicyInvalidator : public syncer::InvalidationHandler,
// Schedules delayed tasks.
const scoped_refptr<base::SequencedTaskRunner> task_runner_;
+ // The clock.
+ scoped_ptr<base::Clock> clock_;
+
// The invalidation service.
invalidation::InvalidationService* invalidation_service_;
@@ -144,12 +157,14 @@ class CloudPolicyInvalidator : public syncer::InvalidationHandler,
// has registered for a policy object.
bool invalidations_enabled_;
+ // The time that invalidations became enabled.
+ base::Time invalidations_enabled_time_;
+
// Whether the invalidation service is currently enabled.
bool invalidation_service_enabled_;
- // The timestamp of the PolicyData at which this object registered for policy
- // invalidations. Set to zero if the object has not registered yet.
- int64 registered_timestamp_;
+ // Whether this object has registered for policy invalidations.
+ bool is_registered_;
// The object id representing the policy in the invalidation service.
invalidation::ObjectId object_id_;
« no previous file with comments | « no previous file | chrome/browser/policy/cloud/cloud_policy_invalidator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698