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

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: tweaks 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
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..636562754f972d6108f490ac7924745a07acc5ee 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();
Mattias Nissler (ping if slow) 2010/12/21 16:42:24 I'm not so sure whether we really want all this re
danno 2010/12/22 11:02:17 Right, the reasons are different, but the underlyi
private:
friend class AsynchronousPolicyLoaderTest;
+ // Finishes loader finitialization after the threading system has been fully
Mattias Nissler (ping if slow) 2010/12/22 08:45:53 s/finitialization/initialization/
danno 2010/12/22 11:02:17 Done.
+ // 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 that a policy reload will be triggered as a fallback.
Mattias Nissler (ping if slow) 2010/12/22 08:45:53 s/that/at which/?
danno 2010/12/22 11:02:17 Done.
+ 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);
};

Powered by Google App Engine
This is Rietveld 408576698