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

Side by Side Diff: jingle/notifier/base/chrome_async_socket.h

Issue 6833031: Changed the jingle network code in ChromeAsyncSocket to use the client socket pool. This also all... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Lint fixes Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_NOTIFIER_BASE_CHROME_ASYNC_SOCKET_H_ 7 #ifndef JINGLE_NOTIFIER_BASE_CHROME_ASYNC_SOCKET_H_
8 #define JINGLE_NOTIFIER_BASE_CHROME_ASYNC_SOCKET_H_ 8 #define JINGLE_NOTIFIER_BASE_CHROME_ASYNC_SOCKET_H_
9 9
10 #if !defined(FEATURE_ENABLE_SSL) 10 #if !defined(FEATURE_ENABLE_SSL)
11 #error ChromeAsyncSocket expects FEATURE_ENABLE_SSL to be defined 11 #error ChromeAsyncSocket expects FEATURE_ENABLE_SSL to be defined
12 #endif 12 #endif
13 13
14 #include <string> 14 #include <string>
15 #include <vector> 15 #include <vector>
16 16
17 #include "base/basictypes.h" 17 #include "base/basictypes.h"
18 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
19 #include "base/memory/scoped_ptr.h" 19 #include "base/memory/scoped_ptr.h"
20 #include "base/task.h" 20 #include "base/task.h"
21 #include "net/base/completion_callback.h" 21 #include "net/base/completion_callback.h"
22 #include "net/base/net_errors.h" 22 #include "net/base/net_errors.h"
23 #include "net/base/net_log.h" 23 #include "net/base/net_log.h"
24 #include "net/base/ssl_config_service.h"
25 #include "talk/xmpp/asyncsocket.h" 24 #include "talk/xmpp/asyncsocket.h"
26 25
27 namespace net { 26 namespace net {
28 class CertVerifier;
29 class ClientSocket; 27 class ClientSocket;
30 class ClientSocketFactory;
31 class IOBufferWithSize; 28 class IOBufferWithSize;
32 } // namespace net 29 } // namespace net
33 30
34 namespace notifier { 31 namespace notifier {
35 32
33 class ResolvingClientSocketFactory;
34
36 class ChromeAsyncSocket : public buzz::AsyncSocket { 35 class ChromeAsyncSocket : public buzz::AsyncSocket {
37 public: 36 public:
38 // Takes ownership of |client_socket_factory| but not |cert_verifier| nor 37 // Takes ownership of |client_socket_factory| but not |net_log|.
39 // |net_log|. |cert_verifier| may not be NULL. |net_log| may be NULL. 38 // |net_log| may be NULL.
40 ChromeAsyncSocket(net::ClientSocketFactory* client_socket_factory, 39 ChromeAsyncSocket(ResolvingClientSocketFactory* client_socket_factory,
41 const net::SSLConfig& ssl_config,
42 net::CertVerifier* cert_verifier,
43 size_t read_buf_size, 40 size_t read_buf_size,
44 size_t write_buf_size, 41 size_t write_buf_size,
45 net::NetLog* net_log); 42 net::NetLog* net_log);
46 43
47 // Does not raise any signals. 44 // Does not raise any signals.
48 virtual ~ChromeAsyncSocket(); 45 virtual ~ChromeAsyncSocket();
49 46
50 // buzz::AsyncSocket implementation. 47 // buzz::AsyncSocket implementation.
51 48
52 // The current state (see buzz::AsyncSocket::State; all but 49 // The current state (see buzz::AsyncSocket::State; all but
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 177
181 // Close functions. 178 // Close functions.
182 void DoClose(); 179 void DoClose();
183 180
184 // Callbacks passed to |transport_socket_|. 181 // Callbacks passed to |transport_socket_|.
185 net::CompletionCallbackImpl<ChromeAsyncSocket> connect_callback_; 182 net::CompletionCallbackImpl<ChromeAsyncSocket> connect_callback_;
186 net::CompletionCallbackImpl<ChromeAsyncSocket> read_callback_; 183 net::CompletionCallbackImpl<ChromeAsyncSocket> read_callback_;
187 net::CompletionCallbackImpl<ChromeAsyncSocket> write_callback_; 184 net::CompletionCallbackImpl<ChromeAsyncSocket> write_callback_;
188 net::CompletionCallbackImpl<ChromeAsyncSocket> ssl_connect_callback_; 185 net::CompletionCallbackImpl<ChromeAsyncSocket> ssl_connect_callback_;
189 186
190 scoped_ptr<net::ClientSocketFactory> client_socket_factory_; 187 scoped_ptr<ResolvingClientSocketFactory> client_socket_factory_;
191 const net::SSLConfig ssl_config_;
192 net::CertVerifier* const cert_verifier_;
193 net::BoundNetLog bound_net_log_; 188 net::BoundNetLog bound_net_log_;
194 189
195 // buzz::AsyncSocket state. 190 // buzz::AsyncSocket state.
196 buzz::AsyncSocket::State state_; 191 buzz::AsyncSocket::State state_;
197 buzz::AsyncSocket::Error error_; 192 buzz::AsyncSocket::Error error_;
198 net::Error net_error_; 193 net::Error net_error_;
199 194
200 // Used by read/write loops. 195 // Used by read/write loops.
201 ScopedRunnableMethodFactory<ChromeAsyncSocket> 196 ScopedRunnableMethodFactory<ChromeAsyncSocket>
202 scoped_runnable_method_factory_; 197 scoped_runnable_method_factory_;
(...skipping 16 matching lines...) Expand all
219 AsyncIOState write_state_; 214 AsyncIOState write_state_;
220 scoped_refptr<net::IOBufferWithSize> write_buf_; 215 scoped_refptr<net::IOBufferWithSize> write_buf_;
221 size_t write_end_; 216 size_t write_end_;
222 217
223 DISALLOW_COPY_AND_ASSIGN(ChromeAsyncSocket); 218 DISALLOW_COPY_AND_ASSIGN(ChromeAsyncSocket);
224 }; 219 };
225 220
226 } // namespace notifier 221 } // namespace notifier
227 222
228 #endif // JINGLE_NOTIFIER_BASE_CHROME_ASYNC_SOCKET_H_ 223 #endif // JINGLE_NOTIFIER_BASE_CHROME_ASYNC_SOCKET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698