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

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

Issue 896713003: Revert of DataReductionProxyStatisticsPrefs should support WeakPtr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 1b28d5d7143431b346983af40e954d722b8eca85..93d23208247b5439f56862ef6c273b42c8a54a3b 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,8 +33,12 @@
}
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();
}
@@ -73,7 +77,7 @@
pref_change_registrar_->Init(pref_service_);
pref_change_registrar_->Add(prefs::kUpdateDailyReceivedContentLengths,
base::Bind(&DataReductionProxyStatisticsPrefs::OnUpdateContentLengths,
- GetWeakPtr()));
+ weak_factory_.GetWeakPtr()));
}
void DataReductionProxyStatisticsPrefs::OnUpdateContentLengths() {
@@ -151,7 +155,7 @@
task_runner_->PostDelayedTask(
FROM_HERE,
base::Bind(&DataReductionProxyStatisticsPrefs::WritePrefs,
- GetWeakPtr()),
+ weak_factory_.GetWeakPtr()),
delay_);
delayed_task_posted_ = true;
@@ -182,9 +186,4 @@
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