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

Side by Side Diff: net/socket/ssl_client_socket_mac.cc

Issue 1746012: More cleanup of net_log.h (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 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 | Annotate | Revision Log
« no previous file with comments | « net/socket/socks_client_socket.cc ('k') | net/socket/ssl_client_socket_nss.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "net/socket/ssl_client_socket_mac.h" 5 #include "net/socket/ssl_client_socket_mac.h"
6 6
7 #include <CoreServices/CoreServices.h> 7 #include <CoreServices/CoreServices.h>
8 #include <netdb.h> 8 #include <netdb.h>
9 #include <sys/socket.h> 9 #include <sys/socket.h>
10 #include <sys/types.h> 10 #include <sys/types.h>
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 524
525 SSLClientSocketMac::~SSLClientSocketMac() { 525 SSLClientSocketMac::~SSLClientSocketMac() {
526 Disconnect(); 526 Disconnect();
527 } 527 }
528 528
529 int SSLClientSocketMac::Connect(CompletionCallback* callback) { 529 int SSLClientSocketMac::Connect(CompletionCallback* callback) {
530 DCHECK(transport_.get()); 530 DCHECK(transport_.get());
531 DCHECK(next_handshake_state_ == STATE_NONE); 531 DCHECK(next_handshake_state_ == STATE_NONE);
532 DCHECK(!user_connect_callback_); 532 DCHECK(!user_connect_callback_);
533 533
534 net_log_.BeginEvent(NetLog::TYPE_SSL_CONNECT); 534 net_log_.BeginEvent(NetLog::TYPE_SSL_CONNECT, NULL);
535 535
536 int rv = InitializeSSLContext(); 536 int rv = InitializeSSLContext();
537 if (rv != OK) { 537 if (rv != OK) {
538 net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT); 538 net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, NULL);
539 return rv; 539 return rv;
540 } 540 }
541 541
542 next_handshake_state_ = STATE_HANDSHAKE_START; 542 next_handshake_state_ = STATE_HANDSHAKE_START;
543 rv = DoHandshakeLoop(OK); 543 rv = DoHandshakeLoop(OK);
544 if (rv == ERR_IO_PENDING) { 544 if (rv == ERR_IO_PENDING) {
545 user_connect_callback_ = callback; 545 user_connect_callback_ = callback;
546 } else { 546 } else {
547 net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT); 547 net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, NULL);
548 } 548 }
549 return rv; 549 return rv;
550 } 550 }
551 551
552 void SSLClientSocketMac::Disconnect() { 552 void SSLClientSocketMac::Disconnect() {
553 completed_handshake_ = false; 553 completed_handshake_ = false;
554 554
555 if (ssl_context_) { 555 if (ssl_context_) {
556 SSLClose(ssl_context_); 556 SSLClose(ssl_context_);
557 SSLDisposeContext(ssl_context_); 557 SSLDisposeContext(ssl_context_);
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 user_write_callback_ = NULL; 859 user_write_callback_ = NULL;
860 user_write_buf_ = NULL; 860 user_write_buf_ = NULL;
861 user_write_buf_len_ = 0; 861 user_write_buf_len_ = 0;
862 c->Run(rv); 862 c->Run(rv);
863 } 863 }
864 864
865 void SSLClientSocketMac::OnHandshakeIOComplete(int result) { 865 void SSLClientSocketMac::OnHandshakeIOComplete(int result) {
866 DCHECK(next_handshake_state_ != STATE_NONE); 866 DCHECK(next_handshake_state_ != STATE_NONE);
867 int rv = DoHandshakeLoop(result); 867 int rv = DoHandshakeLoop(result);
868 if (rv != ERR_IO_PENDING) { 868 if (rv != ERR_IO_PENDING) {
869 net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT); 869 net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, NULL);
870 DoConnectCallback(rv); 870 DoConnectCallback(rv);
871 } 871 }
872 } 872 }
873 873
874 void SSLClientSocketMac::OnTransportReadComplete(int result) { 874 void SSLClientSocketMac::OnTransportReadComplete(int result) {
875 if (result > 0) { 875 if (result > 0) {
876 recv_buffer_.insert(recv_buffer_.end(), 876 recv_buffer_.insert(recv_buffer_.end(),
877 read_io_buf_->data(), 877 read_io_buf_->data(),
878 read_io_buf_->data() + result); 878 read_io_buf_->data() + result);
879 } 879 }
880 read_io_buf_ = NULL; 880 read_io_buf_ = NULL;
881 881
882 if (next_handshake_state_ != STATE_NONE) { 882 if (next_handshake_state_ != STATE_NONE) {
883 int rv = DoHandshakeLoop(result); 883 int rv = DoHandshakeLoop(result);
884 if (rv != ERR_IO_PENDING) { 884 if (rv != ERR_IO_PENDING) {
885 net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT); 885 net_log_.EndEvent(NetLog::TYPE_SSL_CONNECT, NULL);
886 DoConnectCallback(rv); 886 DoConnectCallback(rv);
887 } 887 }
888 return; 888 return;
889 } 889 }
890 if (user_read_buf_) { 890 if (user_read_buf_) {
891 if (result < 0) { 891 if (result < 0) {
892 DoReadCallback(result); 892 DoReadCallback(result);
893 return; 893 return;
894 } 894 }
895 int rv = DoPayloadRead(); 895 int rv = DoPayloadRead();
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
1293 if (rv < 0 && rv != ERR_IO_PENDING) { 1293 if (rv < 0 && rv != ERR_IO_PENDING) {
1294 us->write_io_buf_ = NULL; 1294 us->write_io_buf_ = NULL;
1295 return OSStatusFromNetError(rv); 1295 return OSStatusFromNetError(rv);
1296 } 1296 }
1297 1297
1298 // always lie to our caller 1298 // always lie to our caller
1299 return noErr; 1299 return noErr;
1300 } 1300 }
1301 1301
1302 } // namespace net 1302 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/socks_client_socket.cc ('k') | net/socket/ssl_client_socket_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698