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 #include "chrome/browser/android/data_usage/external_data_use_observer.h" | 5 #include "chrome/browser/android/data_usage/external_data_use_observer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 NOTIMPLEMENTED() | 127 NOTIMPLEMENTED() |
128 << " ExternalDataUseObserverBridge was not deleted successfully"; | 128 << " ExternalDataUseObserverBridge was not deleted successfully"; |
129 } | 129 } |
130 } | 130 } |
131 | 131 |
132 void ExternalDataUseObserver::OnDataUse(const data_usage::DataUse& data_use) { | 132 void ExternalDataUseObserver::OnDataUse(const data_usage::DataUse& data_use) { |
133 DCHECK(thread_checker_.CalledOnValidThread()); | 133 DCHECK(thread_checker_.CalledOnValidThread()); |
134 DCHECK(registered_as_data_use_observer_); | 134 DCHECK(registered_as_data_use_observer_); |
135 | 135 |
136 if (!data_use_list_) { | 136 if (!data_use_list_) { |
137 data_use_list_.reset(new std::deque<const data_usage::DataUse>()); | 137 data_use_list_.reset(new std::vector<const data_usage::DataUse>()); |
138 // Post a task to the same IO thread, that will get invoked when some of the | 138 // Post a task to the same IO thread, that will get invoked when some of the |
139 // data use objects are batched. | 139 // data use objects are batched. |
140 io_task_runner_->PostTask( | 140 io_task_runner_->PostTask( |
141 FROM_HERE, base::Bind(&ExternalDataUseObserver::OnDataUseBatchComplete, | 141 FROM_HERE, base::Bind(&ExternalDataUseObserver::OnDataUseBatchComplete, |
142 GetWeakPtr())); | 142 GetWeakPtr())); |
143 } | 143 } |
144 | 144 |
145 data_use_list_->push_back(data_use); | 145 data_use_list_->push_back(data_use); |
146 } | 146 } |
147 | 147 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 } | 213 } |
214 | 214 |
215 DataUseTabModel* ExternalDataUseObserver::GetDataUseTabModel() const { | 215 DataUseTabModel* ExternalDataUseObserver::GetDataUseTabModel() const { |
216 DCHECK(thread_checker_.CalledOnValidThread()); | 216 DCHECK(thread_checker_.CalledOnValidThread()); |
217 return data_use_tab_model_; | 217 return data_use_tab_model_; |
218 } | 218 } |
219 | 219 |
220 } // namespace android | 220 } // namespace android |
221 | 221 |
222 } // namespace chrome | 222 } // namespace chrome |
OLD | NEW |