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 // An implementation of buzz::AsyncSocket that uses Chrome sockets. | 5 // An implementation of buzz::AsyncSocket that uses Chrome sockets. |
6 | 6 |
7 #ifndef JINGLE_GLUE_CHROME_ASYNC_SOCKET_H_ | 7 #ifndef JINGLE_GLUE_CHROME_ASYNC_SOCKET_H_ |
8 #define JINGLE_GLUE_CHROME_ASYNC_SOCKET_H_ | 8 #define JINGLE_GLUE_CHROME_ASYNC_SOCKET_H_ |
9 | 9 |
10 #if !defined(FEATURE_ENABLE_SSL) | 10 #if !defined(FEATURE_ENABLE_SSL) |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 void PostDoWrite(); | 173 void PostDoWrite(); |
174 void DoWrite(); | 174 void DoWrite(); |
175 void ProcessWriteDone(int status); | 175 void ProcessWriteDone(int status); |
176 | 176 |
177 // SSL/TLS connection functions. | 177 // SSL/TLS connection functions. |
178 void ProcessSSLConnectDone(int status); | 178 void ProcessSSLConnectDone(int status); |
179 | 179 |
180 // Close functions. | 180 // Close functions. |
181 void DoClose(); | 181 void DoClose(); |
182 | 182 |
183 base::WeakPtrFactory<ChromeAsyncSocket> weak_ptr_factory_; | |
184 scoped_ptr<ResolvingClientSocketFactory> resolving_client_socket_factory_; | 183 scoped_ptr<ResolvingClientSocketFactory> resolving_client_socket_factory_; |
185 | 184 |
186 // buzz::AsyncSocket state. | 185 // buzz::AsyncSocket state. |
187 buzz::AsyncSocket::State state_; | 186 buzz::AsyncSocket::State state_; |
188 buzz::AsyncSocket::Error error_; | 187 buzz::AsyncSocket::Error error_; |
189 net::Error net_error_; | 188 net::Error net_error_; |
190 | 189 |
191 // NULL iff state() == STATE_CLOSED. | 190 // NULL iff state() == STATE_CLOSED. |
192 scoped_ptr<net::StreamSocket> transport_socket_; | 191 scoped_ptr<net::StreamSocket> transport_socket_; |
193 | 192 |
194 // State for the read loop. |read_start_| <= |read_end_| <= | 193 // State for the read loop. |read_start_| <= |read_end_| <= |
195 // |read_buf_->size()|. There's a read in flight (i.e., | 194 // |read_buf_->size()|. There's a read in flight (i.e., |
196 // |read_state_| != IDLE) iff |read_end_| == 0. | 195 // |read_state_| != IDLE) iff |read_end_| == 0. |
197 AsyncIOState read_state_; | 196 AsyncIOState read_state_; |
198 scoped_refptr<net::IOBufferWithSize> read_buf_; | 197 scoped_refptr<net::IOBufferWithSize> read_buf_; |
199 size_t read_start_, read_end_; | 198 size_t read_start_, read_end_; |
200 | 199 |
201 // State for the write loop. |write_end_| <= |write_buf_->size()|. | 200 // State for the write loop. |write_end_| <= |write_buf_->size()|. |
202 // There's a write in flight (i.e., |write_state_| != IDLE) iff | 201 // There's a write in flight (i.e., |write_state_| != IDLE) iff |
203 // |write_end_| > 0. | 202 // |write_end_| > 0. |
204 AsyncIOState write_state_; | 203 AsyncIOState write_state_; |
205 scoped_refptr<net::IOBufferWithSize> write_buf_; | 204 scoped_refptr<net::IOBufferWithSize> write_buf_; |
206 size_t write_end_; | 205 size_t write_end_; |
207 | 206 |
| 207 base::WeakPtrFactory<ChromeAsyncSocket> weak_ptr_factory_; |
| 208 |
208 DISALLOW_COPY_AND_ASSIGN(ChromeAsyncSocket); | 209 DISALLOW_COPY_AND_ASSIGN(ChromeAsyncSocket); |
209 }; | 210 }; |
210 | 211 |
211 } // namespace jingle_glue | 212 } // namespace jingle_glue |
212 | 213 |
213 #endif // JINGLE_GLUE_CHROME_ASYNC_SOCKET_H_ | 214 #endif // JINGLE_GLUE_CHROME_ASYNC_SOCKET_H_ |
OLD | NEW |