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 #ifndef NET_UDP_UDP_SOCKET_LIBEVENT_H_ | 5 #ifndef NET_UDP_UDP_SOCKET_LIBEVENT_H_ |
6 #define NET_UDP_UDP_SOCKET_LIBEVENT_H_ | 6 #define NET_UDP_UDP_SOCKET_LIBEVENT_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 SOCKET_OPTION_BROADCAST = 1 << 1, | 172 SOCKET_OPTION_BROADCAST = 1 << 1, |
173 SOCKET_OPTION_MULTICAST_LOOP = 1 << 2 | 173 SOCKET_OPTION_MULTICAST_LOOP = 1 << 2 |
174 }; | 174 }; |
175 | 175 |
176 class ReadWatcher : public base::MessageLoopForIO::Watcher { | 176 class ReadWatcher : public base::MessageLoopForIO::Watcher { |
177 public: | 177 public: |
178 explicit ReadWatcher(UDPSocketLibevent* socket) : socket_(socket) {} | 178 explicit ReadWatcher(UDPSocketLibevent* socket) : socket_(socket) {} |
179 | 179 |
180 // MessageLoopForIO::Watcher methods | 180 // MessageLoopForIO::Watcher methods |
181 | 181 |
182 virtual void OnFileCanReadWithoutBlocking(int /* fd */) OVERRIDE; | 182 virtual void OnFileCanReadWithoutBlocking(int /* fd */) override; |
183 | 183 |
184 virtual void OnFileCanWriteWithoutBlocking(int /* fd */) OVERRIDE {} | 184 virtual void OnFileCanWriteWithoutBlocking(int /* fd */) override {} |
185 | 185 |
186 private: | 186 private: |
187 UDPSocketLibevent* const socket_; | 187 UDPSocketLibevent* const socket_; |
188 | 188 |
189 DISALLOW_COPY_AND_ASSIGN(ReadWatcher); | 189 DISALLOW_COPY_AND_ASSIGN(ReadWatcher); |
190 }; | 190 }; |
191 | 191 |
192 class WriteWatcher : public base::MessageLoopForIO::Watcher { | 192 class WriteWatcher : public base::MessageLoopForIO::Watcher { |
193 public: | 193 public: |
194 explicit WriteWatcher(UDPSocketLibevent* socket) : socket_(socket) {} | 194 explicit WriteWatcher(UDPSocketLibevent* socket) : socket_(socket) {} |
195 | 195 |
196 // MessageLoopForIO::Watcher methods | 196 // MessageLoopForIO::Watcher methods |
197 | 197 |
198 virtual void OnFileCanReadWithoutBlocking(int /* fd */) OVERRIDE {} | 198 virtual void OnFileCanReadWithoutBlocking(int /* fd */) override {} |
199 | 199 |
200 virtual void OnFileCanWriteWithoutBlocking(int /* fd */) OVERRIDE; | 200 virtual void OnFileCanWriteWithoutBlocking(int /* fd */) override; |
201 | 201 |
202 private: | 202 private: |
203 UDPSocketLibevent* const socket_; | 203 UDPSocketLibevent* const socket_; |
204 | 204 |
205 DISALLOW_COPY_AND_ASSIGN(WriteWatcher); | 205 DISALLOW_COPY_AND_ASSIGN(WriteWatcher); |
206 }; | 206 }; |
207 | 207 |
208 void DoReadCallback(int rv); | 208 void DoReadCallback(int rv); |
209 void DoWriteCallback(int rv); | 209 void DoWriteCallback(int rv); |
210 void DidCompleteRead(); | 210 void DidCompleteRead(); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 CompletionCallback write_callback_; | 291 CompletionCallback write_callback_; |
292 | 292 |
293 BoundNetLog net_log_; | 293 BoundNetLog net_log_; |
294 | 294 |
295 DISALLOW_COPY_AND_ASSIGN(UDPSocketLibevent); | 295 DISALLOW_COPY_AND_ASSIGN(UDPSocketLibevent); |
296 }; | 296 }; |
297 | 297 |
298 } // namespace net | 298 } // namespace net |
299 | 299 |
300 #endif // NET_UDP_UDP_SOCKET_LIBEVENT_H_ | 300 #endif // NET_UDP_UDP_SOCKET_LIBEVENT_H_ |
OLD | NEW |