Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2701)

Unified Diff: base/memory/discardable_memory_android.cc

Issue 136723005: Align ashmem region sizes to page size after ashmem creation failed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address William's comments Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/memory/discardable_memory_android.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/discardable_memory_android.cc
diff --git a/base/memory/discardable_memory_android.cc b/base/memory/discardable_memory_android.cc
index 6f531447f6d2b71a628967a8de6b3bcb7c2ffce0..2004a360b0c980be7068012500b53ee98ec137a6 100644
--- a/base/memory/discardable_memory_android.cc
+++ b/base/memory/discardable_memory_android.cc
@@ -37,8 +37,7 @@ struct DiscardableMemoryAllocatorWrapper {
static size_t GetOptimalAshmemRegionSizeForAllocator() {
// Note that this may do some I/O (without hitting the disk though) so it
// should not be called on the critical path.
- return internal::AlignToNextPage(
- base::android::SysUtils::AmountOfPhysicalMemoryKB() * 1024 / 8);
+ return base::android::SysUtils::AmountOfPhysicalMemoryKB() * 1024 / 8;
}
};
@@ -49,15 +48,6 @@ LazyInstance<DiscardableMemoryAllocatorWrapper>::Leaky g_context =
namespace internal {
-size_t AlignToNextPage(size_t size) {
- const size_t kPageSize = 4096;
- DCHECK_EQ(static_cast<int>(kPageSize), getpagesize());
- if (size > std::numeric_limits<size_t>::max() - kPageSize + 1)
- return 0;
- const size_t mask = ~(kPageSize - 1);
- return (size + kPageSize - 1) & mask;
-}
-
bool CreateAshmemRegion(const char* name,
size_t size,
int* out_fd,
« no previous file with comments | « base/memory/discardable_memory_android.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698