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 "google_apis/gcm/engine/heartbeat_manager.h" | 5 #include "google_apis/gcm/engine/heartbeat_manager.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/power_monitor/power_monitor.h" | 10 #include "base/power_monitor/power_monitor.h" |
11 #include "base/thread_task_runner_handle.h" | 11 #include "base/thread_task_runner_handle.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "base/timer/timer.h" | 13 #include "base/timer/timer.h" |
| 14 #include "build/build_config.h" |
14 #include "google_apis/gcm/protocol/mcs.pb.h" | 15 #include "google_apis/gcm/protocol/mcs.pb.h" |
15 #include "net/base/network_change_notifier.h" | 16 #include "net/base/network_change_notifier.h" |
16 | 17 |
17 namespace gcm { | 18 namespace gcm { |
18 | 19 |
19 namespace { | 20 namespace { |
20 // The default heartbeat when on a mobile or unknown network . | 21 // The default heartbeat when on a mobile or unknown network . |
21 const int kCellHeartbeatDefaultMs = 1000 * 60 * 28; // 28 minutes. | 22 const int kCellHeartbeatDefaultMs = 1000 * 60 * 28; // 28 minutes. |
22 // The default heartbeat when on WiFi (also used for ethernet). | 23 // The default heartbeat when on WiFi (also used for ethernet). |
23 const int kWifiHeartbeatDefaultMs = 1000 * 60 * 15; // 15 minutes. | 24 const int kWifiHeartbeatDefaultMs = 1000 * 60 * 15; // 15 minutes. |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 interval <= max_heartbeat_interval; | 284 interval <= max_heartbeat_interval; |
284 } | 285 } |
285 | 286 |
286 void HeartbeatManager::ResetConnection( | 287 void HeartbeatManager::ResetConnection( |
287 ConnectionFactory::ConnectionResetReason reason) { | 288 ConnectionFactory::ConnectionResetReason reason) { |
288 Stop(); | 289 Stop(); |
289 trigger_reconnect_callback_.Run(reason); | 290 trigger_reconnect_callback_.Run(reason); |
290 } | 291 } |
291 | 292 |
292 } // namespace gcm | 293 } // namespace gcm |
OLD | NEW |