Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(874)

Unified Diff: net/udp/udp_socket_win.h

Issue 10918158: [net/udp] Create UDPSocketWin::Core which persists until all network operations complete. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: respond to review Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/udp/udp_socket_win.cc » ('j') | net/udp/udp_socket_win.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..ce17050583efd9e307418940cff034242ad4e473 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,31 +177,17 @@ 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_;
IPEndPoint* recv_from_address_;
// Cached copy of the current address we're sending to, if any. Used for
// 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_;
« no previous file with comments | « no previous file | net/udp/udp_socket_win.cc » ('j') | net/udp/udp_socket_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698