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. |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 void PauseReads(); | 125 void PauseReads(); |
126 void ResumeReads(); | 126 void ResumeReads(); |
127 | 127 |
128 const SOCKET socket_; | 128 const SOCKET socket_; |
129 bool reads_paused_; | 129 bool reads_paused_; |
130 bool has_pending_reads_; | 130 bool has_pending_reads_; |
131 | 131 |
132 DISALLOW_COPY_AND_ASSIGN(StreamListenSocket); | 132 DISALLOW_COPY_AND_ASSIGN(StreamListenSocket); |
133 }; | 133 }; |
134 | 134 |
| 135 // Abstract factory that must be subclassed for each subclass of |
| 136 // StreamListenSocket. |
| 137 class StreamListenSocketFactory { |
| 138 public: |
| 139 virtual ~StreamListenSocketFactory() {} |
| 140 |
| 141 // Returns a new instance of StreamListenSocket or NULL if an error occurred. |
| 142 virtual scoped_refptr<StreamListenSocket> CreateAndListen( |
| 143 StreamListenSocket::Delegate* delegate) = 0; |
| 144 }; |
| 145 |
135 } // namespace net | 146 } // namespace net |
136 | 147 |
137 #endif // NET_BASE_STREAM_LISTEN_SOCKET_H_ | 148 #endif // NET_BASE_STREAM_LISTEN_SOCKET_H_ |
OLD | NEW |