Chromium Code Reviews| 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 ::CloseHandle(handle); | 88 const BOOL result = ::CloseHandle(handle); |
| 89 DCHECK(result); | |
|
brucedawson
2015/09/16 00:30:52
This would have caught 524267.
rvargas (doing something else)
2015/09/16 02:09:12
Use CHECK
brucedawson
2015/09/16 18:29:00
The reason I used DCHECK was because of the DCHECK
rvargas (doing something else)
2015/09/16 18:54:38
There's no semantic distinction between DCHECK and
| |
| 89 } | 90 } |
| 90 | 91 |
| 91 // static | 92 // static |
| 92 size_t SharedMemory::GetHandleLimit() { | 93 size_t SharedMemory::GetHandleLimit() { |
| 93 // Rounded down from value reported here: | 94 // Rounded down from value reported here: |
| 94 // http://blogs.technet.com/b/markrussinovich/archive/2009/09/29/3283844.aspx | 95 // http://blogs.technet.com/b/markrussinovich/archive/2009/09/29/3283844.aspx |
| 95 return static_cast<size_t>(1 << 23); | 96 return static_cast<size_t>(1 << 23); |
| 96 } | 97 } |
| 97 | 98 |
| 98 // static | 99 // static |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 263 CloseHandle(mapped_file_); | 264 CloseHandle(mapped_file_); |
| 264 mapped_file_ = NULL; | 265 mapped_file_ = NULL; |
| 265 } | 266 } |
| 266 } | 267 } |
| 267 | 268 |
| 268 SharedMemoryHandle SharedMemory::handle() const { | 269 SharedMemoryHandle SharedMemory::handle() const { |
| 269 return mapped_file_; | 270 return mapped_file_; |
| 270 } | 271 } |
| 271 | 272 |
| 272 } // namespace base | 273 } // namespace base |
| OLD | NEW |