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

Side by Side Diff: net/socket/unix_domain_client_socket_posix.h

Issue 509133002: Raw SocketDescriptor variant of UnixDomainServerSocket::Accept (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add ReleaseSocketDescriptor to UnixDomainClientSocket class 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_SOCKET_UNIX_DOMAIN_CLIENT_SOCKET_POSIX_H_ 5 #ifndef NET_SOCKET_UNIX_DOMAIN_CLIENT_SOCKET_POSIX_H_
6 #define NET_SOCKET_UNIX_DOMAIN_CLIENT_SOCKET_POSIX_H_ 6 #define NET_SOCKET_UNIX_DOMAIN_CLIENT_SOCKET_POSIX_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 #include "net/base/completion_callback.h" 13 #include "net/base/completion_callback.h"
14 #include "net/base/net_export.h" 14 #include "net/base/net_export.h"
15 #include "net/base/net_log.h" 15 #include "net/base/net_log.h"
16 #include "net/socket/socket_descriptor.h"
16 #include "net/socket/stream_socket.h" 17 #include "net/socket/stream_socket.h"
17 18
18 namespace net { 19 namespace net {
19 20
20 class SocketLibevent; 21 class SocketLibevent;
21 struct SockaddrStorage; 22 struct SockaddrStorage;
22 23
23 // A client socket that uses unix domain socket as the transport layer. 24 // A client socket that uses unix domain socket as the transport layer.
24 class NET_EXPORT UnixDomainClientSocket : public StreamSocket { 25 class NET_EXPORT UnixDomainClientSocket : public StreamSocket {
25 public: 26 public:
(...skipping 30 matching lines...) Expand all
56 virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; 57 virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE;
57 58
58 // Socket implementation. 59 // Socket implementation.
59 virtual int Read(IOBuffer* buf, int buf_len, 60 virtual int Read(IOBuffer* buf, int buf_len,
60 const CompletionCallback& callback) OVERRIDE; 61 const CompletionCallback& callback) OVERRIDE;
61 virtual int Write(IOBuffer* buf, int buf_len, 62 virtual int Write(IOBuffer* buf, int buf_len,
62 const CompletionCallback& callback) OVERRIDE; 63 const CompletionCallback& callback) OVERRIDE;
63 virtual int SetReceiveBufferSize(int32 size) OVERRIDE; 64 virtual int SetReceiveBufferSize(int32 size) OVERRIDE;
64 virtual int SetSendBufferSize(int32 size) OVERRIDE; 65 virtual int SetSendBufferSize(int32 size) OVERRIDE;
65 66
67 // Releases ownership of socket_->socket_fd() to caller. |socket_| is
68 // destroyed in the process, as it no longer owns the underlying FD.
byungchul 2014/09/03 00:13:54 Not sure if it is good to comment with private mem
Chris Masone 2014/09/03 02:38:39 Done.
69 // Returns kInvalidSocket if |socket_| does not exist or is not connected.
70 SocketDescriptor ReleaseSocketDescriptor();
71
66 private: 72 private:
67 const std::string socket_path_; 73 const std::string socket_path_;
68 const bool use_abstract_namespace_; 74 const bool use_abstract_namespace_;
69 scoped_ptr<SocketLibevent> socket_; 75 scoped_ptr<SocketLibevent> socket_;
70 // This net log is just to comply StreamSocket::NetLog(). It throws away 76 // This net log is just to comply StreamSocket::NetLog(). It throws away
71 // everything. 77 // everything.
72 BoundNetLog net_log_; 78 BoundNetLog net_log_;
73 79
74 DISALLOW_COPY_AND_ASSIGN(UnixDomainClientSocket); 80 DISALLOW_COPY_AND_ASSIGN(UnixDomainClientSocket);
75 }; 81 };
76 82
77 } // namespace net 83 } // namespace net
78 84
79 #endif // NET_SOCKET_UNIX_DOMAIN_CLIENT_SOCKET_POSIX_H_ 85 #endif // NET_SOCKET_UNIX_DOMAIN_CLIENT_SOCKET_POSIX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698