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

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

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: Fixed external_data_use_observer test 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/data_usage/core/data_use.cc ('k') | components/data_usage/core/data_use_aggregator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/data_usage/core/data_use_aggregator.h
diff --git a/components/data_usage/core/data_use_aggregator.h b/components/data_usage/core/data_use_aggregator.h
index b10f945950bc38a554470f614d5464055cdfccd5..36d8ef09016c01c11fa1e8f58ae2af1b21cd7f50 100644
--- a/components/data_usage/core/data_use_aggregator.h
+++ b/components/data_usage/core/data_use_aggregator.h
@@ -11,6 +11,7 @@
#include <vector>
#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
@@ -22,6 +23,8 @@ class URLRequest;
}
namespace data_usage {
+
+class DataUseAnnotator;
struct DataUse;
// Class that collects and aggregates network usage, reporting the usage to
@@ -38,15 +41,16 @@ class DataUseAggregator
const std::vector<const DataUse*>& data_use_sequence) = 0;
};
- DataUseAggregator();
+ // Constructs a new DataUseAggregator with the given |annotator|. A NULL
+ // annotator will be treated as a no-op annotator.
+ explicit DataUseAggregator(scoped_ptr<DataUseAnnotator> annotator);
~DataUseAggregator() override;
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
// Virtual for testing.
- virtual void ReportDataUse(const net::URLRequest& request,
- int32_t tab_id,
+ virtual void ReportDataUse(net::URLRequest* request,
int64_t tx_bytes,
int64_t rx_bytes);
@@ -69,10 +73,15 @@ class DataUseAggregator
void SetMccMncForTests(const std::string& mcc_mnc);
private:
+ // Appends |data_use| to the buffer of unreported data use and prepares to
+ // notify observers.
+ void AppendDataUse(scoped_ptr<DataUse> data_use);
+
// Flush any buffered data use and notify observers.
void FlushBufferedDataUse();
base::ThreadChecker thread_checker_;
+ scoped_ptr<DataUseAnnotator> annotator_;
base::ObserverList<Observer> observer_list_;
// Buffer of unreported data use.
« no previous file with comments | « components/data_usage/core/data_use.cc ('k') | components/data_usage/core/data_use_aggregator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698