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 16 matching lines...) Expand all Loading... |
27 // lifetime. | 27 // lifetime. |
28 // | 28 // |
29 // All methods are invoked on the background |task_runner_|, including the | 29 // All methods are invoked on the background |task_runner_|, including the |
30 // destructor. The only exceptions are the constructor (which may be called on | 30 // destructor. The only exceptions are the constructor (which may be called on |
31 // any thread), and the initial Load() which is called on the thread that owns | 31 // any thread), and the initial Load() which is called on the thread that owns |
32 // the provider. | 32 // the provider. |
33 // LastModificationTime() is also invoked once on that thread at startup. | 33 // LastModificationTime() is also invoked once on that thread at startup. |
34 class POLICY_EXPORT AsyncPolicyLoader { | 34 class POLICY_EXPORT AsyncPolicyLoader { |
35 public: | 35 public: |
36 explicit AsyncPolicyLoader( | 36 explicit AsyncPolicyLoader( |
37 scoped_refptr<base::SequencedTaskRunner> task_runner); | 37 const scoped_refptr<base::SequencedTaskRunner>& task_runner); |
38 virtual ~AsyncPolicyLoader(); | 38 virtual ~AsyncPolicyLoader(); |
39 | 39 |
40 // Gets a SequencedTaskRunner backed by the background thread. | 40 // Gets a SequencedTaskRunner backed by the background thread. |
41 base::SequencedTaskRunner* task_runner() const { return task_runner_.get(); } | 41 base::SequencedTaskRunner* task_runner() const { return task_runner_.get(); } |
42 | 42 |
43 // Returns the currently configured policies. Load() is always invoked on | 43 // Returns the currently configured policies. Load() is always invoked on |
44 // the background thread, except for the initial Load() at startup which is | 44 // the background thread, except for the initial Load() at startup which is |
45 // invoked from the thread that owns the provider. | 45 // invoked from the thread that owns the provider. |
46 virtual scoped_ptr<PolicyBundle> Load() = 0; | 46 virtual scoped_ptr<PolicyBundle> Load() = 0; |
47 | 47 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 // Used to get WeakPtrs for the periodic reload task. | 114 // Used to get WeakPtrs for the periodic reload task. |
115 base::WeakPtrFactory<AsyncPolicyLoader> weak_factory_; | 115 base::WeakPtrFactory<AsyncPolicyLoader> weak_factory_; |
116 | 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 |