Chromium Code Reviews| Index: net/udp/udp_socket_win.h |
| diff --git a/net/udp/udp_socket_win.h b/net/udp/udp_socket_win.h |
| index 2185fbb71cdb2184bd798d1cfc1c3ab7b522a305..6395349dcd0109009f05f38bb7eff92eca42d47b 100644 |
| --- a/net/udp/udp_socket_win.h |
| +++ b/net/udp/udp_socket_win.h |
| @@ -121,29 +121,7 @@ class NET_EXPORT UDPSocketWin : NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| SOCKET_OPTION_BROADCAST = 1 << 1 |
| }; |
| - class ReadDelegate : public base::win::ObjectWatcher::Delegate { |
| - public: |
| - explicit ReadDelegate(UDPSocketWin* socket) : socket_(socket) {} |
| - virtual ~ReadDelegate() {} |
| - |
| - // base::ObjectWatcher::Delegate methods: |
| - virtual void OnObjectSignaled(HANDLE object); |
| - |
| - private: |
| - UDPSocketWin* const socket_; |
| - }; |
| - |
| - class WriteDelegate : public base::win::ObjectWatcher::Delegate { |
| - public: |
| - explicit WriteDelegate(UDPSocketWin* socket) : socket_(socket) {} |
| - virtual ~WriteDelegate() {} |
| - |
| - // base::ObjectWatcher::Delegate methods: |
| - virtual void OnObjectSignaled(HANDLE object); |
| - |
| - private: |
| - UDPSocketWin* const socket_; |
| - }; |
| + class Core; |
| void DoReadCallback(int rv); |
| void DoWriteCallback(int rv); |
| @@ -199,20 +177,11 @@ class NET_EXPORT UDPSocketWin : NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| mutable scoped_ptr<IPEndPoint> local_address_; |
| mutable scoped_ptr<IPEndPoint> remote_address_; |
| - // The socket's win wrappers |
| - ReadDelegate read_delegate_; |
| - WriteDelegate write_delegate_; |
| - |
| - // Watchers to watch for events from Read() and Write(). |
| - base::win::ObjectWatcher read_watcher_; |
| - base::win::ObjectWatcher write_watcher_; |
| + // The core of the socket that can live longer than the socket itself. We pass |
| + // resources to the Windows async IO functions and we have to make sure that |
| + // they are not destroyed while the OS still references them. |
| + scoped_refptr<Core> core_; |
| - // OVERLAPPED for pending read and write operations. |
| - OVERLAPPED read_overlapped_; |
| - OVERLAPPED write_overlapped_; |
| - |
| - // The buffer used by InternalRead() to retry Read requests |
| - scoped_refptr<IOBuffer> read_iobuffer_; |
| struct sockaddr_storage recv_addr_storage_; |
| socklen_t recv_addr_len_; |
|
wtc
2012/09/12 01:40:29
BUG: recv_addr_storage_ and recv_addr_len_ need to
|
| IPEndPoint* recv_from_address_; |
| @@ -221,9 +190,6 @@ class NET_EXPORT UDPSocketWin : NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| // logging. |
| scoped_ptr<IPEndPoint> send_to_address_; |
| - // The buffer used by InternalWrite() to retry Write requests |
| - scoped_refptr<IOBuffer> write_iobuffer_; |
| - |
| // External callback; called when read is complete. |
| CompletionCallback read_callback_; |