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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
93 void Listen(); | 93 void Listen(); |
94 void Read(); | 94 void Read(); |
95 void Close(); | 95 void Close(); |
96 void CloseSocket(); | 96 void CloseSocket(); |
97 | 97 |
98 // Pass any value in case of Windows, because in Windows | 98 // Pass any value in case of Windows, because in Windows |
99 // we are not using state. | 99 // we are not using state. |
100 void WatchSocket(WaitState state); | 100 void WatchSocket(WaitState state); |
101 void UnwatchSocket(); | 101 void UnwatchSocket(); |
102 | 102 |
103 // For testing use only! | |
104 virtual int GetLocalAddressImpl(IPEndPoint* address); | |
wtc
2014/06/10 17:46:44
Nit: please document how GetLocalAddressImpl diffe
wtc
2014/06/10 17:48:28
Just to clarify: if you keep GetLocalAddressImpl,
Ken Russell (switch to Gerrit)
2014/06/10 18:57:07
Thanks for the suggestion. That's fine with me, an
| |
105 | |
103 Delegate* const socket_delegate_; | 106 Delegate* const socket_delegate_; |
104 | 107 |
105 private: | 108 private: |
106 friend class TransportClientSocketTest; | 109 friend class TransportClientSocketTest; |
107 | 110 |
108 void SendInternal(const char* bytes, int len); | 111 void SendInternal(const char* bytes, int len); |
109 | 112 |
110 #if defined(OS_WIN) | 113 #if defined(OS_WIN) |
111 // ObjectWatcher delegate. | 114 // ObjectWatcher delegate. |
112 virtual void OnObjectSignaled(HANDLE object); | 115 virtual void OnObjectSignaled(HANDLE object); |
(...skipping 28 matching lines...) Expand all Loading... | |
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 |