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

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

Issue 888713002: DataReductionProxyStatisticsPrefs should support WeakPtr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Webview fix 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_settings.cc
diff --git a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc
index 26fad478e18f7411bbebe146fa19f8d22395c8fa..2dba43560d14529ab3e0a165e33c6e542aeb1e54 100644
--- a/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc
+++ b/components/data_reduction_proxy/core/browser/data_reduction_proxy_settings.cc
@@ -128,14 +128,17 @@ void DataReductionProxySettings::InitPrefMembers() {
void DataReductionProxySettings::InitDataReductionProxySettings(
PrefService* prefs,
+ scoped_ptr<DataReductionProxyStatisticsPrefs> statistics_prefs,
net::URLRequestContextGetter* url_request_context_getter,
net::NetLog* net_log,
DataReductionProxyEventStore* event_store) {
DCHECK(thread_checker_.CalledOnValidThread());
DCHECK(prefs);
+ DCHECK(!statistics_prefs_);
DCHECK(url_request_context_getter);
DCHECK(event_store);
prefs_ = prefs;
+ statistics_prefs_ = statistics_prefs.Pass();
url_request_context_getter_ = url_request_context_getter;
net_log_ = net_log;
event_store_ = event_store;
@@ -151,8 +154,25 @@ void DataReductionProxySettings::InitDataReductionProxySettings(
}
void DataReductionProxySettings::SetDataReductionProxyStatisticsPrefs(
- DataReductionProxyStatisticsPrefs* statistics_prefs) {
- statistics_prefs_ = statistics_prefs;
+ scoped_ptr<DataReductionProxyStatisticsPrefs> statistics_prefs) {
+ statistics_prefs_ = statistics_prefs.Pass();
+}
+
+void DataReductionProxySettings::EnableCompressionStatisticsLogging(
+ PrefService* prefs,
+ scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
+ const base::TimeDelta& commit_delay) {
+ DCHECK(!statistics_prefs_);
+ statistics_prefs_.reset(
+ new DataReductionProxyStatisticsPrefs(
+ prefs, ui_task_runner, commit_delay));
+}
+
+base::WeakPtr<DataReductionProxyStatisticsPrefs>
+DataReductionProxySettings::statistics_prefs() {
+ if (statistics_prefs_)
+ return statistics_prefs_->GetWeakPtr();
+ return base::WeakPtr<DataReductionProxyStatisticsPrefs>();
}
void DataReductionProxySettings::SetOnDataReductionEnabledCallback(

Powered by Google App Engine
This is Rietveld 408576698