Chromium Code Reviews| 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..e9bfc1235f3f0d04f09970093f83b76beaa5bba2 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,7 @@ DataReductionProxyStatisticsPrefs::DataReductionProxyStatisticsPrefs( |
| } |
| DataReductionProxyStatisticsPrefs::~DataReductionProxyStatisticsPrefs() { |
| - // This object is created on UI thread, but destroyed on IO thread. So no |
| - // DCHECK on thread_checker_ here. |
| + DCHECK(thread_checker_.CalledOnValidThread()); |
| } |
| void DataReductionProxyStatisticsPrefs::ShutdownOnUIThread() { |
|
bengr
2015/02/04 23:39:11
Since this will destroyed on the UI thread, can't
megjablon
2015/02/06 23:40:42
Done.
|
| @@ -77,7 +76,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() { |
| @@ -129,6 +128,7 @@ base::ListValue* DataReductionProxyStatisticsPrefs::GetList( |
| } |
| void DataReductionProxyStatisticsPrefs::WritePrefs() { |
| + LOG(WARNING) << "Starting write prefs"; |
|
bengr
2015/02/04 23:39:11
Remove.
megjablon
2015/02/06 23:40:42
Done.
|
| DCHECK(thread_checker_.CalledOnValidThread()); |
| if (delay_ == base::TimeDelta()) |
| return; |
| @@ -145,6 +145,7 @@ void DataReductionProxyStatisticsPrefs::WritePrefs() { |
| } |
| delayed_task_posted_ = false; |
| + LOG(WARNING) << "Finished write prefs"; |
|
bengr
2015/02/04 23:39:11
Remove.
megjablon
2015/02/06 23:40:42
Done.
|
| } |
| void DataReductionProxyStatisticsPrefs::DelayedWritePrefs() { |
| @@ -155,7 +156,7 @@ void DataReductionProxyStatisticsPrefs::DelayedWritePrefs() { |
| task_runner_->PostDelayedTask( |
| FROM_HERE, |
| base::Bind(&DataReductionProxyStatisticsPrefs::WritePrefs, |
| - weak_factory_.GetWeakPtr()), |
| + GetWeakPtr()), |
| delay_); |
| delayed_task_posted_ = true; |
| @@ -186,4 +187,9 @@ int64 DataReductionProxyStatisticsPrefs::GetListPrefInt64Value( |
| return value; |
| } |
| +base::WeakPtr<DataReductionProxyStatisticsPrefs> |
| +DataReductionProxyStatisticsPrefs::GetWeakPtr() { |
| + return weak_factory_.GetWeakPtr(); |
| +} |
| + |
| } // namespace data_reduction_proxy |