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/gcm_driver/gcm_channel_status_syncer.h" | 5 #include "components/gcm_driver/gcm_channel_status_syncer.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/prefs/pref_registry_simple.h" | |
14 #include "base/prefs/pref_service.h" | |
15 #include "base/rand_util.h" | 13 #include "base/rand_util.h" |
16 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
17 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
18 #include "base/thread_task_runner_handle.h" | 16 #include "base/thread_task_runner_handle.h" |
19 #include "components/gcm_driver/gcm_channel_status_request.h" | 17 #include "components/gcm_driver/gcm_channel_status_request.h" |
20 #include "components/gcm_driver/gcm_driver.h" | 18 #include "components/gcm_driver/gcm_driver.h" |
21 #include "components/pref_registry/pref_registry_syncable.h" | 19 #include "components/pref_registry/pref_registry_syncable.h" |
| 20 #include "components/prefs/pref_registry_simple.h" |
| 21 #include "components/prefs/pref_service.h" |
22 | 22 |
23 namespace gcm { | 23 namespace gcm { |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 // A small delay to avoid sending request at browser startup time for first-time | 27 // A small delay to avoid sending request at browser startup time for first-time |
28 // request. | 28 // request. |
29 const int kFirstTimeDelaySeconds = 1 * 60; // 1 minute. | 29 const int kFirstTimeDelaySeconds = 1 * 60; // 1 minute. |
30 | 30 |
31 // The fuzzing variation added to the polling delay. | 31 // The fuzzing variation added to the polling delay. |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 // Otherwise, add a fuzzing variation to the delay. | 227 // Otherwise, add a fuzzing variation to the delay. |
228 // The fuzzing variation is off when the custom interval is used. | 228 // The fuzzing variation is off when the custom interval is used. |
229 if (!custom_poll_interval_use_count_) | 229 if (!custom_poll_interval_use_count_) |
230 delay_seconds += base::RandInt(0, kGCMChannelRequestTimeJitterSeconds); | 230 delay_seconds += base::RandInt(0, kGCMChannelRequestTimeJitterSeconds); |
231 } | 231 } |
232 | 232 |
233 return base::TimeDelta::FromSeconds(delay_seconds); | 233 return base::TimeDelta::FromSeconds(delay_seconds); |
234 } | 234 } |
235 | 235 |
236 } // namespace gcm | 236 } // namespace gcm |
OLD | NEW |