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

Side by Side Diff: remoting/host/security_key/security_key_socket.cc

Issue 2837863004: Use base::OneShotTimer instead of base::Timer(false, false)
Patch Set: rebase Created 3 years, 7 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/mouse_shape_pump.cc ('k') | remoting/protocol/authenticator_test_base.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "remoting/host/security_key/security_key_socket.h" 5 #include "remoting/host/security_key/security_key_socket.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 13 matching lines...) Expand all
24 // SSH Failure Code 24 // SSH Failure Code
25 const char kSshError[] = {0x05}; 25 const char kSshError[] = {0x05};
26 26
27 } // namespace 27 } // namespace
28 28
29 SecurityKeySocket::SecurityKeySocket(std::unique_ptr<net::StreamSocket> socket, 29 SecurityKeySocket::SecurityKeySocket(std::unique_ptr<net::StreamSocket> socket,
30 base::TimeDelta timeout, 30 base::TimeDelta timeout,
31 const base::Closure& timeout_callback) 31 const base::Closure& timeout_callback)
32 : socket_(std::move(socket)), 32 : socket_(std::move(socket)),
33 read_buffer_(new net::IOBufferWithSize(kRequestReadBufferLength)) { 33 read_buffer_(new net::IOBufferWithSize(kRequestReadBufferLength)) {
34 timer_.reset(new base::Timer(false, false)); 34 timer_.reset(new base::OneShotTimer);
35 timer_->Start(FROM_HERE, timeout, timeout_callback); 35 timer_->Start(FROM_HERE, timeout, timeout_callback);
36 } 36 }
37 37
38 SecurityKeySocket::~SecurityKeySocket() {} 38 SecurityKeySocket::~SecurityKeySocket() {}
39 39
40 bool SecurityKeySocket::GetAndClearRequestData(std::string* data_out) { 40 bool SecurityKeySocket::GetAndClearRequestData(std::string* data_out) {
41 DCHECK(thread_checker_.CalledOnValidThread()); 41 DCHECK(thread_checker_.CalledOnValidThread());
42 DCHECK(!waiting_for_request_); 42 DCHECK(!waiting_for_request_);
43 43
44 if (!IsRequestComplete() || IsRequestTooLarge()) { 44 if (!IsRequestComplete() || IsRequestTooLarge()) {
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 return response_len; 194 return response_len;
195 } 195 }
196 196
197 void SecurityKeySocket::ResetTimer() { 197 void SecurityKeySocket::ResetTimer() {
198 if (timer_->IsRunning()) { 198 if (timer_->IsRunning()) {
199 timer_->Reset(); 199 timer_->Reset();
200 } 200 }
201 } 201 }
202 202
203 } // namespace remoting 203 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/mouse_shape_pump.cc ('k') | remoting/protocol/authenticator_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698