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 #ifndef BASE_MEMORY_DISCARDABLE_SHARED_MEMORY_H_ | 5 #ifndef BASE_MEMORY_DISCARDABLE_SHARED_MEMORY_H_ |
6 #define BASE_MEMORY_DISCARDABLE_SHARED_MEMORY_H_ | 6 #define BASE_MEMORY_DISCARDABLE_SHARED_MEMORY_H_ |
7 | 7 |
| 8 #include <stddef.h> |
| 9 |
8 #include "base/base_export.h" | 10 #include "base/base_export.h" |
9 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/macros.h" |
10 #include "base/memory/shared_memory.h" | 13 #include "base/memory/shared_memory.h" |
11 #include "base/threading/thread_collision_warner.h" | 14 #include "base/threading/thread_collision_warner.h" |
12 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "build/build_config.h" |
13 | 17 |
14 #if DCHECK_IS_ON() | 18 #if DCHECK_IS_ON() |
15 #include <set> | 19 #include <set> |
16 #endif | 20 #endif |
17 | 21 |
18 // Linux (including Android) support the MADV_REMOVE argument with madvise() | 22 // Linux (including Android) support the MADV_REMOVE argument with madvise() |
19 // which has the behavior of reliably causing zero-fill-on-demand pages to | 23 // which has the behavior of reliably causing zero-fill-on-demand pages to |
20 // be returned after a call. Here we define | 24 // be returned after a call. Here we define |
21 // DISCARDABLE_SHARED_MEMORY_ZERO_FILL_ON_DEMAND_PAGES_AFTER_PURGE on Linux | 25 // DISCARDABLE_SHARED_MEMORY_ZERO_FILL_ON_DEMAND_PAGES_AFTER_PURGE on Linux |
22 // and Android to indicate that this type of behavior can be expected on | 26 // and Android to indicate that this type of behavior can be expected on |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // synchronized somehow. Use a collision warner to detect incorrect usage. | 147 // synchronized somehow. Use a collision warner to detect incorrect usage. |
144 DFAKE_MUTEX(thread_collision_warner_); | 148 DFAKE_MUTEX(thread_collision_warner_); |
145 Time last_known_usage_; | 149 Time last_known_usage_; |
146 | 150 |
147 DISALLOW_COPY_AND_ASSIGN(DiscardableSharedMemory); | 151 DISALLOW_COPY_AND_ASSIGN(DiscardableSharedMemory); |
148 }; | 152 }; |
149 | 153 |
150 } // namespace base | 154 } // namespace base |
151 | 155 |
152 #endif // BASE_MEMORY_DISCARDABLE_SHARED_MEMORY_H_ | 156 #endif // BASE_MEMORY_DISCARDABLE_SHARED_MEMORY_H_ |
OLD | NEW |