| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 return static_cast<SharedState*>(shared_memory.memory()); | 90 return static_cast<SharedState*>(shared_memory.memory()); |
| 91 } | 91 } |
| 92 | 92 |
| 93 // Round up |size| to a multiple of page size. | 93 // Round up |size| to a multiple of page size. |
| 94 size_t AlignToPageSize(size_t size) { | 94 size_t AlignToPageSize(size_t size) { |
| 95 return bits::Align(size, base::GetPageSize()); | 95 return bits::Align(size, base::GetPageSize()); |
| 96 } | 96 } |
| 97 | 97 |
| 98 } // namespace | 98 } // namespace |
| 99 | 99 |
| 100 // static |
| 101 const char DiscardableSharedMemory::kAllocatedObjectsDumpName[] = |
| 102 "discardable/allocated_objects"; |
| 103 |
| 100 DiscardableSharedMemory::DiscardableSharedMemory() | 104 DiscardableSharedMemory::DiscardableSharedMemory() |
| 101 : mapped_size_(0), locked_page_count_(0) { | 105 : mapped_size_(0), locked_page_count_(0) { |
| 102 } | 106 } |
| 103 | 107 |
| 104 DiscardableSharedMemory::DiscardableSharedMemory( | 108 DiscardableSharedMemory::DiscardableSharedMemory( |
| 105 SharedMemoryHandle shared_memory_handle) | 109 SharedMemoryHandle shared_memory_handle) |
| 106 : shared_memory_(shared_memory_handle, false), | 110 : shared_memory_(shared_memory_handle, false), |
| 107 mapped_size_(0), | 111 mapped_size_(0), |
| 108 locked_page_count_(0) { | 112 locked_page_count_(0) { |
| 109 } | 113 } |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 NOTIMPLEMENTED(); | 366 NOTIMPLEMENTED(); |
| 363 #endif | 367 #endif |
| 364 } | 368 } |
| 365 #endif | 369 #endif |
| 366 | 370 |
| 367 Time DiscardableSharedMemory::Now() const { | 371 Time DiscardableSharedMemory::Now() const { |
| 368 return Time::Now(); | 372 return Time::Now(); |
| 369 } | 373 } |
| 370 | 374 |
| 371 } // namespace base | 375 } // namespace base |
| OLD | NEW |