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

Unified Diff: components/data_reduction_proxy/core/browser/data_reduction_proxy_statistics_prefs.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
« no previous file with comments | « components/data_reduction_proxy/core/browser/data_reduction_proxy_statistics_prefs.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 93d23208247b5439f56862ef6c273b42c8a54a3b..1b28d5d7143431b346983af40e954d722b8eca85 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
@@ -33,12 +33,8 @@ DataReductionProxyStatisticsPrefs::DataReductionProxyStatisticsPrefs(
}
DataReductionProxyStatisticsPrefs::~DataReductionProxyStatisticsPrefs() {
- // This object is created on UI thread, but destroyed on IO thread. So no
- // DCHECK on thread_checker_ here.
-}
-
-void DataReductionProxyStatisticsPrefs::ShutdownOnUIThread() {
DCHECK(thread_checker_.CalledOnValidThread());
+ WritePrefs();
pref_change_registrar_->RemoveAll();
weak_factory_.InvalidateWeakPtrs();
}
@@ -77,7 +73,7 @@ void DataReductionProxyStatisticsPrefs::Init() {
pref_change_registrar_->Init(pref_service_);
pref_change_registrar_->Add(prefs::kUpdateDailyReceivedContentLengths,
base::Bind(&DataReductionProxyStatisticsPrefs::OnUpdateContentLengths,
- weak_factory_.GetWeakPtr()));
+ GetWeakPtr()));
}
void DataReductionProxyStatisticsPrefs::OnUpdateContentLengths() {
@@ -155,7 +151,7 @@ void DataReductionProxyStatisticsPrefs::DelayedWritePrefs() {
task_runner_->PostDelayedTask(
FROM_HERE,
base::Bind(&DataReductionProxyStatisticsPrefs::WritePrefs,
- weak_factory_.GetWeakPtr()),
+ GetWeakPtr()),
delay_);
delayed_task_posted_ = true;
@@ -186,4 +182,9 @@ int64 DataReductionProxyStatisticsPrefs::GetListPrefInt64Value(
return value;
}
+base::WeakPtr<DataReductionProxyStatisticsPrefs>
+DataReductionProxyStatisticsPrefs::GetWeakPtr() {
+ return weak_factory_.GetWeakPtr();
+}
+
} // namespace data_reduction_proxy
« no previous file with comments | « components/data_reduction_proxy/core/browser/data_reduction_proxy_statistics_prefs.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698