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

Side by Side Diff: base/memory/shared_memory_mac.cc

Issue 1479473002: base: Use std::move() instead of Pass() for real movable types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: basepass: missing-include 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 | « base/memory/scoped_ptr_unittest.cc ('k') | base/memory/shared_memory_mac_unittest.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/memory/shared_memory.h" 5 #include "base/memory/shared_memory.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <mach/mach_vm.h> 9 #include <mach/mach_vm.h>
10 #include <sys/mman.h> 10 #include <sys/mman.h>
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 struct stat stat; 324 struct stat stat;
325 if (fstat(fileno(fp.get()), &stat) != 0) 325 if (fstat(fileno(fp.get()), &stat) != 0)
326 return false; 326 return false;
327 const size_t current_size = stat.st_size; 327 const size_t current_size = stat.st_size;
328 if (current_size != options.size) { 328 if (current_size != options.size) {
329 if (HANDLE_EINTR(ftruncate(fileno(fp.get()), options.size)) != 0) 329 if (HANDLE_EINTR(ftruncate(fileno(fp.get()), options.size)) != 0)
330 return false; 330 return false;
331 } 331 }
332 requested_size_ = options.size; 332 requested_size_ = options.size;
333 333
334 return PrepareMapFile(fp.Pass(), readonly_fd.Pass()); 334 return PrepareMapFile(std::move(fp), std::move(readonly_fd));
335 } 335 }
336 336
337 bool SharedMemory::MapAt(off_t offset, size_t bytes) { 337 bool SharedMemory::MapAt(off_t offset, size_t bytes) {
338 if (!shm_.IsValid()) 338 if (!shm_.IsValid())
339 return false; 339 return false;
340 if (bytes > static_cast<size_t>(std::numeric_limits<int>::max())) 340 if (bytes > static_cast<size_t>(std::numeric_limits<int>::max()))
341 return false; 341 return false;
342 if (memory_) 342 if (memory_)
343 return false; 343 return false;
344 344
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 491
492 if (close_self) { 492 if (close_self) {
493 Unmap(); 493 Unmap();
494 Close(); 494 Close();
495 } 495 }
496 496
497 return true; 497 return true;
498 } 498 }
499 499
500 } // namespace base 500 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/scoped_ptr_unittest.cc ('k') | base/memory/shared_memory_mac_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698