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

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

Issue 848006: Generalize the net module's LoadLog facility from a passive container, to an event stream (NetLog). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Split up RequestTracker into ConnectJobTracker+RequestTracker+RequestTrackerBase, address comments Created 10 years, 9 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/socket/ssl_client_socket_win.cc ('k') | net/socket/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_SOCKET_TCP_CLIENT_SOCKET_LIBEVENT_H_ 5 #ifndef NET_SOCKET_TCP_CLIENT_SOCKET_LIBEVENT_H_
6 #define NET_SOCKET_TCP_CLIENT_SOCKET_LIBEVENT_H_ 6 #define NET_SOCKET_TCP_CLIENT_SOCKET_LIBEVENT_H_
7 7
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/ref_counted.h" 9 #include "base/ref_counted.h"
10 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
11 #include "net/base/address_list.h" 11 #include "net/base/address_list.h"
12 #include "net/base/completion_callback.h" 12 #include "net/base/completion_callback.h"
13 #include "net/base/net_log.h"
13 #include "net/socket/client_socket.h" 14 #include "net/socket/client_socket.h"
14 15
15 struct event; // From libevent 16 struct event; // From libevent
16 17
17 namespace net { 18 namespace net {
18 19
19 class LoadLog; 20 class BoundNetLog;
20 21
21 // A client socket that uses TCP as the transport layer. 22 // A client socket that uses TCP as the transport layer.
22 class TCPClientSocketLibevent : public ClientSocket { 23 class TCPClientSocketLibevent : public ClientSocket {
23 public: 24 public:
24 // The IP address(es) and port number to connect to. The TCP socket will try 25 // The IP address(es) and port number to connect to. The TCP socket will try
25 // each IP address in the list until it succeeds in establishing a 26 // each IP address in the list until it succeeds in establishing a
26 // connection. 27 // connection.
27 explicit TCPClientSocketLibevent(const AddressList& addresses); 28 explicit TCPClientSocketLibevent(const AddressList& addresses);
28 29
29 virtual ~TCPClientSocketLibevent(); 30 virtual ~TCPClientSocketLibevent();
30 31
31 // ClientSocket methods: 32 // ClientSocket methods:
32 virtual int Connect(CompletionCallback* callback, LoadLog* load_log); 33 virtual int Connect(CompletionCallback* callback, const BoundNetLog& net_log);
33 virtual void Disconnect(); 34 virtual void Disconnect();
34 virtual bool IsConnected() const; 35 virtual bool IsConnected() const;
35 virtual bool IsConnectedAndIdle() const; 36 virtual bool IsConnectedAndIdle() const;
36 virtual int GetPeerAddress(AddressList* address) const; 37 virtual int GetPeerAddress(AddressList* address) const;
37 38
38 // Socket methods: 39 // Socket methods:
39 // Multiple outstanding requests are not supported. 40 // Multiple outstanding requests are not supported.
40 // Full duplex mode (reading and writing at the same time) is supported 41 // Full duplex mode (reading and writing at the same time) is supported
41 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); 42 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback);
42 virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); 43 virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback);
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // The buffer used by OnSocketReady to retry Write requests 123 // The buffer used by OnSocketReady to retry Write requests
123 scoped_refptr<IOBuffer> write_buf_; 124 scoped_refptr<IOBuffer> write_buf_;
124 int write_buf_len_; 125 int write_buf_len_;
125 126
126 // External callback; called when read is complete. 127 // External callback; called when read is complete.
127 CompletionCallback* read_callback_; 128 CompletionCallback* read_callback_;
128 129
129 // External callback; called when write is complete. 130 // External callback; called when write is complete.
130 CompletionCallback* write_callback_; 131 CompletionCallback* write_callback_;
131 132
132 scoped_refptr<LoadLog> load_log_; 133 BoundNetLog net_log_;
133 134
134 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketLibevent); 135 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketLibevent);
135 }; 136 };
136 137
137 } // namespace net 138 } // namespace net
138 139
139 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_LIBEVENT_H_ 140 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_LIBEVENT_H_
OLDNEW
« no previous file with comments | « net/socket/ssl_client_socket_win.cc ('k') | net/socket/tcp_client_socket_libevent.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698