OLD | NEW |
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 "jingle/glue/chrome_async_socket.h" | 5 #include "jingle/glue/chrome_async_socket.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cstdlib> | 8 #include <cstdlib> |
9 #include <cstring> | 9 #include <cstring> |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "net/socket/tcp_client_socket.h" | 23 #include "net/socket/tcp_client_socket.h" |
24 #include "net/ssl/ssl_config_service.h" | 24 #include "net/ssl/ssl_config_service.h" |
25 #include "third_party/libjingle/source/talk/base/socketaddress.h" | 25 #include "third_party/libjingle/source/talk/base/socketaddress.h" |
26 | 26 |
27 namespace jingle_glue { | 27 namespace jingle_glue { |
28 | 28 |
29 ChromeAsyncSocket::ChromeAsyncSocket( | 29 ChromeAsyncSocket::ChromeAsyncSocket( |
30 ResolvingClientSocketFactory* resolving_client_socket_factory, | 30 ResolvingClientSocketFactory* resolving_client_socket_factory, |
31 size_t read_buf_size, | 31 size_t read_buf_size, |
32 size_t write_buf_size) | 32 size_t write_buf_size) |
33 : weak_ptr_factory_(this), | 33 : resolving_client_socket_factory_(resolving_client_socket_factory), |
34 resolving_client_socket_factory_(resolving_client_socket_factory), | |
35 state_(STATE_CLOSED), | 34 state_(STATE_CLOSED), |
36 error_(ERROR_NONE), | 35 error_(ERROR_NONE), |
37 net_error_(net::OK), | 36 net_error_(net::OK), |
38 read_state_(IDLE), | 37 read_state_(IDLE), |
39 read_buf_(new net::IOBufferWithSize(read_buf_size)), | 38 read_buf_(new net::IOBufferWithSize(read_buf_size)), |
40 read_start_(0U), | 39 read_start_(0U), |
41 read_end_(0U), | 40 read_end_(0U), |
42 write_state_(IDLE), | 41 write_state_(IDLE), |
43 write_buf_(new net::IOBufferWithSize(write_buf_size)), | 42 write_buf_(new net::IOBufferWithSize(write_buf_size)), |
44 write_end_(0U) { | 43 write_end_(0U), |
| 44 weak_ptr_factory_(this) { |
45 DCHECK(resolving_client_socket_factory_.get()); | 45 DCHECK(resolving_client_socket_factory_.get()); |
46 DCHECK_GT(read_buf_size, 0U); | 46 DCHECK_GT(read_buf_size, 0U); |
47 DCHECK_GT(write_buf_size, 0U); | 47 DCHECK_GT(write_buf_size, 0U); |
48 } | 48 } |
49 | 49 |
50 ChromeAsyncSocket::~ChromeAsyncSocket() {} | 50 ChromeAsyncSocket::~ChromeAsyncSocket() {} |
51 | 51 |
52 ChromeAsyncSocket::State ChromeAsyncSocket::state() { | 52 ChromeAsyncSocket::State ChromeAsyncSocket::state() { |
53 return state_; | 53 return state_; |
54 } | 54 } |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 } | 441 } |
442 state_ = STATE_TLS_OPEN; | 442 state_ = STATE_TLS_OPEN; |
443 PostDoRead(); | 443 PostDoRead(); |
444 if (write_end_ > 0U) { | 444 if (write_end_ > 0U) { |
445 PostDoWrite(); | 445 PostDoWrite(); |
446 } | 446 } |
447 SignalSSLConnected(); | 447 SignalSSLConnected(); |
448 } | 448 } |
449 | 449 |
450 } // namespace jingle_glue | 450 } // namespace jingle_glue |
OLD | NEW |