Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: google_apis/gcm/engine/heartbeat_manager.h

Issue 1873663002: Convert //google_apis from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #ifndef GOOGLE_APIS_GCM_ENGINE_HEARTBEAT_MANAGER_H_ 5 #ifndef GOOGLE_APIS_GCM_ENGINE_HEARTBEAT_MANAGER_H_
6 #define GOOGLE_APIS_GCM_ENGINE_HEARTBEAT_MANAGER_H_ 6 #define GOOGLE_APIS_GCM_ENGINE_HEARTBEAT_MANAGER_H_
7 7
8 #include <memory>
9
8 #include "base/callback.h" 10 #include "base/callback.h"
9 #include "base/logging.h" 11 #include "base/logging.h"
10 #include "base/macros.h" 12 #include "base/macros.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
13 #include "base/power_monitor/power_observer.h" 14 #include "base/power_monitor/power_observer.h"
14 #include "google_apis/gcm/base/gcm_export.h" 15 #include "google_apis/gcm/base/gcm_export.h"
15 #include "google_apis/gcm/engine/connection_factory.h" 16 #include "google_apis/gcm/engine/connection_factory.h"
16 17
17 namespace base { 18 namespace base {
18 class Timer; 19 class Timer;
19 } 20 }
20 21
21 namespace mcs_proto { 22 namespace mcs_proto {
(...skipping 30 matching lines...) Expand all
52 // Updates the current heartbeat interval. 53 // Updates the current heartbeat interval.
53 void UpdateHeartbeatConfig(const mcs_proto::HeartbeatConfig& config); 54 void UpdateHeartbeatConfig(const mcs_proto::HeartbeatConfig& config);
54 55
55 // Returns the next scheduled heartbeat time. A null time means 56 // Returns the next scheduled heartbeat time. A null time means
56 // no heartbeat is pending. If non-null and less than the 57 // no heartbeat is pending. If non-null and less than the
57 // current time (in ticks), the heartbeat has been triggered and an ack is 58 // current time (in ticks), the heartbeat has been triggered and an ack is
58 // pending. 59 // pending.
59 base::TimeTicks GetNextHeartbeatTime() const; 60 base::TimeTicks GetNextHeartbeatTime() const;
60 61
61 // Updates the timer used for scheduling heartbeats. 62 // Updates the timer used for scheduling heartbeats.
62 void UpdateHeartbeatTimer(scoped_ptr<base::Timer> timer); 63 void UpdateHeartbeatTimer(std::unique_ptr<base::Timer> timer);
63 64
64 // base::PowerObserver override. 65 // base::PowerObserver override.
65 void OnSuspend() override; 66 void OnSuspend() override;
66 void OnResume() override; 67 void OnResume() override;
67 68
68 // Maximum and minimum of the custom client interval that can be requested, 69 // Maximum and minimum of the custom client interval that can be requested,
69 // calculated based on the network conditions. 70 // calculated based on the network conditions.
70 int GetMaxClientHeartbeatIntervalMs(); 71 int GetMaxClientHeartbeatIntervalMs();
71 int GetMinClientHeartbeatIntervalMs(); 72 int GetMinClientHeartbeatIntervalMs();
72 73
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // The current heartbeat interval. 111 // The current heartbeat interval.
111 int heartbeat_interval_ms_; 112 int heartbeat_interval_ms_;
112 // The most recent server-provided heartbeat interval (0 if none has been 113 // The most recent server-provided heartbeat interval (0 if none has been
113 // provided). 114 // provided).
114 int server_interval_ms_; 115 int server_interval_ms_;
115 116
116 // Custom interval requested by the client. 117 // Custom interval requested by the client.
117 int client_interval_ms_; 118 int client_interval_ms_;
118 119
119 // Timer for triggering heartbeats. 120 // Timer for triggering heartbeats.
120 scoped_ptr<base::Timer> heartbeat_timer_; 121 std::unique_ptr<base::Timer> heartbeat_timer_;
121 122
122 // Time at which the machine was last suspended. 123 // Time at which the machine was last suspended.
123 base::Time suspend_time_; 124 base::Time suspend_time_;
124 125
125 // Callbacks for interacting with the the connection. 126 // Callbacks for interacting with the the connection.
126 base::Closure send_heartbeat_callback_; 127 base::Closure send_heartbeat_callback_;
127 ReconnectCallback trigger_reconnect_callback_; 128 ReconnectCallback trigger_reconnect_callback_;
128 129
129 base::WeakPtrFactory<HeartbeatManager> weak_ptr_factory_; 130 base::WeakPtrFactory<HeartbeatManager> weak_ptr_factory_;
130 131
131 DISALLOW_COPY_AND_ASSIGN(HeartbeatManager); 132 DISALLOW_COPY_AND_ASSIGN(HeartbeatManager);
132 }; 133 };
133 134
134 } // namespace gcm 135 } // namespace gcm
135 136
136 #endif // GOOGLE_APIS_GCM_ENGINE_HEARTBEAT_MANAGER_H_ 137 #endif // GOOGLE_APIS_GCM_ENGINE_HEARTBEAT_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698