From 6546f2e45861172af83b0c1e6432cae24e97d4cc Mon Sep 17 00:00:00 2001 From: Glenn Kasten Date: Fri, 14 Mar 2014 16:49:51 -0700 Subject: [PATCH] Allow creation of heaps that are read-only to partner Change-Id: I3c2b3d9b1671da4b9d9c58dce27e291d30703b03 --- include/binder/MemoryDealer.h | 3 ++- libs/binder/MemoryDealer.cpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/binder/MemoryDealer.h b/include/binder/MemoryDealer.h index 170f20d67..aa415d5ac 100644 --- a/include/binder/MemoryDealer.h +++ b/include/binder/MemoryDealer.h @@ -34,7 +34,8 @@ class SimpleBestFitAllocator; class MemoryDealer : public RefBase { public: - MemoryDealer(size_t size, const char* name = 0); + MemoryDealer(size_t size, const char* name = 0, + uint32_t flags = 0 /* or bits such as MemoryHeapBase::READ_ONLY */ ); virtual sp allocate(size_t size); virtual void deallocate(size_t offset); diff --git a/libs/binder/MemoryDealer.cpp b/libs/binder/MemoryDealer.cpp index a14c10005..873962569 100644 --- a/libs/binder/MemoryDealer.cpp +++ b/libs/binder/MemoryDealer.cpp @@ -225,8 +225,8 @@ Allocation::~Allocation() // ---------------------------------------------------------------------------- -MemoryDealer::MemoryDealer(size_t size, const char* name) - : mHeap(new MemoryHeapBase(size, 0, name)), +MemoryDealer::MemoryDealer(size_t size, const char* name, uint32_t flags) + : mHeap(new MemoryHeapBase(size, flags, name)), mAllocator(new SimpleBestFitAllocator(size)) { }