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

Unified Diff: base/memory/discardable_memory_shmem.h

Issue 681713002: Update from chromium https://crrev.com/301315 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 2 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_manager_unittest.cc ('k') | base/memory/discardable_memory_shmem.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/discardable_memory_shmem.h
diff --git a/base/memory/discardable_memory_ashmem.h b/base/memory/discardable_memory_shmem.h
similarity index 54%
copy from base/memory/discardable_memory_ashmem.h
copy to base/memory/discardable_memory_shmem.h
index 392f29004f3a98568d74807e8eed50fb2281ebad..d25f84cb46dbdb364d1a86dbf4c9286c8759d02e 100644
--- a/base/memory/discardable_memory_ashmem.h
+++ b/base/memory/discardable_memory_shmem.h
@@ -2,30 +2,28 @@
// 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_
+#ifndef BASE_MEMORY_DISCARDABLE_MEMORY_SHMEM_H_
+#define BASE_MEMORY_DISCARDABLE_MEMORY_SHMEM_H_
#include "base/memory/discardable_memory.h"
-#include "base/macros.h"
#include "base/memory/discardable_memory_manager.h"
namespace base {
-namespace internal {
+class DiscardableSharedMemory;
-class DiscardableAshmemChunk;
-class DiscardableMemoryAshmemAllocator;
-class DiscardableMemoryManager;
+namespace internal {
-class DiscardableMemoryAshmem
+class DiscardableMemoryShmem
: public DiscardableMemory,
public internal::DiscardableMemoryManagerAllocation {
public:
- explicit DiscardableMemoryAshmem(size_t bytes,
- DiscardableMemoryAshmemAllocator* allocator,
- DiscardableMemoryManager* manager);
+ explicit DiscardableMemoryShmem(size_t bytes);
+ virtual ~DiscardableMemoryShmem();
+
+ static void ReleaseFreeMemory();
- virtual ~DiscardableMemoryAshmem();
+ static void PurgeForTesting();
bool Initialize();
@@ -38,18 +36,17 @@ class DiscardableMemoryAshmem
virtual bool AllocateAndAcquireLock() override;
virtual void ReleaseLock() override;
virtual void Purge() override;
+ virtual bool IsMemoryResident() const override;
private:
const size_t bytes_;
- DiscardableMemoryAshmemAllocator* const allocator_;
- DiscardableMemoryManager* const manager_;
+ scoped_ptr<DiscardableSharedMemory> shared_memory_;
bool is_locked_;
- scoped_ptr<DiscardableAshmemChunk> ashmem_chunk_;
- DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryAshmem);
+ DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryShmem);
};
} // namespace internal
} // namespace base
-#endif // BASE_MEMORY_DISCARDABLE_MEMORY_ASHMEM_H_
+#endif // BASE_MEMORY_DISCARDABLE_MEMORY_SHMEM_H_
« no previous file with comments | « base/memory/discardable_memory_manager_unittest.cc ('k') | base/memory/discardable_memory_shmem.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698