OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_ |
6 #define CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_ | 6 #define CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_ |
7 | 7 |
8 #include <deque> | |
9 #include <memory> | 8 #include <memory> |
| 9 #include <vector> |
10 | 10 |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "base/threading/thread_checker.h" | 15 #include "base/threading/thread_checker.h" |
16 #include "base/time/time.h" | 16 #include "base/time/time.h" |
17 #include "components/data_usage/core/data_use_aggregator.h" | 17 #include "components/data_usage/core/data_use_aggregator.h" |
18 | 18 |
19 namespace base { | 19 namespace base { |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 // but afterwards, should only be accessed on UI thread. | 109 // but afterwards, should only be accessed on UI thread. |
110 DataUseTabModel* data_use_tab_model_; | 110 DataUseTabModel* data_use_tab_model_; |
111 | 111 |
112 // Labels, buffers and reports the data usage. It is owned by |this|. It is | 112 // Labels, buffers and reports the data usage. It is owned by |this|. It is |
113 // created on IO thread but afterwards, should only be accessed on UI thread. | 113 // created on IO thread but afterwards, should only be accessed on UI thread. |
114 ExternalDataUseReporter* external_data_use_reporter_; | 114 ExternalDataUseReporter* external_data_use_reporter_; |
115 | 115 |
116 // Batches the data use objects reported by DataUseAggregator. This will be | 116 // Batches the data use objects reported by DataUseAggregator. This will be |
117 // created when data use batching starts and released when the batching ends. | 117 // created when data use batching starts and released when the batching ends. |
118 // This will be null if there is no ongoing batching of data use objects. | 118 // This will be null if there is no ongoing batching of data use objects. |
119 std::unique_ptr<std::deque<const data_usage::DataUse>> data_use_list_; | 119 std::unique_ptr<std::vector<const data_usage::DataUse>> data_use_list_; |
120 | 120 |
121 // |io_task_runner_| is used to call methods on IO thread. | 121 // |io_task_runner_| is used to call methods on IO thread. |
122 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 122 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
123 | 123 |
124 // |ui_task_runner_| is used to call methods on UI thread. | 124 // |ui_task_runner_| is used to call methods on UI thread. |
125 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | 125 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
126 | 126 |
127 // Time when the matching rules were last fetched. | 127 // Time when the matching rules were last fetched. |
128 base::TimeTicks last_matching_rules_fetch_time_; | 128 base::TimeTicks last_matching_rules_fetch_time_; |
129 | 129 |
130 // Duration after which matching rules are periodically fetched. | 130 // Duration after which matching rules are periodically fetched. |
131 const base::TimeDelta fetch_matching_rules_duration_; | 131 const base::TimeDelta fetch_matching_rules_duration_; |
132 | 132 |
133 // True if |this| is currently registered as a data use observer. | 133 // True if |this| is currently registered as a data use observer. |
134 bool registered_as_data_use_observer_; | 134 bool registered_as_data_use_observer_; |
135 | 135 |
136 base::ThreadChecker thread_checker_; | 136 base::ThreadChecker thread_checker_; |
137 | 137 |
138 base::WeakPtrFactory<ExternalDataUseObserver> weak_factory_; | 138 base::WeakPtrFactory<ExternalDataUseObserver> weak_factory_; |
139 | 139 |
140 DISALLOW_COPY_AND_ASSIGN(ExternalDataUseObserver); | 140 DISALLOW_COPY_AND_ASSIGN(ExternalDataUseObserver); |
141 }; | 141 }; |
142 | 142 |
143 } // namespace android | 143 } // namespace android |
144 | 144 |
145 } // namespace chrome | 145 } // namespace chrome |
146 | 146 |
147 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_ | 147 #endif // CHROME_BROWSER_ANDROID_DATA_USAGE_EXTERNAL_DATA_USE_OBSERVER_H_ |
OLD | NEW |