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

Side by Side Diff: net/socket/client_socket.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/proxy/single_threaded_proxy_resolver_unittest.cc ('k') | net/socket/client_socket_handle.h » ('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_CLIENT_SOCKET_H_ 5 #ifndef NET_SOCKET_CLIENT_SOCKET_H_
6 #define NET_SOCKET_CLIENT_SOCKET_H_ 6 #define NET_SOCKET_CLIENT_SOCKET_H_
7 7
8 #include "net/socket/socket.h" 8 #include "net/socket/socket.h"
9 9
10 namespace net { 10 namespace net {
11 11
12 class AddressList; 12 class AddressList;
13 class LoadLog; 13 class BoundNetLog;
14 14
15 class ClientSocket : public Socket { 15 class ClientSocket : public Socket {
16 public: 16 public:
17 // Called to establish a connection. Returns OK if the connection could be 17 // Called to establish a connection. Returns OK if the connection could be
18 // established synchronously. Otherwise, ERR_IO_PENDING is returned and the 18 // established synchronously. Otherwise, ERR_IO_PENDING is returned and the
19 // given callback will run asynchronously when the connection is established 19 // given callback will run asynchronously when the connection is established
20 // or when an error occurs. The result is some other error code if the 20 // or when an error occurs. The result is some other error code if the
21 // connection could not be established. 21 // connection could not be established.
22 // 22 //
23 // The socket's Read and Write methods may not be called until Connect 23 // The socket's Read and Write methods may not be called until Connect
24 // succeeds. 24 // succeeds.
25 // 25 //
26 // It is valid to call Connect on an already connected socket, in which case 26 // It is valid to call Connect on an already connected socket, in which case
27 // OK is simply returned. 27 // OK is simply returned.
28 // 28 //
29 // Connect may also be called again after a call to the Disconnect method. 29 // Connect may also be called again after a call to the Disconnect method.
30 // 30 //
31 virtual int Connect(CompletionCallback* callback, LoadLog* load_log) = 0; 31 virtual int Connect(CompletionCallback* callback,
32 const BoundNetLog& net_log) = 0;
32 33
33 // Called to disconnect a socket. Does nothing if the socket is already 34 // Called to disconnect a socket. Does nothing if the socket is already
34 // disconnected. After calling Disconnect it is possible to call Connect 35 // disconnected. After calling Disconnect it is possible to call Connect
35 // again to establish a new connection. 36 // again to establish a new connection.
36 // 37 //
37 // If IO (Connect, Read, or Write) is pending when the socket is 38 // If IO (Connect, Read, or Write) is pending when the socket is
38 // disconnected, the pending IO is cancelled, and the completion callback 39 // disconnected, the pending IO is cancelled, and the completion callback
39 // will not be called. 40 // will not be called.
40 virtual void Disconnect() = 0; 41 virtual void Disconnect() = 0;
41 42
42 // Called to test if the connection is still alive. Returns false if a 43 // Called to test if the connection is still alive. Returns false if a
43 // connection wasn't established or the connection is dead. 44 // connection wasn't established or the connection is dead.
44 virtual bool IsConnected() const = 0; 45 virtual bool IsConnected() const = 0;
45 46
46 // Called to test if the connection is still alive and idle. Returns false 47 // Called to test if the connection is still alive and idle. Returns false
47 // if a connection wasn't established, the connection is dead, or some data 48 // if a connection wasn't established, the connection is dead, or some data
48 // have been received. 49 // have been received.
49 virtual bool IsConnectedAndIdle() const = 0; 50 virtual bool IsConnectedAndIdle() const = 0;
50 51
51 // Copies the peer address to |address| and returns a network error code. 52 // Copies the peer address to |address| and returns a network error code.
52 virtual int GetPeerAddress(AddressList* address) const = 0; 53 virtual int GetPeerAddress(AddressList* address) const = 0;
53 }; 54 };
54 55
55 } // namespace net 56 } // namespace net
56 57
57 #endif // NET_SOCKET_CLIENT_SOCKET_H_ 58 #endif // NET_SOCKET_CLIENT_SOCKET_H_
OLDNEW
« no previous file with comments | « net/proxy/single_threaded_proxy_resolver_unittest.cc ('k') | net/socket/client_socket_handle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698