OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/discardable_shared_memory.h" | 5 #include "base/memory/discardable_shared_memory.h" |
6 | 6 |
7 #if defined(OS_POSIX) | 7 #if defined(OS_POSIX) |
8 #include <unistd.h> | 8 #include <unistd.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 DCHECK(shared_memory_.memory()); | 217 DCHECK(shared_memory_.memory()); |
218 | 218 |
219 SharedState result(subtle::NoBarrier_Load( | 219 SharedState result(subtle::NoBarrier_Load( |
220 &SharedStateFromSharedMemory(shared_memory_)->value.i)); | 220 &SharedStateFromSharedMemory(shared_memory_)->value.i)); |
221 | 221 |
222 return result.GetLockState() == SharedState::LOCKED || | 222 return result.GetLockState() == SharedState::LOCKED || |
223 !result.GetTimestamp().is_null(); | 223 !result.GetTimestamp().is_null(); |
224 } | 224 } |
225 | 225 |
226 void DiscardableSharedMemory::Close() { | 226 void DiscardableSharedMemory::Close() { |
| 227 shared_memory_.Unmap(); |
227 shared_memory_.Close(); | 228 shared_memory_.Close(); |
228 } | 229 } |
229 | 230 |
230 Time DiscardableSharedMemory::Now() const { | 231 Time DiscardableSharedMemory::Now() const { |
231 return Time::Now(); | 232 return Time::Now(); |
232 } | 233 } |
233 | 234 |
234 } // namespace base | 235 } // namespace base |
OLD | NEW |