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

Side by Side Diff: remoting/protocol/ssl_hmac_channel_authenticator.cc

Issue 1064863004: Use base::ResetAndReturn() in remoting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 (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 #include "remoting/protocol/ssl_hmac_channel_authenticator.h" 5 #include "remoting/protocol/ssl_hmac_channel_authenticator.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback_helpers.h"
9 #include "crypto/secure_util.h" 10 #include "crypto/secure_util.h"
10 #include "net/base/host_port_pair.h" 11 #include "net/base/host_port_pair.h"
11 #include "net/base/io_buffer.h" 12 #include "net/base/io_buffer.h"
12 #include "net/base/net_errors.h" 13 #include "net/base/net_errors.h"
13 #include "net/cert/x509_certificate.h" 14 #include "net/cert/x509_certificate.h"
14 #include "net/http/transport_security_state.h" 15 #include "net/http/transport_security_state.h"
15 #include "net/socket/client_socket_factory.h" 16 #include "net/socket/client_socket_factory.h"
16 #include "net/socket/client_socket_handle.h" 17 #include "net/socket/client_socket_handle.h"
17 #include "net/socket/ssl_client_socket.h" 18 #include "net/socket/ssl_client_socket.h"
18 #include "net/socket/ssl_client_socket_openssl.h" 19 #include "net/socket/ssl_client_socket_openssl.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 return crypto::SecureMemEqual(received_auth_bytes.data(), 274 return crypto::SecureMemEqual(received_auth_bytes.data(),
274 &(auth_bytes[0]), kAuthDigestLength); 275 &(auth_bytes[0]), kAuthDigestLength);
275 } 276 }
276 277
277 void SslHmacChannelAuthenticator::CheckDone(bool* callback_called) { 278 void SslHmacChannelAuthenticator::CheckDone(bool* callback_called) {
278 if (auth_write_buf_.get() == nullptr && auth_read_buf_.get() == nullptr) { 279 if (auth_write_buf_.get() == nullptr && auth_read_buf_.get() == nullptr) {
279 DCHECK(socket_.get() != nullptr); 280 DCHECK(socket_.get() != nullptr);
280 if (callback_called) 281 if (callback_called)
281 *callback_called = true; 282 *callback_called = true;
282 283
283 CallDoneCallback(net::OK, socket_.Pass()); 284 base::ResetAndReturn(&done_callback_).Run(net::OK, socket_.Pass());
284 } 285 }
285 } 286 }
286 287
287 void SslHmacChannelAuthenticator::NotifyError(int error) { 288 void SslHmacChannelAuthenticator::NotifyError(int error) {
288 CallDoneCallback(error, nullptr); 289 base::ResetAndReturn(&done_callback_).Run(error, nullptr);
289 }
290
291 void SslHmacChannelAuthenticator::CallDoneCallback(
292 int error,
293 scoped_ptr<net::StreamSocket> socket) {
294 DoneCallback callback = done_callback_;
295 done_callback_.Reset();
296 callback.Run(error, socket.Pass());
297 } 290 }
298 291
299 } // namespace protocol 292 } // namespace protocol
300 } // namespace remoting 293 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698