OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // Please use discardable_memory.h since this is just an internal file providing | 5 // Please use discardable_memory.h since this is just an internal file providing |
6 // utility functions used both by discardable_memory_android.cc and | 6 // utility functions used both by discardable_memory_android.cc and |
7 // discardable_memory_allocator_android.cc. | 7 // discardable_memory_allocator_android.cc. |
8 | 8 |
9 #ifndef BASE_MEMORY_DISCARDABLE_MEMORY_ANDROID_H_ | 9 #ifndef BASE_MEMORY_DISCARDABLE_MEMORY_ANDROID_H_ |
10 #define BASE_MEMORY_DISCARDABLE_MEMORY_ANDROID_H_ | 10 #define BASE_MEMORY_DISCARDABLE_MEMORY_ANDROID_H_ |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/memory/discardable_memory.h" | 13 #include "base/memory/discardable_memory.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 namespace internal { | 16 namespace internal { |
17 | 17 |
18 // Returns 0 if the provided size is too high to be aligned. | |
19 size_t AlignToNextPage(size_t size); | |
20 | |
21 bool CreateAshmemRegion(const char* name, size_t size, int* fd, void** address); | 18 bool CreateAshmemRegion(const char* name, size_t size, int* fd, void** address); |
22 | 19 |
23 bool CloseAshmemRegion(int fd, size_t size, void* address); | 20 bool CloseAshmemRegion(int fd, size_t size, void* address); |
24 | 21 |
25 DiscardableMemoryLockStatus LockAshmemRegion(int fd, | 22 DiscardableMemoryLockStatus LockAshmemRegion(int fd, |
26 size_t offset, | 23 size_t offset, |
27 size_t size, | 24 size_t size, |
28 const void* address); | 25 const void* address); |
29 | 26 |
30 bool UnlockAshmemRegion(int fd, | 27 bool UnlockAshmemRegion(int fd, |
31 size_t offset, | 28 size_t offset, |
32 size_t size, | 29 size_t size, |
33 const void* address); | 30 const void* address); |
34 | 31 |
35 } // namespace internal | 32 } // namespace internal |
36 } // namespace base | 33 } // namespace base |
37 | 34 |
38 #endif // BASE_MEMORY_DISCARDABLE_MEMORY_ANDROID_H_ | 35 #endif // BASE_MEMORY_DISCARDABLE_MEMORY_ANDROID_H_ |
OLD | NEW |