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 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 SharedState result(subtle::NoBarrier_Load( | 346 SharedState result(subtle::NoBarrier_Load( |
347 &SharedStateFromSharedMemory(shared_memory_)->value.i)); | 347 &SharedStateFromSharedMemory(shared_memory_)->value.i)); |
348 | 348 |
349 return result.GetLockState() == SharedState::LOCKED || | 349 return result.GetLockState() == SharedState::LOCKED || |
350 !result.GetTimestamp().is_null(); | 350 !result.GetTimestamp().is_null(); |
351 } | 351 } |
352 | 352 |
353 void DiscardableSharedMemory::Close() { | 353 void DiscardableSharedMemory::Close() { |
354 shared_memory_.Unmap(); | 354 shared_memory_.Unmap(); |
355 shared_memory_.Close(); | 355 shared_memory_.Close(); |
| 356 mapped_size_ = 0; |
356 } | 357 } |
357 | 358 |
358 Time DiscardableSharedMemory::Now() const { | 359 Time DiscardableSharedMemory::Now() const { |
359 return Time::Now(); | 360 return Time::Now(); |
360 } | 361 } |
361 | 362 |
362 } // namespace base | 363 } // namespace base |
OLD | NEW |