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

Side by Side Diff: components/data_usage/core/data_use_aggregator.h

Issue 1393073002: Add external data use observer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@datause_accounting_scliitle_cl_do_not_edit_2
Patch Set: Updated 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 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 #ifndef COMPONENTS_DATA_USAGE_CORE_DATA_USE_AGGREGATOR_H_ 5 #ifndef COMPONENTS_DATA_USAGE_CORE_DATA_USE_AGGREGATOR_H_
6 #define COMPONENTS_DATA_USAGE_CORE_DATA_USE_AGGREGATOR_H_ 6 #define COMPONENTS_DATA_USAGE_CORE_DATA_USE_AGGREGATOR_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <vector> 10 #include <vector>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 int64_t tx_bytes, 43 int64_t tx_bytes,
44 int64_t rx_bytes); 44 int64_t rx_bytes);
45 45
46 // Account for off-the-record data use. This usage is only kept track of here 46 // Account for off-the-record data use. This usage is only kept track of here
47 // so that it can be taken out of any amortized data usage calculations, and a 47 // so that it can be taken out of any amortized data usage calculations, and a
48 // per-request breakdown of off-the-record data usage will never leave the 48 // per-request breakdown of off-the-record data usage will never leave the
49 // DataUseAggregator. 49 // DataUseAggregator.
50 // Virtual for testing. 50 // Virtual for testing.
51 virtual void ReportOffTheRecordDataUse(int64_t tx_bytes, int64_t rx_bytes); 51 virtual void ReportOffTheRecordDataUse(int64_t tx_bytes, int64_t rx_bytes);
52 52
53 // Passes the ownership of an external observer to DataUseAggregator.
54 void PassExternalObserver(scoped_ptr<Observer> external_observer);
55
53 private: 56 private:
54 void NotifyDataUse(const std::vector<DataUse>& data_use_sequence); 57 void NotifyDataUse(const std::vector<DataUse>& data_use_sequence);
55 58
56 base::ThreadChecker thread_checker_; 59 base::ThreadChecker thread_checker_;
57 base::ObserverList<Observer> observer_list_; 60 base::ObserverList<Observer> observer_list_;
58 61
62 // An observer which is external to Chromium.
63 scoped_ptr<Observer> external_observer_;
sclittle 2015/10/09 22:59:28 Making the DataUseAggregator own one of its observ
tbansal1 2015/10/12 16:47:36 changed the owner to IO thread globals.
64
59 DISALLOW_COPY_AND_ASSIGN(DataUseAggregator); 65 DISALLOW_COPY_AND_ASSIGN(DataUseAggregator);
60 }; 66 };
61 67
62 } // namespace data_usage 68 } // namespace data_usage
63 69
64 #endif // COMPONENTS_DATA_USAGE_CORE_DATA_USE_AGGREGATOR_H_ 70 #endif // COMPONENTS_DATA_USAGE_CORE_DATA_USE_AGGREGATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698