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

Unified Diff: net/socket/unix_domain_server_socket_posix.h

Issue 509133002: Raw SocketDescriptor variant of UnixDomainServerSocket::Accept (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nits; waiting on mmenke for broader comments. Created 6 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
Index: net/socket/unix_domain_server_socket_posix.h
diff --git a/net/socket/unix_domain_server_socket_posix.h b/net/socket/unix_domain_server_socket_posix.h
index 85c743d2b8fcc6613afba713cec729687c13eb42..65b3fa132c3cada822fc1cd789350c5a561d3dbb 100644
--- a/net/socket/unix_domain_server_socket_posix.h
+++ b/net/socket/unix_domain_server_socket_posix.h
@@ -59,11 +59,23 @@ class NET_EXPORT UnixDomainServerSocket : public ServerSocket {
virtual int Accept(scoped_ptr<StreamSocket>* socket,
const CompletionCallback& callback) OVERRIDE;
+ // Accepts an incoming connection on |listen_socket_|, but passes back
+ // a raw SocketDescriptor instead of a StreamSocket.
+ int AcceptSocketDescriptor(SocketDescriptor* socket_descriptor,
+ const CompletionCallback& callback);
+
private:
- void AcceptCompleted(scoped_ptr<StreamSocket>* socket,
+ // A callback to wrap the setting of the out-parameter to Accept().
+ // This allows the internal machinery of that call to be implemented in
+ // a manner that's agnostic to the caller's desired output.
+ typedef base::Callback<void(scoped_ptr<SocketLibevent>)> SetterCallback;
+
+ int DoAccept(const SetterCallback& setter_callback,
+ const CompletionCallback& callback);
+ void AcceptCompleted(const SetterCallback& setter_callback,
const CompletionCallback& callback,
int rv);
- bool AuthenticateAndGetStreamSocket(scoped_ptr<StreamSocket>* socket);
+ bool AuthenticateAndGetStreamSocket(const SetterCallback& setter_callback);
scoped_ptr<SocketLibevent> listen_socket_;
const AuthCallback auth_callback_;

Powered by Google App Engine
This is Rietveld 408576698