Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Unified Diff: components/data_usage/core/data_use_aggregator.cc

Issue 1421983002: Include tab IDs when reporting data use accounting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@data_use_scoped_vector
Patch Set: Polished and added some tests Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 6c6304a5e0cf786f24ac30d7536ef0ef0f0078bf..d1160e1ea7223bc3de6144efa160b96919f7ae7c 100644
--- a/components/data_usage/core/data_use_aggregator.cc
+++ b/components/data_usage/core/data_use_aggregator.cc
@@ -12,7 +12,6 @@
#include "components/data_usage/core/data_use.h"
#include "net/base/load_timing_info.h"
#include "net/base/network_change_notifier.h"
-#include "net/url_request/url_request.h"
namespace data_usage {
@@ -34,17 +33,16 @@ void DataUseAggregator::RemoveObserver(Observer* observer) {
observer_list_.RemoveObserver(observer);
}
-void DataUseAggregator::ReportDataUse(const net::URLRequest& request,
- int32_t tab_id,
- int64_t tx_bytes,
- int64_t rx_bytes) {
+void DataUseAggregator::ReportDataUse(int64_t tx_bytes,
+ int64_t rx_bytes,
+ const GURL& url,
+ const base::TimeTicks& request_start,
+ const GURL& first_party_for_cookies,
+ int32_t tab_id) {
DCHECK(thread_checker_.CalledOnValidThread());
- net::LoadTimingInfo load_timing_info;
- request.GetLoadTimingInfo(&load_timing_info);
scoped_ptr<DataUse> data_use(new DataUse(
- request.url(), load_timing_info.request_start,
- request.first_party_for_cookies(), tab_id,
+ url, request_start, first_party_for_cookies, tab_id,
net::NetworkChangeNotifier::GetConnectionType(), tx_bytes, rx_bytes));
// As an optimization, attempt to combine the newly reported data use with the
@@ -52,8 +50,8 @@ void DataUseAggregator::ReportDataUse(const net::URLRequest& request,
// same.
if (!buffered_data_use_.empty() &&
buffered_data_use_.back()->CanCombineWith(*data_use)) {
- buffered_data_use_.back()->tx_bytes += tx_bytes;
- buffered_data_use_.back()->rx_bytes += rx_bytes;
+ buffered_data_use_.back()->tx_bytes += data_use->tx_bytes;
+ buffered_data_use_.back()->rx_bytes += data_use->rx_bytes;
} else {
buffered_data_use_.push_back(data_use.Pass());
}

Powered by Google App Engine
This is Rietveld 408576698