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

Side by Side Diff: components/data_usage/core/data_use.cc

Issue 1390993005: Amortize data usage using TrafficStats on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@data_use_buffering
Patch Set: Simplified and polished design, still ironing out tests Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
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 "components/data_usage/core/data_use.h" 5 #include "components/data_usage/core/data_use.h"
6 6
7 namespace data_usage { 7 namespace data_usage {
8 8
9 namespace { 9 namespace {
10 10
(...skipping 18 matching lines...) Expand all
29 const std::string& mcc_mnc, 29 const std::string& mcc_mnc,
30 int64_t tx_bytes, 30 int64_t tx_bytes,
31 int64_t rx_bytes) 31 int64_t rx_bytes)
32 : url(url), 32 : url(url),
33 request_start(request_start), 33 request_start(request_start),
34 first_party_for_cookies(first_party_for_cookies), 34 first_party_for_cookies(first_party_for_cookies),
35 tab_id(tab_id), 35 tab_id(tab_id),
36 connection_type(connection_type), 36 connection_type(connection_type),
37 mcc_mnc(mcc_mnc), 37 mcc_mnc(mcc_mnc),
38 tx_bytes(tx_bytes), 38 tx_bytes(tx_bytes),
39 rx_bytes(rx_bytes) {} 39 rx_bytes(rx_bytes),
40 before_tx_bytes(tx_bytes),
41 before_rx_bytes(rx_bytes),
42 created_ticks(base::TimeTicks::Now()) {}
40 43
41 DataUse::~DataUse() {} 44 DataUse::~DataUse() {}
42 45
43 bool DataUse::operator==(const DataUse& other) const { 46 bool DataUse::operator==(const DataUse& other) const {
44 return AreNonByteCountFieldsEqual(*this, other) && 47 return AreNonByteCountFieldsEqual(*this, other) &&
45 AreByteCountFieldsEqual(*this, other); 48 AreByteCountFieldsEqual(*this, other);
46 } 49 }
47 50
48 bool DataUse::CanCombineWith(const DataUse& other) const { 51 bool DataUse::CanCombineWith(const DataUse& other) const {
49 return AreNonByteCountFieldsEqual(*this, other); 52 return AreNonByteCountFieldsEqual(*this, other);
50 } 53 }
51 54
52 } // namespace data_usage 55 } // namespace data_usage
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698