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

Side by Side Diff: net/base/tcp_client_socket_libevent.h

Issue 87073: Extend the use of IOBuffers to the code underneath... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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/base/ssl_client_socket_win.cc ('k') | net/base/tcp_client_socket_libevent.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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 #ifndef NET_BASE_TCP_CLIENT_SOCKET_LIBEVENT_H_ 5 #ifndef NET_BASE_TCP_CLIENT_SOCKET_LIBEVENT_H_
6 #define NET_BASE_TCP_CLIENT_SOCKET_LIBEVENT_H_ 6 #define NET_BASE_TCP_CLIENT_SOCKET_LIBEVENT_H_
7 7
8 #include <sys/socket.h> // for struct sockaddr 8 #include <sys/socket.h> // for struct sockaddr
9 9
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 18 matching lines...) Expand all
29 29
30 // ClientSocket methods: 30 // ClientSocket methods:
31 virtual int Connect(CompletionCallback* callback); 31 virtual int Connect(CompletionCallback* callback);
32 virtual void Disconnect(); 32 virtual void Disconnect();
33 virtual bool IsConnected() const; 33 virtual bool IsConnected() const;
34 virtual bool IsConnectedAndIdle() const; 34 virtual bool IsConnectedAndIdle() const;
35 35
36 // Socket methods: 36 // Socket methods:
37 // Multiple outstanding requests are not supported. 37 // Multiple outstanding requests are not supported.
38 // Full duplex mode (reading and writing at the same time) is supported 38 // Full duplex mode (reading and writing at the same time) is supported
39 virtual int Read(char* buf, int buf_len, CompletionCallback* callback); 39 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback);
40 virtual int Write(const char* buf, int buf_len, CompletionCallback* callback); 40 virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback);
41 41
42 // Identical to posix system call of same name 42 // Identical to posix system call of same name
43 // Needed by ssl_client_socket_nss 43 // Needed by ssl_client_socket_nss
44 virtual int GetPeerName(struct sockaddr *name, socklen_t *namelen); 44 virtual int GetPeerName(struct sockaddr *name, socklen_t *namelen);
45 45
46 private: 46 private:
47 // Called by MessagePumpLibevent when the socket is ready to do I/O 47 // Called by MessagePumpLibevent when the socket is ready to do I/O
48 void OnFileCanReadWithoutBlocking(int fd); 48 void OnFileCanReadWithoutBlocking(int fd);
49 void OnFileCanWriteWithoutBlocking(int fd); 49 void OnFileCanWriteWithoutBlocking(int fd);
50 50
(...skipping 13 matching lines...) Expand all
64 // Where we are in above list, or NULL if all addrinfos have been tried. 64 // Where we are in above list, or NULL if all addrinfos have been tried.
65 const struct addrinfo* current_ai_; 65 const struct addrinfo* current_ai_;
66 66
67 // Whether we're currently waiting for connect() to complete 67 // Whether we're currently waiting for connect() to complete
68 bool waiting_connect_; 68 bool waiting_connect_;
69 69
70 // The socket's libevent wrapper 70 // The socket's libevent wrapper
71 MessageLoopForIO::FileDescriptorWatcher socket_watcher_; 71 MessageLoopForIO::FileDescriptorWatcher socket_watcher_;
72 72
73 // The buffer used by OnSocketReady to retry Read requests 73 // The buffer used by OnSocketReady to retry Read requests
74 char* read_buf_; 74 scoped_refptr<IOBuffer> read_buf_;
75 int read_buf_len_; 75 int read_buf_len_;
76 76
77 // The buffer used by OnSocketReady to retry Write requests 77 // The buffer used by OnSocketReady to retry Write requests
78 const char* write_buf_; 78 scoped_refptr<IOBuffer> write_buf_;
79 int write_buf_len_; 79 int write_buf_len_;
80 80
81 // External callback; called when read is complete. 81 // External callback; called when read is complete.
82 CompletionCallback* read_callback_; 82 CompletionCallback* read_callback_;
83 83
84 // External callback; called when write is complete. 84 // External callback; called when write is complete.
85 CompletionCallback* write_callback_; 85 CompletionCallback* write_callback_;
86 86
87 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketLibevent); 87 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketLibevent);
88 }; 88 };
89 89
90 } // namespace net 90 } // namespace net
91 91
92 #endif // NET_BASE_TCP_CLIENT_SOCKET_LIBEVENT_H_ 92 #endif // NET_BASE_TCP_CLIENT_SOCKET_LIBEVENT_H_
OLDNEW
« no previous file with comments | « net/base/ssl_client_socket_win.cc ('k') | net/base/tcp_client_socket_libevent.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698