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

Side by Side Diff: net/socket/unix_domain_server_socket_posix.cc

Issue 1545233002: Convert Pass()→std::move() in //net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 #include "net/socket/unix_domain_server_socket_posix.h" 5 #include "net/socket/unix_domain_server_socket_posix.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <sys/socket.h> 8 #include <sys/socket.h>
9 #include <sys/un.h> 9 #include <sys/un.h>
10 #include <unistd.h> 10 #include <unistd.h>
11 #include <utility>
11 12
12 #include "base/logging.h" 13 #include "base/logging.h"
13 #include "net/base/net_errors.h" 14 #include "net/base/net_errors.h"
14 #include "net/base/net_util.h" 15 #include "net/base/net_util.h"
15 #include "net/socket/socket_posix.h" 16 #include "net/socket/socket_posix.h"
16 #include "net/socket/unix_domain_client_socket_posix.h" 17 #include "net/socket/unix_domain_client_socket_posix.h"
17 18
18 namespace net { 19 namespace net {
19 20
20 namespace { 21 namespace {
21 22
22 // Intended for use as SetterCallbacks in Accept() helper methods. 23 // Intended for use as SetterCallbacks in Accept() helper methods.
23 void SetStreamSocket(scoped_ptr<StreamSocket>* socket, 24 void SetStreamSocket(scoped_ptr<StreamSocket>* socket,
24 scoped_ptr<SocketPosix> accepted_socket) { 25 scoped_ptr<SocketPosix> accepted_socket) {
25 socket->reset(new UnixDomainClientSocket(accepted_socket.Pass())); 26 socket->reset(new UnixDomainClientSocket(std::move(accepted_socket)));
26 } 27 }
27 28
28 void SetSocketDescriptor(SocketDescriptor* socket, 29 void SetSocketDescriptor(SocketDescriptor* socket,
29 scoped_ptr<SocketPosix> accepted_socket) { 30 scoped_ptr<SocketPosix> accepted_socket) {
30 *socket = accepted_socket->ReleaseConnectedSocket(); 31 *socket = accepted_socket->ReleaseConnectedSocket();
31 } 32 }
32 33
33 } // anonymous namespace 34 } // anonymous namespace
34 35
35 UnixDomainServerSocket::UnixDomainServerSocket( 36 UnixDomainServerSocket::UnixDomainServerSocket(
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 const SetterCallback& setter_callback) { 177 const SetterCallback& setter_callback) {
177 DCHECK(accept_socket_); 178 DCHECK(accept_socket_);
178 179
179 Credentials credentials; 180 Credentials credentials;
180 if (!GetPeerCredentials(accept_socket_->socket_fd(), &credentials) || 181 if (!GetPeerCredentials(accept_socket_->socket_fd(), &credentials) ||
181 !auth_callback_.Run(credentials)) { 182 !auth_callback_.Run(credentials)) {
182 accept_socket_.reset(); 183 accept_socket_.reset();
183 return false; 184 return false;
184 } 185 }
185 186
186 setter_callback.Run(accept_socket_.Pass()); 187 setter_callback.Run(std::move(accept_socket_));
187 return true; 188 return true;
188 } 189 }
189 190
190 } // namespace net 191 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/unix_domain_client_socket_posix_unittest.cc ('k') | net/socket/websocket_transport_client_socket_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698