OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_stat
istics_prefs.h" | 5 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_stat
istics_prefs.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/prefs/pref_change_registrar.h" | 10 #include "base/prefs/pref_change_registrar.h" |
11 #include "base/prefs/pref_service.h" | 11 #include "base/prefs/pref_service.h" |
12 #include "base/prefs/scoped_user_pref_update.h" | 12 #include "base/prefs/scoped_user_pref_update.h" |
13 #include "base/sequenced_task_runner.h" | 13 #include "base/sequenced_task_runner.h" |
14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "base/values.h" | 16 #include "base/values.h" |
17 | 17 |
18 namespace data_reduction_proxy { | 18 namespace data_reduction_proxy { |
19 | 19 |
20 DataReductionProxyStatisticsPrefs::DataReductionProxyStatisticsPrefs( | 20 DataReductionProxyStatisticsPrefs::DataReductionProxyStatisticsPrefs( |
21 PrefService* prefs, | 21 PrefService* prefs, |
22 scoped_refptr<base::SequencedTaskRunner> task_runner, | 22 scoped_refptr<base::SequencedTaskRunner> task_runner, |
23 const base::TimeDelta& delay) | 23 const base::TimeDelta& delay) |
24 : pref_service_(prefs), | 24 : pref_service_(prefs), |
25 task_runner_(task_runner), | 25 task_runner_(task_runner), |
26 delay_(delay), | 26 delay_(delay), |
27 delayed_task_posted_(false), | 27 delayed_task_posted_(false), |
28 weak_factory_(this), | 28 pref_change_registrar_(new PrefChangeRegistrar()), |
29 pref_change_registrar_(new PrefChangeRegistrar()) { | 29 weak_factory_(this) { |
30 DCHECK(prefs); | 30 DCHECK(prefs); |
31 DCHECK_GE(delay.InMilliseconds(), 0); | 31 DCHECK_GE(delay.InMilliseconds(), 0); |
32 Init(); | 32 Init(); |
33 } | 33 } |
34 | 34 |
35 DataReductionProxyStatisticsPrefs::~DataReductionProxyStatisticsPrefs() { | 35 DataReductionProxyStatisticsPrefs::~DataReductionProxyStatisticsPrefs() { |
36 // This object is created on UI thread, but destroyed on IO thread. So no | 36 // This object is created on UI thread, but destroyed on IO thread. So no |
37 // DCHECK on thread_checker_ here. | 37 // DCHECK on thread_checker_ here. |
38 } | 38 } |
39 | 39 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 return 0; | 180 return 0; |
181 } | 181 } |
182 | 182 |
183 int64 value = 0; | 183 int64 value = 0; |
184 bool rv = base::StringToInt64(string_value, &value); | 184 bool rv = base::StringToInt64(string_value, &value); |
185 DCHECK(rv); | 185 DCHECK(rv); |
186 return value; | 186 return value; |
187 } | 187 } |
188 | 188 |
189 } // namespace data_reduction_proxy | 189 } // namespace data_reduction_proxy |
OLD | NEW |