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

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

Issue 22861033: Move server socket functionality from TCPServerSocket into TCPSocket. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 4 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
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_H_ 5 #ifndef NET_SOCKET_TCP_SERVER_SOCKET_H_
6 #define NET_SOCKET_TCP_SERVER_SOCKET_H_ 6 #define NET_SOCKET_TCP_SERVER_SOCKET_H_
7 7
8 #include "build/build_config.h" 8 #include "base/basictypes.h"
9 9 #include "base/compiler_specific.h"
10 #if defined(OS_WIN) 10 #include "net/base/net_export.h"
11 #include "net/socket/tcp_server_socket_win.h" 11 #include "net/base/net_log.h"
12 #elif defined(OS_POSIX) 12 #include "net/socket/server_socket.h"
13 #include "net/socket/tcp_server_socket_libevent.h" 13 #include "net/socket/tcp_socket.h"
14 #endif
15 14
16 namespace net { 15 namespace net {
17 16
18 #if defined(OS_WIN) 17 class NET_EXPORT_PRIVATE TCPServerSocket : public ServerSocket {
19 typedef TCPServerSocketWin TCPServerSocket; 18 public:
20 #elif defined(OS_POSIX) 19 TCPServerSocket(NetLog* net_log, const NetLog::Source& source);
21 typedef TCPServerSocketLibevent TCPServerSocket; 20 virtual ~TCPServerSocket();
22 #endif 21
22 // net::ServerSocket implementation.
23 virtual int Listen(const IPEndPoint& address, int backlog) OVERRIDE;
24 virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE;
25 virtual int Accept(scoped_ptr<StreamSocket>* socket,
26 const CompletionCallback& callback) OVERRIDE;
27
28 private:
29 // Completion callback for calling TCPSocket::Accept(). It converts the output
30 // of TCPSocket::Accept() to that of TCPServerSocket::Accept().
31 void OnAcceptCompleted(scoped_ptr<TCPSocket>* tcp_socket,
32 IPEndPoint* address,
33 scoped_ptr<StreamSocket>* stream_socket,
34 const CompletionCallback& forward_callback,
35 int result);
36 TCPSocket socket_;
37
38 DISALLOW_COPY_AND_ASSIGN(TCPServerSocket);
39 };
23 40
24 } // namespace net 41 } // namespace net
25 42
26 #endif // NET_SOCKET_TCP_SERVER_SOCKET_H_ 43 #endif // NET_SOCKET_TCP_SERVER_SOCKET_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698