OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_POLICY_CORE_COMMON_ASYNC_POLICY_LOADER_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_ASYNC_POLICY_LOADER_H_ |
6 #define COMPONENTS_POLICY_CORE_COMMON_ASYNC_POLICY_LOADER_H_ | 6 #define COMPONENTS_POLICY_CORE_COMMON_ASYNC_POLICY_LOADER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // LastModificationTime(). |delay| is updated with a suggested time to wait | 92 // LastModificationTime(). |delay| is updated with a suggested time to wait |
93 // before retrying when this returns false. | 93 // before retrying when this returns false. |
94 bool IsSafeToReload(const base::Time& now, base::TimeDelta* delay); | 94 bool IsSafeToReload(const base::Time& now, base::TimeDelta* delay); |
95 | 95 |
96 // Task runner to run background threads. | 96 // Task runner to run background threads. |
97 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 97 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
98 | 98 |
99 // Callback for updates, passed in Init(). | 99 // Callback for updates, passed in Init(). |
100 UpdateCallback update_callback_; | 100 UpdateCallback update_callback_; |
101 | 101 |
102 // Used to get WeakPtrs for the periodic reload task. | |
103 base::WeakPtrFactory<AsyncPolicyLoader> weak_factory_; | |
104 | |
105 // Records last known modification timestamp. | 102 // Records last known modification timestamp. |
106 base::Time last_modification_time_; | 103 base::Time last_modification_time_; |
107 | 104 |
108 // The wall clock time at which the last modification timestamp was | 105 // The wall clock time at which the last modification timestamp was |
109 // recorded. It's better to not assume the file notification time and the | 106 // recorded. It's better to not assume the file notification time and the |
110 // wall clock times come from the same source, just in case there is some | 107 // wall clock times come from the same source, just in case there is some |
111 // non-local filesystem involved. | 108 // non-local filesystem involved. |
112 base::Time last_modification_clock_; | 109 base::Time last_modification_clock_; |
113 | 110 |
114 // The current policy schemas that this provider should load. | 111 // The current policy schemas that this provider should load. |
115 scoped_refptr<SchemaMap> schema_map_; | 112 scoped_refptr<SchemaMap> schema_map_; |
116 | 113 |
| 114 // Used to get WeakPtrs for the periodic reload task. |
| 115 base::WeakPtrFactory<AsyncPolicyLoader> weak_factory_; |
| 116 |
117 DISALLOW_COPY_AND_ASSIGN(AsyncPolicyLoader); | 117 DISALLOW_COPY_AND_ASSIGN(AsyncPolicyLoader); |
118 }; | 118 }; |
119 | 119 |
120 } // namespace policy | 120 } // namespace policy |
121 | 121 |
122 #endif // COMPONENTS_POLICY_CORE_COMMON_ASYNC_POLICY_LOADER_H_ | 122 #endif // COMPONENTS_POLICY_CORE_COMMON_ASYNC_POLICY_LOADER_H_ |
OLD | NEW |