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

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

Issue 1892323002: Change scoped_ptr to std::unique_ptr in //net/socket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory>
10 #include <string> 11 #include <string>
11 12
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "net/base/completion_callback.h" 14 #include "net/base/completion_callback.h"
15 #include "net/base/net_export.h" 15 #include "net/base/net_export.h"
16 #include "net/log/net_log.h" 16 #include "net/log/net_log.h"
17 #include "net/socket/socket_descriptor.h" 17 #include "net/socket/socket_descriptor.h"
18 #include "net/socket/stream_socket.h" 18 #include "net/socket/stream_socket.h"
19 19
20 namespace net { 20 namespace net {
21 21
22 class SocketPosix; 22 class SocketPosix;
23 struct SockaddrStorage; 23 struct SockaddrStorage;
24 24
25 // A client socket that uses unix domain socket as the transport layer. 25 // A client socket that uses unix domain socket as the transport layer.
26 class NET_EXPORT UnixDomainClientSocket : public StreamSocket { 26 class NET_EXPORT UnixDomainClientSocket : public StreamSocket {
27 public: 27 public:
28 // Builds a client socket with |socket_path|. The caller should call Connect() 28 // Builds a client socket with |socket_path|. The caller should call Connect()
29 // to connect to a server socket. 29 // to connect to a server socket.
30 UnixDomainClientSocket(const std::string& socket_path, 30 UnixDomainClientSocket(const std::string& socket_path,
31 bool use_abstract_namespace); 31 bool use_abstract_namespace);
32 // Builds a client socket with SocketPosix which is already connected. 32 // Builds a client socket with SocketPosix which is already connected.
33 // UnixDomainServerSocket uses this after it accepts a connection. 33 // UnixDomainServerSocket uses this after it accepts a connection.
34 explicit UnixDomainClientSocket(scoped_ptr<SocketPosix> socket); 34 explicit UnixDomainClientSocket(std::unique_ptr<SocketPosix> socket);
35 35
36 ~UnixDomainClientSocket() override; 36 ~UnixDomainClientSocket() override;
37 37
38 // Fills |address| with |socket_path| and its length. For Android or Linux 38 // Fills |address| with |socket_path| and its length. For Android or Linux
39 // platform, this supports abstract namespaces. 39 // platform, this supports abstract namespaces.
40 static bool FillAddress(const std::string& socket_path, 40 static bool FillAddress(const std::string& socket_path,
41 bool use_abstract_namespace, 41 bool use_abstract_namespace,
42 SockaddrStorage* address); 42 SockaddrStorage* address);
43 43
44 // StreamSocket implementation. 44 // StreamSocket implementation.
(...skipping 26 matching lines...) Expand all
71 int SetSendBufferSize(int32_t size) override; 71 int SetSendBufferSize(int32_t size) override;
72 72
73 // Releases ownership of underlying SocketDescriptor to caller. 73 // Releases ownership of underlying SocketDescriptor to caller.
74 // Internal state is reset so that this object can be used again. 74 // Internal state is reset so that this object can be used again.
75 // Socket must be connected in order to release it. 75 // Socket must be connected in order to release it.
76 SocketDescriptor ReleaseConnectedSocket(); 76 SocketDescriptor ReleaseConnectedSocket();
77 77
78 private: 78 private:
79 const std::string socket_path_; 79 const std::string socket_path_;
80 const bool use_abstract_namespace_; 80 const bool use_abstract_namespace_;
81 scoped_ptr<SocketPosix> socket_; 81 std::unique_ptr<SocketPosix> socket_;
82 // This net log is just to comply StreamSocket::NetLog(). It throws away 82 // This net log is just to comply StreamSocket::NetLog(). It throws away
83 // everything. 83 // everything.
84 BoundNetLog net_log_; 84 BoundNetLog net_log_;
85 85
86 DISALLOW_COPY_AND_ASSIGN(UnixDomainClientSocket); 86 DISALLOW_COPY_AND_ASSIGN(UnixDomainClientSocket);
87 }; 87 };
88 88
89 } // namespace net 89 } // namespace net
90 90
91 #endif // NET_SOCKET_UNIX_DOMAIN_CLIENT_SOCKET_POSIX_H_ 91 #endif // NET_SOCKET_UNIX_DOMAIN_CLIENT_SOCKET_POSIX_H_
OLDNEW
« no previous file with comments | « net/socket/transport_client_socket_unittest.cc ('k') | net/socket/unix_domain_client_socket_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698