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

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

Issue 2849633002: Get rid of base::SharedMemory::NULLHandle(); (Closed)
Patch Set: Rebase. 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
« no previous file with comments | « base/memory/shared_memory_mac.cc ('k') | base/memory/shared_memory_posix.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 <stddef.h> 9 #include <stddef.h>
10 #include <sys/mman.h> 10 #include <sys/mman.h>
(...skipping 20 matching lines...) Expand all
31 Unmap(); 31 Unmap();
32 Close(); 32 Close();
33 } 33 }
34 34
35 // static 35 // static
36 bool SharedMemory::IsHandleValid(const SharedMemoryHandle& handle) { 36 bool SharedMemory::IsHandleValid(const SharedMemoryHandle& handle) {
37 return handle.IsValid(); 37 return handle.IsValid();
38 } 38 }
39 39
40 // static 40 // static
41 SharedMemoryHandle SharedMemory::NULLHandle() {
42 return SharedMemoryHandle();
43 }
44
45 // static
46 void SharedMemory::CloseHandle(const SharedMemoryHandle& handle) { 41 void SharedMemory::CloseHandle(const SharedMemoryHandle& handle) {
47 DCHECK(handle.IsValid()); 42 DCHECK(handle.IsValid());
48 handle.Close(); 43 handle.Close();
49 } 44 }
50 45
51 // static 46 // static
52 SharedMemoryHandle SharedMemory::DuplicateHandle( 47 SharedMemoryHandle SharedMemory::DuplicateHandle(
53 const SharedMemoryHandle& handle) { 48 const SharedMemoryHandle& handle) {
54 return handle.Duplicate(); 49 return handle.Duplicate();
55 } 50 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 *new_handle = shm_.Duplicate(); 138 *new_handle = shm_.Duplicate();
144 139
145 if (close_self) { 140 if (close_self) {
146 Unmap(); 141 Unmap();
147 Close(); 142 Close();
148 } 143 }
149 return new_handle->IsValid(); 144 return new_handle->IsValid();
150 } 145 }
151 146
152 } // namespace base 147 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/shared_memory_mac.cc ('k') | base/memory/shared_memory_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698