| OLD | NEW |
| 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 // Stream-based listen socket implementation that handles reading and writing | 5 // Stream-based listen socket implementation that handles reading and writing |
| 6 // to the socket, but does not handle creating the socket nor connecting | 6 // to the socket, but does not handle creating the socket nor connecting |
| 7 // sockets, which are handled by subclasses on creation and in Accept, | 7 // sockets, which are handled by subclasses on creation and in Accept, |
| 8 // respectively. | 8 // respectively. |
| 9 | 9 |
| 10 // StreamListenSocket handles IO asynchronously in the specified MessageLoop. | 10 // StreamListenSocket handles IO asynchronously in the specified MessageLoop. |
| 11 // This class is NOT thread safe. It uses WSAEVENT handles to monitor activity | 11 // This class is NOT thread safe. It uses WSAEVENT handles to monitor activity |
| 12 // in a given MessageLoop. This means that callbacks will happen in that loop's | 12 // in a given MessageLoop. This means that callbacks will happen in that loop's |
| 13 // thread always and that all other methods (including constructor and | 13 // thread always and that all other methods (including constructor and |
| 14 // destructor) should also be called from the same thread. | 14 // destructor) should also be called from the same thread. |
| 15 | 15 |
| 16 #ifndef NET_BASE_STREAM_LISTEN_SOCKET_H_ | 16 #ifndef NET_SOCKET_STREAM_LISTEN_SOCKET_H_ |
| 17 #define NET_BASE_STREAM_LISTEN_SOCKET_H_ | 17 #define NET_SOCKET_STREAM_LISTEN_SOCKET_H_ |
| 18 | 18 |
| 19 #include "build/build_config.h" | 19 #include "build/build_config.h" |
| 20 | 20 |
| 21 #if defined(OS_WIN) | 21 #if defined(OS_WIN) |
| 22 #include <winsock2.h> | 22 #include <winsock2.h> |
| 23 #endif | 23 #endif |
| 24 #include <string> | 24 #include <string> |
| 25 #if defined(OS_WIN) | 25 #if defined(OS_WIN) |
| 26 #include "base/win/object_watcher.h" | 26 #include "base/win/object_watcher.h" |
| 27 #elif defined(OS_POSIX) | 27 #elif defined(OS_POSIX) |
| 28 #include "base/message_loop.h" | 28 #include "base/message_loop.h" |
| 29 #endif | 29 #endif |
| 30 | 30 |
| 31 #include "base/basictypes.h" | 31 #include "base/basictypes.h" |
| 32 #include "base/compiler_specific.h" | 32 #include "base/compiler_specific.h" |
| 33 #include "net/base/net_export.h" | 33 #include "net/base/net_export.h" |
| 34 #include "net/base/stream_listen_socket.h" | 34 #include "net/socket/stream_listen_socket.h" |
| 35 | 35 |
| 36 #if defined(OS_POSIX) | 36 #if defined(OS_POSIX) |
| 37 typedef int SocketDescriptor; | 37 typedef int SocketDescriptor; |
| 38 #else | 38 #else |
| 39 typedef SOCKET SocketDescriptor; | 39 typedef SOCKET SocketDescriptor; |
| 40 #endif | 40 #endif |
| 41 | 41 |
| 42 namespace net { | 42 namespace net { |
| 43 | 43 |
| 44 class IPEndPoint; | 44 class IPEndPoint; |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 public: | 145 public: |
| 146 virtual ~StreamListenSocketFactory() {} | 146 virtual ~StreamListenSocketFactory() {} |
| 147 | 147 |
| 148 // Returns a new instance of StreamListenSocket or NULL if an error occurred. | 148 // Returns a new instance of StreamListenSocket or NULL if an error occurred. |
| 149 virtual scoped_refptr<StreamListenSocket> CreateAndListen( | 149 virtual scoped_refptr<StreamListenSocket> CreateAndListen( |
| 150 StreamListenSocket::Delegate* delegate) const = 0; | 150 StreamListenSocket::Delegate* delegate) const = 0; |
| 151 }; | 151 }; |
| 152 | 152 |
| 153 } // namespace net | 153 } // namespace net |
| 154 | 154 |
| 155 #endif // NET_BASE_STREAM_LISTEN_SOCKET_H_ | 155 #endif // NET_SOCKET_STREAM_LISTEN_SOCKET_H_ |
| OLD | NEW |