| Index: components/data_usage/core/data_use_aggregator.cc
|
| diff --git a/components/data_usage/core/data_use_aggregator.cc b/components/data_usage/core/data_use_aggregator.cc
|
| index 126bf0131e5a342ca2cac54f023df18ff9ca704f..183246868627b346fdd4a02237e2f88e3344f680 100644
|
| --- a/components/data_usage/core/data_use_aggregator.cc
|
| +++ b/components/data_usage/core/data_use_aggregator.cc
|
| @@ -4,6 +4,9 @@
|
|
|
| #include "components/data_usage/core/data_use_aggregator.h"
|
|
|
| +#include <sstream>
|
| +#include <string>
|
| +
|
| #include "base/bind.h"
|
| #include "base/message_loop/message_loop.h"
|
| #include "net/base/network_change_notifier.h"
|
| @@ -11,8 +14,10 @@
|
|
|
| namespace data_usage {
|
|
|
| -DataUseAggregator::DataUseAggregator()
|
| - : off_the_record_tx_bytes_since_last_flush_(0),
|
| +DataUseAggregator::DataUseAggregator(
|
| + scoped_ptr<DataUseAmortizer> data_use_amortizer)
|
| + : data_use_amortizer_(data_use_amortizer.Pass()),
|
| + off_the_record_tx_bytes_since_last_flush_(0),
|
| off_the_record_rx_bytes_since_last_flush_(0),
|
| is_flush_pending_(false),
|
| weak_ptr_factory_(this) {}
|
| @@ -82,7 +87,11 @@ base::WeakPtr<DataUseAggregator> DataUseAggregator::GetWeakPtr() {
|
| void DataUseAggregator::FlushBufferedDataUse() {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
|
|
| - // TODO(sclittle): Amortize data use on supported platforms.
|
| + if (data_use_amortizer_) {
|
| + data_use_amortizer_->Amortize(&buffered_data_use_,
|
| + off_the_record_tx_bytes_since_last_flush_,
|
| + off_the_record_rx_bytes_since_last_flush_);
|
| + }
|
|
|
| FOR_EACH_OBSERVER(Observer, observer_list_, OnDataUse(buffered_data_use_));
|
|
|
|
|