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

Side by Side Diff: util/mach/child_port_handshake.cc

Issue 1483073004: Replace use of .Pass() with crashpad::move(). (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: pass: . Created 5 years 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
« no previous file with comments | « util/mach/child_port_handshake.h ('k') | util/net/http_transport.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Crashpad Authors. All rights reserved. 1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 // 2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); 3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License. 4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at 5 // You may obtain a copy of the License at
6 // 6 //
7 // http://www.apache.org/licenses/LICENSE-2.0 7 // http://www.apache.org/licenses/LICENSE-2.0
8 // 8 //
9 // Unless required by applicable law or agreed to in writing, software 9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS, 10 // distributed under the License is distributed on an "AS IS" BASIS,
(...skipping 19 matching lines...) Expand all
30 #include "base/posix/eintr_wrapper.h" 30 #include "base/posix/eintr_wrapper.h"
31 #include "base/rand_util.h" 31 #include "base/rand_util.h"
32 #include "base/strings/stringprintf.h" 32 #include "base/strings/stringprintf.h"
33 #include "util/file/file_io.h" 33 #include "util/file/file_io.h"
34 #include "util/mach/child_port.h" 34 #include "util/mach/child_port.h"
35 #include "util/mach/child_port_server.h" 35 #include "util/mach/child_port_server.h"
36 #include "util/mach/mach_extensions.h" 36 #include "util/mach/mach_extensions.h"
37 #include "util/mach/mach_message.h" 37 #include "util/mach/mach_message.h"
38 #include "util/mach/mach_message_server.h" 38 #include "util/mach/mach_message_server.h"
39 #include "util/misc/implicit_cast.h" 39 #include "util/misc/implicit_cast.h"
40 #include "util/stdlib/move.h"
40 #include "util/misc/random_string.h" 41 #include "util/misc/random_string.h"
41 42
42 namespace crashpad { 43 namespace crashpad {
43 namespace { 44 namespace {
44 45
45 class ChildPortHandshakeServer final : public ChildPortServer::Interface { 46 class ChildPortHandshakeServer final : public ChildPortServer::Interface {
46 public: 47 public:
47 ChildPortHandshakeServer(); 48 ChildPortHandshakeServer();
48 ~ChildPortHandshakeServer(); 49 ~ChildPortHandshakeServer();
49 50
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 SO_NOSIGPIPE, 346 SO_NOSIGPIPE,
346 &value, 347 &value,
347 sizeof(value)) == 0) << "setsockopt"; 348 sizeof(value)) == 0) << "setsockopt";
348 } 349 }
349 350
350 ChildPortHandshake::~ChildPortHandshake() { 351 ChildPortHandshake::~ChildPortHandshake() {
351 } 352 }
352 353
353 base::ScopedFD ChildPortHandshake::ClientReadFD() { 354 base::ScopedFD ChildPortHandshake::ClientReadFD() {
354 DCHECK(client_read_fd_.is_valid()); 355 DCHECK(client_read_fd_.is_valid());
355 return client_read_fd_.Pass(); 356 return crashpad::move(client_read_fd_);
356 } 357 }
357 358
358 base::ScopedFD ChildPortHandshake::ServerWriteFD() { 359 base::ScopedFD ChildPortHandshake::ServerWriteFD() {
359 DCHECK(server_write_fd_.is_valid()); 360 DCHECK(server_write_fd_.is_valid());
360 return server_write_fd_.Pass(); 361 return crashpad::move(server_write_fd_);
361 } 362 }
362 363
363 mach_port_t ChildPortHandshake::RunServer(PortRightType port_right_type) { 364 mach_port_t ChildPortHandshake::RunServer(PortRightType port_right_type) {
364 client_read_fd_.reset(); 365 client_read_fd_.reset();
365 return RunServerForFD(server_write_fd_.Pass(), port_right_type); 366 return RunServerForFD(crashpad::move(server_write_fd_), port_right_type);
366 } 367 }
367 368
368 bool ChildPortHandshake::RunClient(mach_port_t port, 369 bool ChildPortHandshake::RunClient(mach_port_t port,
369 mach_msg_type_name_t right_type) { 370 mach_msg_type_name_t right_type) {
370 server_write_fd_.reset(); 371 server_write_fd_.reset();
371 return RunClientForFD(client_read_fd_.Pass(), port, right_type); 372 return RunClientForFD(crashpad::move(client_read_fd_), port, right_type);
372 } 373 }
373 374
374 // static 375 // static
375 mach_port_t ChildPortHandshake::RunServerForFD(base::ScopedFD server_write_fd, 376 mach_port_t ChildPortHandshake::RunServerForFD(base::ScopedFD server_write_fd,
376 PortRightType port_right_type) { 377 PortRightType port_right_type) {
377 ChildPortHandshakeServer server; 378 ChildPortHandshakeServer server;
378 return server.RunServer(server_write_fd.Pass(), port_right_type); 379 return server.RunServer(crashpad::move(server_write_fd), port_right_type);
379 } 380 }
380 381
381 // static 382 // static
382 bool ChildPortHandshake::RunClientForFD(base::ScopedFD client_read_fd, 383 bool ChildPortHandshake::RunClientForFD(base::ScopedFD client_read_fd,
383 mach_port_t port, 384 mach_port_t port,
384 mach_msg_type_name_t right_type) { 385 mach_msg_type_name_t right_type) {
385 DCHECK(client_read_fd.is_valid()); 386 DCHECK(client_read_fd.is_valid());
386 387
387 // Read the token and the service name from the read side of the pipe. 388 // Read the token and the service name from the read side of the pipe.
388 child_port_token_t token; 389 child_port_token_t token;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 server_port.get(), token, port, right_type); 441 server_port.get(), token, port, right_type);
441 if (kr != KERN_SUCCESS) { 442 if (kr != KERN_SUCCESS) {
442 MACH_LOG(ERROR, kr) << "child_port_check_in"; 443 MACH_LOG(ERROR, kr) << "child_port_check_in";
443 return false; 444 return false;
444 } 445 }
445 446
446 return true; 447 return true;
447 } 448 }
448 449
449 } // namespace crashpad 450 } // namespace crashpad
OLDNEW
« no previous file with comments | « util/mach/child_port_handshake.h ('k') | util/net/http_transport.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698