OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef NET_SOCKET_TCP_SERVER_SOCKET_LIBEVENT_H_ | |
6 #define NET_SOCKET_TCP_SERVER_SOCKET_LIBEVENT_H_ | |
7 | |
8 #include "base/message_loop.h" | |
9 #include "base/scoped_ptr.h" | |
10 #include "base/threading/non_thread_safe.h" | |
11 #include "net/base/net_log.h" | |
12 #include "net/socket/server_socket.h" | |
13 | |
14 namespace net { | |
15 | |
16 class IPEndPoint; | |
17 | |
18 class TCPServerSocketLibevent : public ServerSocket, | |
19 public base::NonThreadSafe, | |
20 public MessageLoopForIO::Watcher { | |
21 public: | |
22 TCPServerSocketLibevent(net::NetLog* net_log, | |
23 const net::NetLog::Source& source); | |
24 ~TCPServerSocketLibevent(); | |
25 | |
26 // net::ServerSocket implementation. | |
27 virtual int Listen(const net::IPEndPoint& address, int backlog); | |
28 virtual int GetLocalAddress(IPEndPoint* address) const; | |
29 virtual int Accept(scoped_ptr<ClientSocket>* socket, | |
30 CompletionCallback* callback); | |
willchan no longer on Chromium
2011/04/18 18:07:17
You should include net/base/completion_callback.h
Sergey Ulanov
2011/04/18 19:40:28
Done.
| |
31 | |
32 // MessageLoopForIO::Watcher implementation. | |
33 virtual void OnFileCanReadWithoutBlocking(int fd); | |
34 virtual void OnFileCanWriteWithoutBlocking(int fd); | |
35 | |
36 private: | |
37 int AcceptInternal(scoped_ptr<ClientSocket>* socket); | |
38 void Close(); | |
39 | |
40 int socket_; | |
41 | |
42 MessageLoopForIO::FileDescriptorWatcher accept_socket_watcher_; | |
43 | |
44 scoped_ptr<ClientSocket>* accept_socket_; | |
45 CompletionCallback* accept_callback_; | |
46 | |
47 BoundNetLog net_log_; | |
48 }; | |
49 | |
50 } // namespace net | |
51 | |
52 #endif // NET_SOCKET_TCP_SERVER_SOCKET_LIBEVENT_H_ | |
OLD | NEW |