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 // TCP/IP server that handles IO asynchronously in the specified MessageLoop. | 5 // TCP/IP server that handles IO asynchronously in the specified MessageLoop. |
6 // These objects are NOT thread safe. They use WSAEVENT handles to monitor | 6 // These objects are NOT thread safe. They use WSAEVENT handles to monitor |
7 // activity in a given MessageLoop. This means that callbacks will | 7 // activity in a given MessageLoop. This means that callbacks will |
8 // happen in that loop's thread always and that all other methods (including | 8 // happen in that loop's thread always and that all other methods (including |
9 // constructors and destructors) should also be called from the same thread. | 9 // constructors and destructors) should also be called from the same thread. |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 #elif defined(OS_POSIX) | 23 #elif defined(OS_POSIX) |
24 #include "base/message_loop.h" | 24 #include "base/message_loop.h" |
25 #endif | 25 #endif |
26 | 26 |
27 #include "base/basictypes.h" | 27 #include "base/basictypes.h" |
28 #include "base/compiler_specific.h" | 28 #include "base/compiler_specific.h" |
29 #include "base/memory/ref_counted.h" | 29 #include "base/memory/ref_counted.h" |
30 #include "net/base/net_api.h" | 30 #include "net/base/net_api.h" |
31 | 31 |
32 #if defined(OS_POSIX) | 32 #if defined(OS_POSIX) |
33 struct event; // From libevent | |
34 typedef int SOCKET; | 33 typedef int SOCKET; |
35 #endif | 34 #endif |
36 | 35 |
37 // Implements a raw socket interface | 36 // Implements a raw socket interface |
38 class NET_API ListenSocket : public base::RefCountedThreadSafe<ListenSocket>, | 37 class NET_API ListenSocket : public base::RefCountedThreadSafe<ListenSocket>, |
39 #if defined(OS_WIN) | 38 #if defined(OS_WIN) |
40 public base::win::ObjectWatcher::Delegate { | 39 public base::win::ObjectWatcher::Delegate { |
41 #elif defined(OS_POSIX) | 40 #elif defined(OS_POSIX) |
42 public MessageLoopForIO::Watcher { | 41 public MessageLoopForIO::Watcher { |
43 #endif | 42 #endif |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 ListenSocketDelegate *socket_delegate_; | 123 ListenSocketDelegate *socket_delegate_; |
125 | 124 |
126 private: | 125 private: |
127 bool reads_paused_; | 126 bool reads_paused_; |
128 bool has_pending_reads_; | 127 bool has_pending_reads_; |
129 | 128 |
130 DISALLOW_COPY_AND_ASSIGN(ListenSocket); | 129 DISALLOW_COPY_AND_ASSIGN(ListenSocket); |
131 }; | 130 }; |
132 | 131 |
133 #endif // NET_BASE_LISTEN_SOCKET_H_ | 132 #endif // NET_BASE_LISTEN_SOCKET_H_ |
OLD | NEW |