OLD | NEW |
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_LIBEVENT_H_ | 5 #ifndef NET_SOCKET_TCP_SERVER_SOCKET_LIBEVENT_H_ |
6 #define NET_SOCKET_TCP_SERVER_SOCKET_LIBEVENT_H_ | 6 #define NET_SOCKET_TCP_SERVER_SOCKET_LIBEVENT_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/threading/non_thread_safe.h" | 10 #include "base/threading/non_thread_safe.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 public MessageLoopForIO::Watcher { | 22 public MessageLoopForIO::Watcher { |
23 public: | 23 public: |
24 TCPServerSocketLibevent(net::NetLog* net_log, | 24 TCPServerSocketLibevent(net::NetLog* net_log, |
25 const net::NetLog::Source& source); | 25 const net::NetLog::Source& source); |
26 virtual ~TCPServerSocketLibevent(); | 26 virtual ~TCPServerSocketLibevent(); |
27 | 27 |
28 // net::ServerSocket implementation. | 28 // net::ServerSocket implementation. |
29 virtual int Listen(const net::IPEndPoint& address, int backlog) OVERRIDE; | 29 virtual int Listen(const net::IPEndPoint& address, int backlog) OVERRIDE; |
30 virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; | 30 virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; |
31 virtual int Accept(scoped_ptr<StreamSocket>* socket, | 31 virtual int Accept(scoped_ptr<StreamSocket>* socket, |
32 OldCompletionCallback* callback) OVERRIDE; | 32 const CompletionCallback& callback) OVERRIDE; |
33 | 33 |
34 // MessageLoopForIO::Watcher implementation. | 34 // MessageLoopForIO::Watcher implementation. |
35 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; | 35 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; |
36 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; | 36 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; |
37 | 37 |
38 private: | 38 private: |
39 int AcceptInternal(scoped_ptr<StreamSocket>* socket); | 39 int AcceptInternal(scoped_ptr<StreamSocket>* socket); |
40 void Close(); | 40 void Close(); |
41 | 41 |
42 int socket_; | 42 int socket_; |
43 | 43 |
44 MessageLoopForIO::FileDescriptorWatcher accept_socket_watcher_; | 44 MessageLoopForIO::FileDescriptorWatcher accept_socket_watcher_; |
45 | 45 |
46 scoped_ptr<StreamSocket>* accept_socket_; | 46 scoped_ptr<StreamSocket>* accept_socket_; |
47 OldCompletionCallback* accept_callback_; | 47 CompletionCallback accept_callback_; |
48 | 48 |
49 BoundNetLog net_log_; | 49 BoundNetLog net_log_; |
50 }; | 50 }; |
51 | 51 |
52 } // namespace net | 52 } // namespace net |
53 | 53 |
54 #endif // NET_SOCKET_TCP_SERVER_SOCKET_LIBEVENT_H_ | 54 #endif // NET_SOCKET_TCP_SERVER_SOCKET_LIBEVENT_H_ |
OLD | NEW |