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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_statistics_prefs.cc

Issue 989663002: HistoricNetworkStatsInfoToValue should use statistics prefs values (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comments Created 5 years, 9 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_reduction_proxy/core/browser/data_reduction_proxy_statistics_prefs.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_statistics_prefs.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_statistics_prefs.cc
index 1b28d5d7143431b346983af40e954d722b8eca85..57247f600c6724c5ed9268d8fcaecba4436e9788 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_statistics_prefs.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_statistics_prefs.cc
@@ -143,6 +143,23 @@ void DataReductionProxyStatisticsPrefs::WritePrefs() {
delayed_task_posted_ = false;
}
+base::Value*
+DataReductionProxyStatisticsPrefs::HistoricNetworkStatsInfoToValue() {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ int64 total_received = GetInt64(
+ data_reduction_proxy::prefs::kHttpReceivedContentLength);
+ int64 total_original = GetInt64(
+ data_reduction_proxy::prefs::kHttpOriginalContentLength);
+
+ base::DictionaryValue* dict = new base::DictionaryValue();
+ // Use strings to avoid overflow. base::Value only supports 32-bit integers.
+ dict->SetString("historic_received_content_length",
+ base::Int64ToString(total_received));
+ dict->SetString("historic_original_content_length",
+ base::Int64ToString(total_original));
+ return dict;
+}
+
void DataReductionProxyStatisticsPrefs::DelayedWritePrefs() {
// Only write after the first time posting the task.
if (delayed_task_posted_)

Powered by Google App Engine
This is Rietveld 408576698