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

Unified Diff: chrome/browser/policy/asynchronous_policy_loader.h

Issue 6091002: Refactor the windows policy provider to use AsynchronousPolicyProvider. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix windows tests Created 10 years 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/asynchronous_policy_loader.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/asynchronous_policy_loader.h
diff --git a/chrome/browser/policy/asynchronous_policy_loader.h b/chrome/browser/policy/asynchronous_policy_loader.h
index d88cdff53c48d352404eeafd7c71c57b637d4a71..8a5838f9d05e77082dcc027436d5ebb404496d41 100644
--- a/chrome/browser/policy/asynchronous_policy_loader.h
+++ b/chrome/browser/policy/asynchronous_policy_loader.h
@@ -21,7 +21,8 @@ class AsynchronousPolicyLoader
: public base::RefCountedThreadSafe<AsynchronousPolicyLoader> {
public:
explicit AsynchronousPolicyLoader(
- AsynchronousPolicyProvider::Delegate* delegate);
+ AsynchronousPolicyProvider::Delegate* delegate,
+ int reload_interval_minutes);
// Triggers initial policy load.
virtual void Init();
@@ -55,13 +56,32 @@ class AsynchronousPolicyLoader
return delegate_.get();
}
- AsynchronousPolicyProvider* provider() {
- return provider_;
- }
+ // Performs start operations that must be performed on the file thread.
+ virtual void InitOnFileThread();
+
+ // Performs stop operations that must be performed on the file thread.
+ virtual void StopOnFileThread();
+
+ // Schedules a reload task to run when |delay| expires. Must be called on the
+ // file thread.
+ void ScheduleReloadTask(const base::TimeDelta& delay);
+
+ // Schedules a reload task to run after the number of minutes specified
+ // in |reload_interval_minutes_|. Must be called on the file thread.
+ void ScheduleFallbackReloadTask();
+
+ void CancelReloadTask();
+
+ // Invoked from the reload task on the file thread.
+ void ReloadFromTask();
private:
friend class AsynchronousPolicyLoaderTest;
+ // Finishes loader initialization after the threading system has been fully
+ // intialized.
+ void InitAfterFileThreadAvailable();
+
// Replaces the existing policy to value map with a new one, sending
// notification to the provider if there is a policy change. Must be called on
// |origin_loop_| so that it's safe to call back into the provider, which is
@@ -78,11 +98,21 @@ class AsynchronousPolicyLoader
// called the constructor. See |origin_loop_| below.
AsynchronousPolicyProvider* provider_;
+ // The reload task. Access only on the file thread. Holds a reference to the
+ // currently posted task, so we can cancel and repost it if necessary.
+ CancelableTask* reload_task_;
+
+ // The interval at which a policy reload will be triggered as a fallback.
+ const base::TimeDelta reload_interval_;
+
// The message loop on which this object was constructed. Recorded so that
// it's possible to call back into the non thread safe provider to fire the
// notification.
MessageLoop* origin_loop_;
+ // True if Stop has been called.
+ bool stopped_;
+
DISALLOW_COPY_AND_ASSIGN(AsynchronousPolicyLoader);
};
« no previous file with comments | « no previous file | chrome/browser/policy/asynchronous_policy_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698