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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
120 // The socket's libevent wrapper. | 120 // The socket's libevent wrapper. |
121 base::MessageLoopForIO::FileDescriptorWatcher watcher_; | 121 base::MessageLoopForIO::FileDescriptorWatcher watcher_; |
122 #endif | 122 #endif |
123 | 123 |
124 // NOTE: This is for unit test use only! | 124 // NOTE: This is for unit test use only! |
125 // Pause/Resume calling Read(). Note that ResumeReads() will also call | 125 // Pause/Resume calling Read(). Note that ResumeReads() will also call |
126 // Read() if there is anything to read. | 126 // Read() if there is anything to read. |
127 void PauseReads(); | 127 void PauseReads(); |
128 void ResumeReads(); | 128 void ResumeReads(); |
129 | 129 |
130 // For testing use only! | |
131 virtual int GetLocalAddressImpl(IPEndPoint* address); | |
jar (doing other things)
2014/06/09 23:13:40
Should this be in the protected section?
nit: con
Ken Russell (switch to Gerrit)
2014/06/09 23:32:12
Thanks for catching that. I don't know why it comp
| |
132 | |
130 const SocketDescriptor socket_; | 133 const SocketDescriptor socket_; |
131 bool reads_paused_; | 134 bool reads_paused_; |
132 bool has_pending_reads_; | 135 bool has_pending_reads_; |
133 | 136 |
134 DISALLOW_COPY_AND_ASSIGN(StreamListenSocket); | 137 DISALLOW_COPY_AND_ASSIGN(StreamListenSocket); |
135 }; | 138 }; |
136 | 139 |
137 // Abstract factory that must be subclassed for each subclass of | 140 // Abstract factory that must be subclassed for each subclass of |
138 // StreamListenSocket. | 141 // StreamListenSocket. |
139 class NET_EXPORT StreamListenSocketFactory { | 142 class NET_EXPORT StreamListenSocketFactory { |
140 public: | 143 public: |
141 virtual ~StreamListenSocketFactory() {} | 144 virtual ~StreamListenSocketFactory() {} |
142 | 145 |
143 // Returns a new instance of StreamListenSocket or NULL if an error occurred. | 146 // Returns a new instance of StreamListenSocket or NULL if an error occurred. |
144 virtual scoped_ptr<StreamListenSocket> CreateAndListen( | 147 virtual scoped_ptr<StreamListenSocket> CreateAndListen( |
145 StreamListenSocket::Delegate* delegate) const = 0; | 148 StreamListenSocket::Delegate* delegate) const = 0; |
146 }; | 149 }; |
147 | 150 |
148 } // namespace net | 151 } // namespace net |
149 | 152 |
150 #endif // NET_SOCKET_STREAM_LISTEN_SOCKET_H_ | 153 #endif // NET_SOCKET_STREAM_LISTEN_SOCKET_H_ |
OLD | NEW |