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

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: Use DiscardableMemoryController on Android 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_ashmem.h b/base/memory/discardable_memory_ashmem.h
new file mode 100644
index 0000000000000000000000000000000000000000..04b3ade2b5d047937696e5015f5c81392d776d19
--- /dev/null
+++ b/base/memory/discardable_memory_ashmem.h
@@ -0,0 +1,40 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// 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_ASHMEM_H_
+#define BASE_MEMORY_DISCARDABLE_MEMORY_ASHMEM_H_
+
+#include "base/memory/discardable_memory.h"
+
+#include "base/basictypes.h"
+#include "base/memory/discardable_memory_manager.h"
+
+namespace base {
+namespace internal {
+
+class DiscardableMemoryAshmem : public DiscardableMemory {
+ public:
+ explicit DiscardableMemoryAshmem(DiscardableMemoryManager* manager,
+ size_t size);
+ virtual ~DiscardableMemoryAshmem();
+
+ bool Initialize();
+
+ // DiscardableMemory:
+ virtual DiscardableMemoryLockStatus Lock() OVERRIDE;
+ virtual void Unlock() OVERRIDE;
+ virtual void* Memory() const OVERRIDE;
+
+ private:
+ DiscardableMemoryManager* const manager_;
+ DiscardableMemoryManager::AllocationId allocation_id_;
+ void* memory_;
+
+ DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryAshmem);
+};
+
+} // namespace internal
+} // namespace base
+
+#endif // BASE_MEMORY_DISCARDABLE_MEMORY_ASHMEM_H_

Powered by Google App Engine
This is Rietveld 408576698