| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 106 |
| 107 private: | 107 private: |
| 108 static const int kInvalidSocket = -1; | 108 static const int kInvalidSocket = -1; |
| 109 | 109 |
| 110 class ReadWatcher : public MessageLoopForIO::Watcher { | 110 class ReadWatcher : public MessageLoopForIO::Watcher { |
| 111 public: | 111 public: |
| 112 explicit ReadWatcher(UDPSocketLibevent* socket) : socket_(socket) {} | 112 explicit ReadWatcher(UDPSocketLibevent* socket) : socket_(socket) {} |
| 113 | 113 |
| 114 // MessageLoopForIO::Watcher methods | 114 // MessageLoopForIO::Watcher methods |
| 115 | 115 |
| 116 virtual void OnFileCanReadWithoutBlocking(int /* fd */) { | 116 virtual void OnFileCanReadWithoutBlocking(int /* fd */) OVERRIDE { |
| 117 if (socket_->read_callback_) | 117 if (socket_->read_callback_) |
| 118 socket_->DidCompleteRead(); | 118 socket_->DidCompleteRead(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 virtual void OnFileCanWriteWithoutBlocking(int /* fd */) {} | 121 virtual void OnFileCanWriteWithoutBlocking(int /* fd */) OVERRIDE {} |
| 122 | 122 |
| 123 private: | 123 private: |
| 124 UDPSocketLibevent* const socket_; | 124 UDPSocketLibevent* const socket_; |
| 125 | 125 |
| 126 DISALLOW_COPY_AND_ASSIGN(ReadWatcher); | 126 DISALLOW_COPY_AND_ASSIGN(ReadWatcher); |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 class WriteWatcher : public MessageLoopForIO::Watcher { | 129 class WriteWatcher : public MessageLoopForIO::Watcher { |
| 130 public: | 130 public: |
| 131 explicit WriteWatcher(UDPSocketLibevent* socket) : socket_(socket) {} | 131 explicit WriteWatcher(UDPSocketLibevent* socket) : socket_(socket) {} |
| 132 | 132 |
| 133 // MessageLoopForIO::Watcher methods | 133 // MessageLoopForIO::Watcher methods |
| 134 | 134 |
| 135 virtual void OnFileCanReadWithoutBlocking(int /* fd */) {} | 135 virtual void OnFileCanReadWithoutBlocking(int /* fd */) OVERRIDE {} |
| 136 | 136 |
| 137 virtual void OnFileCanWriteWithoutBlocking(int /* fd */) { | 137 virtual void OnFileCanWriteWithoutBlocking(int /* fd */) OVERRIDE { |
| 138 if (socket_->write_callback_) | 138 if (socket_->write_callback_) |
| 139 socket_->DidCompleteWrite(); | 139 socket_->DidCompleteWrite(); |
| 140 } | 140 } |
| 141 | 141 |
| 142 private: | 142 private: |
| 143 UDPSocketLibevent* const socket_; | 143 UDPSocketLibevent* const socket_; |
| 144 | 144 |
| 145 DISALLOW_COPY_AND_ASSIGN(WriteWatcher); | 145 DISALLOW_COPY_AND_ASSIGN(WriteWatcher); |
| 146 }; | 146 }; |
| 147 | 147 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 OldCompletionCallback* write_callback_; | 215 OldCompletionCallback* write_callback_; |
| 216 | 216 |
| 217 BoundNetLog net_log_; | 217 BoundNetLog net_log_; |
| 218 | 218 |
| 219 DISALLOW_COPY_AND_ASSIGN(UDPSocketLibevent); | 219 DISALLOW_COPY_AND_ASSIGN(UDPSocketLibevent); |
| 220 }; | 220 }; |
| 221 | 221 |
| 222 } // namespace net | 222 } // namespace net |
| 223 | 223 |
| 224 #endif // NET_UDP_UDP_SOCKET_LIBEVENT_H_ | 224 #endif // NET_UDP_UDP_SOCKET_LIBEVENT_H_ |
| OLD | NEW |