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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 | 109 |
110 void SendInternal(const char* bytes, int len); | 110 void SendInternal(const char* bytes, int len); |
111 | 111 |
112 #if defined(OS_WIN) | 112 #if defined(OS_WIN) |
113 // ObjectWatcher delegate. | 113 // ObjectWatcher delegate. |
114 virtual void OnObjectSignaled(HANDLE object); | 114 virtual void OnObjectSignaled(HANDLE object); |
115 base::win::ObjectWatcher watcher_; | 115 base::win::ObjectWatcher watcher_; |
116 HANDLE socket_event_; | 116 HANDLE socket_event_; |
117 #elif defined(OS_POSIX) | 117 #elif defined(OS_POSIX) |
118 // Called by MessagePumpLibevent when the socket is ready to do I/O. | 118 // Called by MessagePumpLibevent when the socket is ready to do I/O. |
119 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; | 119 virtual void OnFileCanReadWithoutBlocking(int fd) override; |
120 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; | 120 virtual void OnFileCanWriteWithoutBlocking(int fd) override; |
121 WaitState wait_state_; | 121 WaitState wait_state_; |
122 // The socket's libevent wrapper. | 122 // The socket's libevent wrapper. |
123 base::MessageLoopForIO::FileDescriptorWatcher watcher_; | 123 base::MessageLoopForIO::FileDescriptorWatcher watcher_; |
124 #endif | 124 #endif |
125 | 125 |
126 // NOTE: This is for unit test use only! | 126 // NOTE: This is for unit test use only! |
127 // Pause/Resume calling Read(). Note that ResumeReads() will also call | 127 // Pause/Resume calling Read(). Note that ResumeReads() will also call |
128 // Read() if there is anything to read. | 128 // Read() if there is anything to read. |
129 void PauseReads(); | 129 void PauseReads(); |
130 void ResumeReads(); | 130 void ResumeReads(); |
(...skipping 12 matching lines...) Expand all Loading... |
143 virtual ~StreamListenSocketFactory() {} | 143 virtual ~StreamListenSocketFactory() {} |
144 | 144 |
145 // Returns a new instance of StreamListenSocket or NULL if an error occurred. | 145 // Returns a new instance of StreamListenSocket or NULL if an error occurred. |
146 virtual scoped_ptr<StreamListenSocket> CreateAndListen( | 146 virtual scoped_ptr<StreamListenSocket> CreateAndListen( |
147 StreamListenSocket::Delegate* delegate) const = 0; | 147 StreamListenSocket::Delegate* delegate) const = 0; |
148 }; | 148 }; |
149 | 149 |
150 } // namespace net | 150 } // namespace net |
151 | 151 |
152 #endif // NET_SOCKET_STREAM_LISTEN_SOCKET_H_ | 152 #endif // NET_SOCKET_STREAM_LISTEN_SOCKET_H_ |
OLD | NEW |