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

Unified Diff: base/memory/discardable_memory_android.cc

Issue 145643008: base: Add uncached malloc based discardable memory type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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.cc ('k') | base/memory/discardable_memory_linux.cc » ('j') | 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 2004a360b0c980be7068012500b53ee98ec137a6..7b1731a0f63c21df0bd4ec6580c714fb9053e332 100644
--- a/base/memory/discardable_memory_android.cc
+++ b/base/memory/discardable_memory_android.cc
@@ -17,6 +17,7 @@
#include "base/logging.h"
#include "base/memory/discardable_memory_allocator_android.h"
#include "base/memory/discardable_memory_emulated.h"
+#include "base/memory/discardable_memory_malloc.h"
#include "third_party/ashmem/ashmem.h"
namespace base {
@@ -126,7 +127,8 @@ void DiscardableMemory::GetSupportedTypes(
std::vector<DiscardableMemoryType>* types) {
const DiscardableMemoryType supported_types[] = {
DISCARDABLE_MEMORY_TYPE_ANDROID,
- DISCARDABLE_MEMORY_TYPE_EMULATED
+ DISCARDABLE_MEMORY_TYPE_EMULATED,
+ DISCARDABLE_MEMORY_TYPE_MALLOC
};
types->assign(supported_types, supported_types + arraysize(supported_types));
}
@@ -149,6 +151,14 @@ scoped_ptr<DiscardableMemory> DiscardableMemory::CreateLockedMemoryWithType(
return memory.PassAs<DiscardableMemory>();
}
+ case DISCARDABLE_MEMORY_TYPE_MALLOC: {
+ scoped_ptr<internal::DiscardableMemoryMalloc> memory(
+ new internal::DiscardableMemoryMalloc(size));
+ if (!memory->Initialize())
+ return scoped_ptr<DiscardableMemory>();
+
+ return memory.PassAs<DiscardableMemory>();
+ }
}
NOTREACHED();
« no previous file with comments | « base/memory/discardable_memory.cc ('k') | base/memory/discardable_memory_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698