OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <aclapi.h> | 7 #include <aclapi.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 } | 78 } |
79 | 79 |
80 // static | 80 // static |
81 SharedMemoryHandle SharedMemory::NULLHandle() { | 81 SharedMemoryHandle SharedMemory::NULLHandle() { |
82 return NULL; | 82 return NULL; |
83 } | 83 } |
84 | 84 |
85 // static | 85 // static |
86 void SharedMemory::CloseHandle(const SharedMemoryHandle& handle) { | 86 void SharedMemory::CloseHandle(const SharedMemoryHandle& handle) { |
87 DCHECK(handle != NULL); | 87 DCHECK(handle != NULL); |
88 const BOOL result = ::CloseHandle(handle); | 88 ::CloseHandle(handle); |
89 CHECK(result); | |
90 } | 89 } |
91 | 90 |
92 // static | 91 // static |
93 size_t SharedMemory::GetHandleLimit() { | 92 size_t SharedMemory::GetHandleLimit() { |
94 // Rounded down from value reported here: | 93 // Rounded down from value reported here: |
95 // http://blogs.technet.com/b/markrussinovich/archive/2009/09/29/3283844.aspx | 94 // http://blogs.technet.com/b/markrussinovich/archive/2009/09/29/3283844.aspx |
96 return static_cast<size_t>(1 << 23); | 95 return static_cast<size_t>(1 << 23); |
97 } | 96 } |
98 | 97 |
99 // static | 98 // static |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 CloseHandle(mapped_file_); | 263 CloseHandle(mapped_file_); |
265 mapped_file_ = NULL; | 264 mapped_file_ = NULL; |
266 } | 265 } |
267 } | 266 } |
268 | 267 |
269 SharedMemoryHandle SharedMemory::handle() const { | 268 SharedMemoryHandle SharedMemory::handle() const { |
270 return mapped_file_; | 269 return mapped_file_; |
271 } | 270 } |
272 | 271 |
273 } // namespace base | 272 } // namespace base |
OLD | NEW |