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

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

Issue 893003002: Data Reduction Proxy class ownership updates and Settings cleanup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sgurun CR comments Created 5 years, 10 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_network_delegate.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc
index 9df2ef56b1479dc61816bad84b977571ced96f2e..1db88528f1b7e91956d385ed5238fee1f2163fbd 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_network_delegate.cc
@@ -12,7 +12,9 @@
#include "base/strings/string_number_conversions.h"
#include "base/time/time.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_configurator.h"
+#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_io_data.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_request_options.h"
+#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_service.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_statistics_prefs.h"
#include "components/data_reduction_proxy/core/browser/data_reduction_proxy_usage_stats.h"
#include "net/base/load_flags.h"
@@ -93,15 +95,15 @@ DataReductionProxyNetworkDelegate::DataReductionProxyNetworkDelegate(
DataReductionProxyNetworkDelegate::~DataReductionProxyNetworkDelegate() {
}
-void DataReductionProxyNetworkDelegate::InitStatisticsPrefsAndUMA(
+void DataReductionProxyNetworkDelegate::InitIODataAndUMA(
scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner,
- const base::WeakPtr<DataReductionProxyStatisticsPrefs>& statistics_prefs,
+ DataReductionProxyIOData* io_data,
BooleanPrefMember* data_reduction_proxy_enabled,
DataReductionProxyUsageStats* usage_stats) {
DCHECK(data_reduction_proxy_enabled);
DCHECK(usage_stats);
ui_task_runner_ = ui_task_runner;
- data_reduction_proxy_statistics_prefs_ = statistics_prefs;
+ data_reduction_proxy_io_data_ = io_data;
data_reduction_proxy_enabled_ = data_reduction_proxy_enabled;
data_reduction_proxy_usage_stats_ = usage_stats;
}
@@ -251,17 +253,20 @@ void DataReductionProxyNetworkDelegate::UpdateContentLengthPrefs(
int original_content_length,
bool data_reduction_proxy_enabled,
DataReductionProxyRequestType request_type) {
- if (data_reduction_proxy_statistics_prefs_) {
- int64 total_received = data_reduction_proxy_statistics_prefs_->GetInt64(
+ if (data_reduction_proxy_io_data_ &&
+ data_reduction_proxy_io_data_->service()) {
+ DataReductionProxyStatisticsPrefs* data_reduction_proxy_statistics_prefs =
+ data_reduction_proxy_io_data_->service()->statistics_prefs();
+ int64 total_received = data_reduction_proxy_statistics_prefs->GetInt64(
data_reduction_proxy::prefs::kHttpReceivedContentLength);
- int64 total_original = data_reduction_proxy_statistics_prefs_->GetInt64(
+ int64 total_original = data_reduction_proxy_statistics_prefs->GetInt64(
data_reduction_proxy::prefs::kHttpOriginalContentLength);
total_received += received_content_length;
total_original += original_content_length;
- data_reduction_proxy_statistics_prefs_->SetInt64(
+ data_reduction_proxy_statistics_prefs->SetInt64(
data_reduction_proxy::prefs::kHttpReceivedContentLength,
total_received);
- data_reduction_proxy_statistics_prefs_->SetInt64(
+ data_reduction_proxy_statistics_prefs->SetInt64(
data_reduction_proxy::prefs::kHttpOriginalContentLength,
total_original);
@@ -271,7 +276,7 @@ void DataReductionProxyNetworkDelegate::UpdateContentLengthPrefs(
data_reduction_proxy_enabled,
request_type,
base::Time::Now(),
- data_reduction_proxy_statistics_prefs_.get());
+ data_reduction_proxy_statistics_prefs);
}
}

Powered by Google App Engine
This is Rietveld 408576698