OLD | NEW |
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 #include "net/socket/unix_domain_client_socket_posix.h" | 5 #include "net/socket/unix_domain_client_socket_posix.h" |
6 | 6 |
7 #include <sys/socket.h> | 7 #include <sys/socket.h> |
8 #include <sys/un.h> | 8 #include <sys/un.h> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
13 #include "net/base/sockaddr_storage.h" | 13 #include "net/base/sockaddr_storage.h" |
14 #include "net/socket/socket_posix.h" | 14 #include "net/socket/socket_posix.h" |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 | 17 |
18 UnixDomainClientSocket::UnixDomainClientSocket(const std::string& socket_path, | 18 UnixDomainClientSocket::UnixDomainClientSocket(const std::string& socket_path, |
19 bool use_abstract_namespace) | 19 bool use_abstract_namespace) |
20 : socket_path_(socket_path), | 20 : socket_path_(socket_path), |
21 use_abstract_namespace_(use_abstract_namespace) { | 21 use_abstract_namespace_(use_abstract_namespace) { |
22 } | 22 } |
23 | 23 |
24 UnixDomainClientSocket::UnixDomainClientSocket(scoped_ptr<SocketPosix> socket) | 24 UnixDomainClientSocket::UnixDomainClientSocket( |
| 25 std::unique_ptr<SocketPosix> socket) |
25 : use_abstract_namespace_(false), socket_(std::move(socket)) {} | 26 : use_abstract_namespace_(false), socket_(std::move(socket)) {} |
26 | 27 |
27 UnixDomainClientSocket::~UnixDomainClientSocket() { | 28 UnixDomainClientSocket::~UnixDomainClientSocket() { |
28 Disconnect(); | 29 Disconnect(); |
29 } | 30 } |
30 | 31 |
31 // static | 32 // static |
32 bool UnixDomainClientSocket::FillAddress(const std::string& socket_path, | 33 bool UnixDomainClientSocket::FillAddress(const std::string& socket_path, |
33 bool use_abstract_namespace, | 34 bool use_abstract_namespace, |
34 SockaddrStorage* address) { | 35 SockaddrStorage* address) { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 SocketDescriptor UnixDomainClientSocket::ReleaseConnectedSocket() { | 179 SocketDescriptor UnixDomainClientSocket::ReleaseConnectedSocket() { |
179 DCHECK(socket_); | 180 DCHECK(socket_); |
180 DCHECK(socket_->IsConnected()); | 181 DCHECK(socket_->IsConnected()); |
181 | 182 |
182 SocketDescriptor socket_fd = socket_->ReleaseConnectedSocket(); | 183 SocketDescriptor socket_fd = socket_->ReleaseConnectedSocket(); |
183 socket_.reset(); | 184 socket_.reset(); |
184 return socket_fd; | 185 return socket_fd; |
185 } | 186 } |
186 | 187 |
187 } // namespace net | 188 } // namespace net |
OLD | NEW |