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

Unified Diff: base/memory/discardable_memory_ashmem.h

Issue 195863005: Use DiscardableMemoryManager on Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nits Created 6 years, 9 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
Index: base/memory/discardable_memory_ashmem.h
diff --git a/base/memory/discardable_memory_malloc.h b/base/memory/discardable_memory_ashmem.h
similarity index 42%
copy from base/memory/discardable_memory_malloc.h
copy to base/memory/discardable_memory_ashmem.h
index 7729ce5c49b9e9c38bb1bc88e51fc279d81e564f..1907e72bc1e2967f0cd1ffdfa11092d6625d7284 100644
--- a/base/memory/discardable_memory_malloc.h
+++ b/base/memory/discardable_memory_ashmem.h
@@ -2,34 +2,39 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_MEMORY_DISCARDABLE_MEMORY_MALLOC_H_
-#define BASE_MEMORY_DISCARDABLE_MEMORY_MALLOC_H_
+#ifndef BASE_MEMORY_DISCARDABLE_MEMORY_ASHMEM_H_
+#define BASE_MEMORY_DISCARDABLE_MEMORY_ASHMEM_H_
#include "base/memory/discardable_memory.h"
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "base/memory/discardable_memory_manager.h"
+
namespace base {
namespace internal {
-class DiscardableMemoryMalloc : public DiscardableMemory {
+class DiscardableMemoryAshmem : public DiscardableMemory {
public:
- explicit DiscardableMemoryMalloc(size_t size);
- virtual ~DiscardableMemoryMalloc();
+ DiscardableMemoryAshmem(DiscardableMemoryManager* manager, size_t size);
+ virtual ~DiscardableMemoryAshmem();
bool Initialize();
- // Overridden from DiscardableMemory:
+ // DiscardableMemory:
virtual DiscardableMemoryLockStatus Lock() OVERRIDE;
virtual void Unlock() OVERRIDE;
virtual void* Memory() const OVERRIDE;
private:
- scoped_ptr<uint8, FreeDeleter> memory_;
- const size_t size_;
+ DiscardableMemoryManager* const manager_;
+ const DiscardableMemoryManager::AllocationId allocation_id_;
+ void* memory_;
- DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryMalloc);
+ DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryAshmem);
};
} // namespace internal
} // namespace base
-#endif // BASE_MEMORY_DISCARDABLE_MEMORY_MALLOC_H_
+#endif // BASE_MEMORY_DISCARDABLE_MEMORY_ASHMEM_H_

Powered by Google App Engine
This is Rietveld 408576698