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

Side by Side Diff: remoting/host/heartbeat_sender.h

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU 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
« no previous file with comments | « remoting/host/gcd_state_updater_unittest.cc ('k') | remoting/host/heartbeat_sender.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 REMOTING_HOST_HEARTBEAT_SENDER_H_ 5 #ifndef REMOTING_HOST_HEARTBEAT_SENDER_H_
6 #define REMOTING_HOST_HEARTBEAT_SENDER_H_ 6 #define REMOTING_HOST_HEARTBEAT_SENDER_H_
7 7
8 #include <memory>
8 #include <string> 9 #include <string>
9 10
10 #include "base/callback.h" 11 #include "base/callback.h"
11 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
12 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/threading/thread_checker.h" 16 #include "base/threading/thread_checker.h"
17 #include "base/timer/timer.h" 17 #include "base/timer/timer.h"
18 #include "remoting/base/rsa_key_pair.h" 18 #include "remoting/base/rsa_key_pair.h"
19 #include "remoting/signaling/signal_strategy.h" 19 #include "remoting/signaling/signal_strategy.h"
20 20
21 namespace base { 21 namespace base {
22 class TimeDelta; 22 class TimeDelta;
23 } // namespace base 23 } // namespace base
24 24
25 namespace buzz { 25 namespace buzz {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 IqRequest* request, 140 IqRequest* request,
141 const buzz::XmlElement* response); 141 const buzz::XmlElement* response);
142 void SetInterval(int interval); 142 void SetInterval(int interval);
143 void SetSequenceId(int sequence_id); 143 void SetSequenceId(int sequence_id);
144 144
145 // Handlers for host-offline-reason completion and timeout. 145 // Handlers for host-offline-reason completion and timeout.
146 void OnHostOfflineReasonTimeout(); 146 void OnHostOfflineReasonTimeout();
147 void OnHostOfflineReasonAck(); 147 void OnHostOfflineReasonAck();
148 148
149 // Helper methods used by DoSendStanza() to generate heartbeat stanzas. 149 // Helper methods used by DoSendStanza() to generate heartbeat stanzas.
150 scoped_ptr<buzz::XmlElement> CreateHeartbeatMessage(); 150 std::unique_ptr<buzz::XmlElement> CreateHeartbeatMessage();
151 scoped_ptr<buzz::XmlElement> CreateSignature(); 151 std::unique_ptr<buzz::XmlElement> CreateSignature();
152 152
153 base::Closure on_heartbeat_successful_callback_; 153 base::Closure on_heartbeat_successful_callback_;
154 base::Closure on_unknown_host_id_error_; 154 base::Closure on_unknown_host_id_error_;
155 std::string host_id_; 155 std::string host_id_;
156 SignalStrategy* signal_strategy_; 156 SignalStrategy* signal_strategy_;
157 scoped_refptr<const RsaKeyPair> host_key_pair_; 157 scoped_refptr<const RsaKeyPair> host_key_pair_;
158 std::string directory_bot_jid_; 158 std::string directory_bot_jid_;
159 scoped_ptr<IqSender> iq_sender_; 159 std::unique_ptr<IqSender> iq_sender_;
160 scoped_ptr<IqRequest> request_; 160 std::unique_ptr<IqRequest> request_;
161 int interval_ms_; 161 int interval_ms_;
162 base::RepeatingTimer timer_; 162 base::RepeatingTimer timer_;
163 base::OneShotTimer timer_resend_; 163 base::OneShotTimer timer_resend_;
164 int sequence_id_; 164 int sequence_id_;
165 bool sequence_id_was_set_; 165 bool sequence_id_was_set_;
166 int sequence_id_recent_set_num_; 166 int sequence_id_recent_set_num_;
167 bool heartbeat_succeeded_; 167 bool heartbeat_succeeded_;
168 int failed_startup_heartbeat_count_; 168 int failed_startup_heartbeat_count_;
169 169
170 // Fields to send and indicate completion of sending host-offline-reason. 170 // Fields to send and indicate completion of sending host-offline-reason.
171 std::string host_offline_reason_; 171 std::string host_offline_reason_;
172 base::Callback<void(bool success)> host_offline_reason_ack_callback_; 172 base::Callback<void(bool success)> host_offline_reason_ack_callback_;
173 base::OneShotTimer host_offline_reason_timeout_timer_; 173 base::OneShotTimer host_offline_reason_timeout_timer_;
174 174
175 base::ThreadChecker thread_checker_; 175 base::ThreadChecker thread_checker_;
176 176
177 DISALLOW_COPY_AND_ASSIGN(HeartbeatSender); 177 DISALLOW_COPY_AND_ASSIGN(HeartbeatSender);
178 }; 178 };
179 179
180 } // namespace remoting 180 } // namespace remoting
181 181
182 #endif // REMOTING_HOST_HEARTBEAT_SENDER_H_ 182 #endif // REMOTING_HOST_HEARTBEAT_SENDER_H_
OLDNEW
« no previous file with comments | « remoting/host/gcd_state_updater_unittest.cc ('k') | remoting/host/heartbeat_sender.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698