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

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

Issue 344026: Add LoadLog to ClientSocket::Connect(). (Closed)
Patch Set: Minor build fixups and fixed mac bug. Created 11 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
« no previous file with comments | « net/socket/tcp_client_socket_unittest.cc ('k') | net/socket/tcp_client_socket_win.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_WIN_H_ 5 #ifndef NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_
6 #define NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ 6 #define NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_
7 7
8 #include <ws2tcpip.h> 8 #include <ws2tcpip.h>
9 9
10 #include "base/object_watcher.h" 10 #include "base/object_watcher.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/socket/client_socket.h" 13 #include "net/socket/client_socket.h"
14 14
15 namespace net { 15 namespace net {
16 16
17 class LoadLog;
18
17 class TCPClientSocketWin : public ClientSocket { 19 class TCPClientSocketWin : public ClientSocket {
18 public: 20 public:
19 // The IP address(es) and port number to connect to. The TCP socket will try 21 // The IP address(es) and port number to connect to. The TCP socket will try
20 // each IP address in the list until it succeeds in establishing a 22 // each IP address in the list until it succeeds in establishing a
21 // connection. 23 // connection.
22 explicit TCPClientSocketWin(const AddressList& addresses); 24 explicit TCPClientSocketWin(const AddressList& addresses);
23 25
24 ~TCPClientSocketWin(); 26 ~TCPClientSocketWin();
25 27
26 // ClientSocket methods: 28 // ClientSocket methods:
27 virtual int Connect(CompletionCallback* callback); 29 virtual int Connect(CompletionCallback* callback, LoadLog* load_log);
28 virtual void Disconnect(); 30 virtual void Disconnect();
29 virtual bool IsConnected() const; 31 virtual bool IsConnected() const;
30 virtual bool IsConnectedAndIdle() const; 32 virtual bool IsConnectedAndIdle() const;
31 33
32 // Socket methods: 34 // Socket methods:
33 // Multiple outstanding requests are not supported. 35 // Multiple outstanding requests are not supported.
34 // Full duplex mode (reading and writing at the same time) is supported 36 // Full duplex mode (reading and writing at the same time) is supported
35 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); 37 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback);
36 virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback); 38 virtual int Write(IOBuffer* buf, int buf_len, CompletionCallback* callback);
37 39
38 virtual bool SetReceiveBufferSize(int32 size); 40 virtual bool SetReceiveBufferSize(int32 size);
39 virtual bool SetSendBufferSize(int32 size); 41 virtual bool SetSendBufferSize(int32 size);
40 42
41 private: 43 private:
42 class Core; 44 class Core;
43 45
46 // Performs the actual connect(). Returns a net error code.
47 int DoConnect();
48
44 int CreateSocket(const struct addrinfo* ai); 49 int CreateSocket(const struct addrinfo* ai);
45 void DoReadCallback(int rv); 50 void DoReadCallback(int rv);
46 void DoWriteCallback(int rv); 51 void DoWriteCallback(int rv);
47 void DidCompleteConnect(); 52 void DidCompleteConnect();
48 void DidCompleteRead(); 53 void DidCompleteRead();
49 void DidCompleteWrite(); 54 void DidCompleteWrite();
50 55
51 SOCKET socket_; 56 SOCKET socket_;
52 57
53 // The list of addresses we should try in order to establish a connection. 58 // The list of addresses we should try in order to establish a connection.
(...skipping 11 matching lines...) Expand all
65 // resources to the Windows async IO functions and we have to make sure that 70 // resources to the Windows async IO functions and we have to make sure that
66 // they are not destroyed while the OS still references them. 71 // they are not destroyed while the OS still references them.
67 scoped_refptr<Core> core_; 72 scoped_refptr<Core> core_;
68 73
69 // External callback; called when connect or read is complete. 74 // External callback; called when connect or read is complete.
70 CompletionCallback* read_callback_; 75 CompletionCallback* read_callback_;
71 76
72 // External callback; called when write is complete. 77 // External callback; called when write is complete.
73 CompletionCallback* write_callback_; 78 CompletionCallback* write_callback_;
74 79
80 scoped_refptr<LoadLog> load_log_;
81
75 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketWin); 82 DISALLOW_COPY_AND_ASSIGN(TCPClientSocketWin);
76 }; 83 };
77 84
78 } // namespace net 85 } // namespace net
79 86
80 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_ 87 #endif // NET_SOCKET_TCP_CLIENT_SOCKET_WIN_H_
OLDNEW
« no previous file with comments | « net/socket/tcp_client_socket_unittest.cc ('k') | net/socket/tcp_client_socket_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698