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

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

Issue 2849633002: Get rid of base::SharedMemory::NULLHandle(); (Closed)
Patch Set: Created 3 years, 7 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 (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 <stddef.h> 9 #include <stddef.h>
10 #include <sys/mman.h> 10 #include <sys/mman.h>
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 Unmap(); 51 Unmap();
52 Close(); 52 Close();
53 } 53 }
54 54
55 // static 55 // static
56 bool SharedMemory::IsHandleValid(const SharedMemoryHandle& handle) { 56 bool SharedMemory::IsHandleValid(const SharedMemoryHandle& handle) {
57 return handle.IsValid(); 57 return handle.IsValid();
58 } 58 }
59 59
60 // static 60 // static
61 SharedMemoryHandle SharedMemory::NULLHandle() {
62 return SharedMemoryHandle();
63 }
64
65 // static
66 void SharedMemory::CloseHandle(const SharedMemoryHandle& handle) { 61 void SharedMemory::CloseHandle(const SharedMemoryHandle& handle) {
67 DCHECK(handle.IsValid()); 62 DCHECK(handle.IsValid());
68 handle.Close(); 63 handle.Close();
69 } 64 }
70 65
71 // static 66 // static
72 size_t SharedMemory::GetHandleLimit() { 67 size_t SharedMemory::GetHandleLimit() {
73 return base::GetMaxFds(); 68 return base::GetMaxFds();
74 } 69 }
75 70
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 struct stat file_stat; 402 struct stat file_stat;
408 if (HANDLE_EINTR( 403 if (HANDLE_EINTR(
409 ::fstat(static_cast<int>(handle().GetHandle()), &file_stat)) != 0) 404 ::fstat(static_cast<int>(handle().GetHandle()), &file_stat)) != 0)
410 return false; 405 return false;
411 id->first = file_stat.st_dev; 406 id->first = file_stat.st_dev;
412 id->second = file_stat.st_ino; 407 id->second = file_stat.st_ino;
413 return true; 408 return true;
414 } 409 }
415 410
416 } // namespace base 411 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698