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

Side by Side Diff: net/base/tcp_listen_socket.h

Issue 10386048: Decouple DevTools from socket implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync Created 8 years, 7 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/base/stream_listen_socket.h ('k') | net/base/tcp_listen_socket.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_BASE_TCP_LISTEN_SOCKET_H_ 5 #ifndef NET_BASE_TCP_LISTEN_SOCKET_H_
6 #define NET_BASE_TCP_LISTEN_SOCKET_H_ 6 #define NET_BASE_TCP_LISTEN_SOCKET_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "net/base/net_export.h" 13 #include "net/base/net_export.h"
14 #include "net/base/stream_listen_socket.h" 14 #include "net/base/stream_listen_socket.h"
15 15
16 namespace net { 16 namespace net {
17 17
18 // Implements a TCP socket. Note that this is ref counted. 18 // Implements a TCP socket. Note that this is ref counted.
19 class NET_EXPORT TCPListenSocket : public StreamListenSocket { 19 class NET_EXPORT TCPListenSocket : public StreamListenSocket {
20 public: 20 public:
21 // Listen on port for the specified IP address. Use 127.0.0.1 to only 21 // Listen on port for the specified IP address. Use 127.0.0.1 to only
22 // accept local connections. 22 // accept local connections.
23 static scoped_refptr<TCPListenSocket> CreateAndListen( 23 static scoped_refptr<TCPListenSocket> CreateAndListen(
24 const std::string& ip, int port, StreamListenSocket::Delegate* del); 24 const std::string& ip, int port, StreamListenSocket::Delegate* del);
25 25
26 protected: 26 protected:
27 friend class scoped_refptr<TCPListenSocket>;
28
27 TCPListenSocket(SOCKET s, StreamListenSocket::Delegate* del); 29 TCPListenSocket(SOCKET s, StreamListenSocket::Delegate* del);
28 virtual ~TCPListenSocket(); 30 virtual ~TCPListenSocket();
29 31
30 static SOCKET CreateAndBind(const std::string& ip, int port); 32 static SOCKET CreateAndBind(const std::string& ip, int port);
31 33
32 // Implements StreamListenSocket::Accept. 34 // Implements StreamListenSocket::Accept.
33 virtual void Accept() OVERRIDE; 35 virtual void Accept() OVERRIDE;
34 36
35 private: 37 private:
36 DISALLOW_COPY_AND_ASSIGN(TCPListenSocket); 38 DISALLOW_COPY_AND_ASSIGN(TCPListenSocket);
37 }; 39 };
38 40
41 // Factory that can be used to instantiate TCPListenSocket.
42 class NET_EXPORT TCPListenSocketFactory : public StreamListenSocketFactory {
43 public:
44 TCPListenSocketFactory(const std::string& ip, int port);
45 virtual ~TCPListenSocketFactory();
46
47 // StreamListenSocketFactory overrides.
48 virtual scoped_refptr<StreamListenSocket> CreateAndListen(
49 StreamListenSocket::Delegate* delegate) const OVERRIDE;
50
51 private:
52 const std::string ip_;
53 const int port_;
54
55 DISALLOW_COPY_AND_ASSIGN(TCPListenSocketFactory);
56 };
57
39 } // namespace net 58 } // namespace net
40 59
41 #endif // NET_BASE_TCP_LISTEN_SOCKET_H_ 60 #endif // NET_BASE_TCP_LISTEN_SOCKET_H_
OLDNEW
« no previous file with comments | « net/base/stream_listen_socket.h ('k') | net/base/tcp_listen_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698