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

Unified Diff: content/common/host_discardable_shared_memory_manager.cc

Issue 1001873002: base: Rename discardable memory allocator interface and remove unnecessary class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-dm-types
Patch Set: rebase Created 5 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: content/common/host_discardable_shared_memory_manager.cc
diff --git a/content/common/host_discardable_shared_memory_manager.cc b/content/common/host_discardable_shared_memory_manager.cc
index 3d2be9d22c1e32bcad935e4cc8694b60e1282df7..d84529ac8889948cd4ce7116e95797795d8f40c5 100644
--- a/content/common/host_discardable_shared_memory_manager.cc
+++ b/content/common/host_discardable_shared_memory_manager.cc
@@ -9,6 +9,7 @@
#include "base/callback.h"
#include "base/debug/crash_logging.h"
#include "base/lazy_instance.h"
+#include "base/memory/discardable_memory.h"
#include "base/numerics/safe_math.h"
#include "base/profiler/scoped_tracker.h"
#include "base/strings/string_number_conversions.h"
@@ -18,19 +19,18 @@
namespace content {
namespace {
-class DiscardableMemoryShmemChunkImpl
- : public base::DiscardableMemoryShmemChunk {
+class DiscardableMemoryImpl : public base::DiscardableMemory {
public:
- explicit DiscardableMemoryShmemChunkImpl(
+ explicit DiscardableMemoryImpl(
scoped_ptr<base::DiscardableSharedMemory> shared_memory)
: shared_memory_(shared_memory.Pass()), is_locked_(true) {}
- ~DiscardableMemoryShmemChunkImpl() override {
+ ~DiscardableMemoryImpl() override {
if (is_locked_)
shared_memory_->Unlock(0, 0);
shared_memory_->Purge(base::Time::Now());
}
- // Overridden from base::DiscardableMemoryShmemChunk:
+ // Overridden from base::DiscardableMemory:
bool Lock() override {
DCHECK(!is_locked_);
@@ -55,7 +55,7 @@ class DiscardableMemoryShmemChunkImpl
scoped_ptr<base::DiscardableSharedMemory> shared_memory_;
bool is_locked_;
- DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryShmemChunkImpl);
+ DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryImpl);
};
base::LazyInstance<HostDiscardableSharedMemoryManager>
@@ -98,7 +98,7 @@ HostDiscardableSharedMemoryManager::current() {
return g_discardable_shared_memory_manager.Pointer();
}
-scoped_ptr<base::DiscardableMemoryShmemChunk>
+scoped_ptr<base::DiscardableMemory>
HostDiscardableSharedMemoryManager::AllocateLockedDiscardableMemory(
size_t size) {
// Note: Use DiscardableSharedMemoryHeap for in-process allocation
@@ -110,7 +110,7 @@ HostDiscardableSharedMemoryManager::AllocateLockedDiscardableMemory(
scoped_ptr<base::DiscardableSharedMemory> memory(
new base::DiscardableSharedMemory(handle));
CHECK(memory->Map(size));
- return make_scoped_ptr(new DiscardableMemoryShmemChunkImpl(memory.Pass()));
+ return make_scoped_ptr(new DiscardableMemoryImpl(memory.Pass()));
}
void HostDiscardableSharedMemoryManager::

Powered by Google App Engine
This is Rietveld 408576698