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/browser/data_reduction_proxy_statistic
s_prefs.h" | 5 #include "components/data_reduction_proxy/browser/data_reduction_proxy_statistic
s_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_service.h" | 10 #include "base/prefs/pref_service.h" |
11 #include "base/prefs/scoped_user_pref_update.h" | 11 #include "base/prefs/scoped_user_pref_update.h" |
12 #include "base/sequenced_task_runner.h" | 12 #include "base/sequenced_task_runner.h" |
13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
16 | 16 |
17 namespace data_reduction_proxy { | 17 namespace data_reduction_proxy { |
18 | 18 |
19 DataReductionProxyStatisticsPrefs::DataReductionProxyStatisticsPrefs( | 19 DataReductionProxyStatisticsPrefs::DataReductionProxyStatisticsPrefs( |
20 PrefService* prefs, | 20 PrefService* prefs, |
21 scoped_refptr<base::SequencedTaskRunner> task_runner, | 21 scoped_refptr<base::SequencedTaskRunner> task_runner, |
22 const base::TimeDelta& delay) | 22 const base::TimeDelta& delay) |
23 : pref_service_(prefs), | 23 : pref_service_(prefs), |
24 task_runner_(task_runner), | 24 task_runner_(task_runner), |
25 weak_factory_(this), | |
26 delay_(delay), | 25 delay_(delay), |
27 delayed_task_posted_(false) { | 26 delayed_task_posted_(false), |
| 27 weak_factory_(this) { |
28 DCHECK(prefs); | 28 DCHECK(prefs); |
29 DCHECK_GE(delay.InMilliseconds(), 0); | 29 DCHECK_GE(delay.InMilliseconds(), 0); |
30 Init(); | 30 Init(); |
31 } | 31 } |
32 | 32 |
33 DataReductionProxyStatisticsPrefs::~DataReductionProxyStatisticsPrefs() {} | 33 DataReductionProxyStatisticsPrefs::~DataReductionProxyStatisticsPrefs() {} |
34 | 34 |
35 void DataReductionProxyStatisticsPrefs::Init() { | 35 void DataReductionProxyStatisticsPrefs::Init() { |
36 if (delay_ == base::TimeDelta()) | 36 if (delay_ == base::TimeDelta()) |
37 return; | 37 return; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 return 0; | 153 return 0; |
154 } | 154 } |
155 | 155 |
156 int64 value = 0; | 156 int64 value = 0; |
157 bool rv = base::StringToInt64(string_value, &value); | 157 bool rv = base::StringToInt64(string_value, &value); |
158 DCHECK(rv); | 158 DCHECK(rv); |
159 return value; | 159 return value; |
160 } | 160 } |
161 | 161 |
162 } // namespace data_reduction_proxy | 162 } // namespace data_reduction_proxy |
OLD | NEW |