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

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: fix child process DiscardableMemoryImpl 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
« no previous file with comments | « content/common/host_discardable_shared_memory_manager.h ('k') | content/renderer/render_thread_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ab74ef0b156ada35e31d3d9cc247fbe9e103f230..c4fea8de54e0c7d3b2e2ab09e8485a2103a39756 100644
--- a/content/common/host_discardable_shared_memory_manager.cc
+++ b/content/common/host_discardable_shared_memory_manager.cc
@@ -11,6 +11,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"
@@ -20,23 +21,22 @@
namespace content {
namespace {
-class DiscardableMemoryShmemChunkImpl
- : public base::DiscardableMemoryShmemChunk {
+class DiscardableMemoryImpl : public base::DiscardableMemory {
public:
- DiscardableMemoryShmemChunkImpl(
- scoped_ptr<base::DiscardableSharedMemory> shared_memory,
- const base::Closure& deleted_callback)
+ DiscardableMemoryImpl(scoped_ptr<base::DiscardableSharedMemory> shared_memory,
+ const base::Closure& deleted_callback)
: shared_memory_(shared_memory.Pass()),
deleted_callback_(deleted_callback),
is_locked_(true) {}
- ~DiscardableMemoryShmemChunkImpl() override {
+
+ ~DiscardableMemoryImpl() override {
if (is_locked_)
shared_memory_->Unlock(0, 0);
deleted_callback_.Run();
}
- // Overridden from base::DiscardableMemoryShmemChunk:
+ // Overridden from base::DiscardableMemory:
bool Lock() override {
DCHECK(!is_locked_);
@@ -62,7 +62,7 @@ class DiscardableMemoryShmemChunkImpl
const base::Closure deleted_callback_;
bool is_locked_;
- DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryShmemChunkImpl);
+ DISALLOW_COPY_AND_ASSIGN(DiscardableMemoryImpl);
};
base::LazyInstance<HostDiscardableSharedMemoryManager>
@@ -107,7 +107,7 @@ HostDiscardableSharedMemoryManager::current() {
return g_discardable_shared_memory_manager.Pointer();
}
-scoped_ptr<base::DiscardableMemoryShmemChunk>
+scoped_ptr<base::DiscardableMemory>
HostDiscardableSharedMemoryManager::AllocateLockedDiscardableMemory(
size_t size) {
DiscardableSharedMemoryId new_id =
@@ -123,7 +123,7 @@ HostDiscardableSharedMemoryManager::AllocateLockedDiscardableMemory(
scoped_ptr<base::DiscardableSharedMemory> memory(
new base::DiscardableSharedMemory(handle));
CHECK(memory->Map(size));
- return make_scoped_ptr(new DiscardableMemoryShmemChunkImpl(
+ return make_scoped_ptr(new DiscardableMemoryImpl(
memory.Pass(),
base::Bind(
&HostDiscardableSharedMemoryManager::DeletedDiscardableSharedMemory,
« no previous file with comments | « content/common/host_discardable_shared_memory_manager.h ('k') | content/renderer/render_thread_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698