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

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

Issue 8551004: base::Bind: Convert jingle/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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 | « jingle/glue/thread_wrapper.cc ('k') | jingle/notifier/base/chrome_async_socket.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) 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/memory/weak_ptr.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 "talk/xmpp/asyncsocket.h" 23 #include "talk/xmpp/asyncsocket.h"
24 24
25 namespace net { 25 namespace net {
26 class IOBufferWithSize; 26 class IOBufferWithSize;
27 class StreamSocket; 27 class StreamSocket;
28 } // namespace net 28 } // namespace net
29 29
30 namespace notifier { 30 namespace notifier {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 net::OldCompletionCallbackImpl<ChromeAsyncSocket> ssl_connect_callback_; 182 net::OldCompletionCallbackImpl<ChromeAsyncSocket> ssl_connect_callback_;
183 183
184 scoped_ptr<ResolvingClientSocketFactory> client_socket_factory_; 184 scoped_ptr<ResolvingClientSocketFactory> client_socket_factory_;
185 185
186 // buzz::AsyncSocket state. 186 // buzz::AsyncSocket state.
187 buzz::AsyncSocket::State state_; 187 buzz::AsyncSocket::State state_;
188 buzz::AsyncSocket::Error error_; 188 buzz::AsyncSocket::Error error_;
189 net::Error net_error_; 189 net::Error net_error_;
190 190
191 // Used by read/write loops. 191 // Used by read/write loops.
192 ScopedRunnableMethodFactory<ChromeAsyncSocket> 192 base::WeakPtrFactory<ChromeAsyncSocket> weak_factory_;
193 scoped_runnable_method_factory_;
194 193
195 // NULL iff state() == STATE_CLOSED. 194 // NULL iff state() == STATE_CLOSED.
196 // 195 //
197 // TODO(akalin): Use ClientSocketPool. 196 // TODO(akalin): Use ClientSocketPool.
198 scoped_ptr<net::StreamSocket> transport_socket_; 197 scoped_ptr<net::StreamSocket> transport_socket_;
199 198
200 // State for the read loop. |read_start_| <= |read_end_| <= 199 // State for the read loop. |read_start_| <= |read_end_| <=
201 // |read_buf_->size()|. There's a read in flight (i.e., 200 // |read_buf_->size()|. There's a read in flight (i.e.,
202 // |read_state_| != IDLE) iff |read_end_| == 0. 201 // |read_state_| != IDLE) iff |read_end_| == 0.
203 AsyncIOState read_state_; 202 AsyncIOState read_state_;
204 scoped_refptr<net::IOBufferWithSize> read_buf_; 203 scoped_refptr<net::IOBufferWithSize> read_buf_;
205 size_t read_start_, read_end_; 204 size_t read_start_, read_end_;
206 205
207 // State for the write loop. |write_end_| <= |write_buf_->size()|. 206 // State for the write loop. |write_end_| <= |write_buf_->size()|.
208 // There's a write in flight (i.e., |write_state_| != IDLE) iff 207 // There's a write in flight (i.e., |write_state_| != IDLE) iff
209 // |write_end_| > 0. 208 // |write_end_| > 0.
210 AsyncIOState write_state_; 209 AsyncIOState write_state_;
211 scoped_refptr<net::IOBufferWithSize> write_buf_; 210 scoped_refptr<net::IOBufferWithSize> write_buf_;
212 size_t write_end_; 211 size_t write_end_;
213 212
214 DISALLOW_COPY_AND_ASSIGN(ChromeAsyncSocket); 213 DISALLOW_COPY_AND_ASSIGN(ChromeAsyncSocket);
215 }; 214 };
216 215
217 } // namespace notifier 216 } // namespace notifier
218 217
219 #endif // JINGLE_NOTIFIER_BASE_CHROME_ASYNC_SOCKET_H_ 218 #endif // JINGLE_NOTIFIER_BASE_CHROME_ASYNC_SOCKET_H_
OLDNEW
« no previous file with comments | « jingle/glue/thread_wrapper.cc ('k') | jingle/notifier/base/chrome_async_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698