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

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

Issue 8771030: base::Bind: Convert ServerSocket::Accept. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Test logic fix. Created 9 years 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/tcp_server_socket_unittest.cc ('k') | net/socket/tcp_server_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) 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 #ifndef NET_SOCKET_TCP_SERVER_SOCKET_WIN_H_ 5 #ifndef NET_SOCKET_TCP_SERVER_SOCKET_WIN_H_
6 #define NET_SOCKET_TCP_SERVER_SOCKET_WIN_H_ 6 #define NET_SOCKET_TCP_SERVER_SOCKET_WIN_H_
7 7
8 #include <winsock2.h> 8 #include <winsock2.h>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/win/object_watcher.h" 12 #include "base/win/object_watcher.h"
13 #include "base/threading/non_thread_safe.h" 13 #include "base/threading/non_thread_safe.h"
14 #include "net/base/completion_callback.h"
14 #include "net/base/net_log.h" 15 #include "net/base/net_log.h"
15 #include "net/socket/server_socket.h" 16 #include "net/socket/server_socket.h"
16 17
17 namespace net { 18 namespace net {
18 19
19 class IPEndPoint; 20 class IPEndPoint;
20 21
21 class NET_EXPORT_PRIVATE TCPServerSocketWin 22 class NET_EXPORT_PRIVATE TCPServerSocketWin
22 : public ServerSocket, 23 : public ServerSocket,
23 NON_EXPORTED_BASE(public base::NonThreadSafe), 24 NON_EXPORTED_BASE(public base::NonThreadSafe),
24 public base::win::ObjectWatcher::Delegate { 25 public base::win::ObjectWatcher::Delegate {
25 public: 26 public:
26 TCPServerSocketWin(net::NetLog* net_log, 27 TCPServerSocketWin(net::NetLog* net_log,
27 const net::NetLog::Source& source); 28 const net::NetLog::Source& source);
28 ~TCPServerSocketWin(); 29 ~TCPServerSocketWin();
29 30
30 // net::ServerSocket implementation. 31 // net::ServerSocket implementation.
31 virtual int Listen(const net::IPEndPoint& address, int backlog); 32 virtual int Listen(const net::IPEndPoint& address, int backlog);
32 virtual int GetLocalAddress(IPEndPoint* address) const; 33 virtual int GetLocalAddress(IPEndPoint* address) const;
33 virtual int Accept(scoped_ptr<StreamSocket>* socket, 34 virtual int Accept(scoped_ptr<StreamSocket>* socket,
34 OldCompletionCallback* callback); 35 const CompletionCallback& callback);
35 36
36 // base::ObjectWatcher::Delegate implementation. 37 // base::ObjectWatcher::Delegate implementation.
37 virtual void OnObjectSignaled(HANDLE object); 38 virtual void OnObjectSignaled(HANDLE object);
38 39
39 private: 40 private:
40 int AcceptInternal(scoped_ptr<StreamSocket>* socket); 41 int AcceptInternal(scoped_ptr<StreamSocket>* socket);
41 void Close(); 42 void Close();
42 43
43 SOCKET socket_; 44 SOCKET socket_;
44 HANDLE socket_event_; 45 HANDLE socket_event_;
45 46
46 base::win::ObjectWatcher accept_watcher_; 47 base::win::ObjectWatcher accept_watcher_;
47 48
48 scoped_ptr<StreamSocket>* accept_socket_; 49 scoped_ptr<StreamSocket>* accept_socket_;
49 OldCompletionCallback* accept_callback_; 50 CompletionCallback accept_callback_;
50 51
51 BoundNetLog net_log_; 52 BoundNetLog net_log_;
52 }; 53 };
53 54
54 } // namespace net 55 } // namespace net
55 56
56 #endif // NET_SOCKET_TCP_SERVER_SOCKET_WIN_H_ 57 #endif // NET_SOCKET_TCP_SERVER_SOCKET_WIN_H_
OLDNEW
« no previous file with comments | « net/socket/tcp_server_socket_unittest.cc ('k') | net/socket/tcp_server_socket_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698