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

Unified Diff: base/memory/discardable_memory_win.cc

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_shmem_allocator.cc ('k') | base/memory/discardable_shared_memory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/discardable_memory_win.cc
diff --git a/base/memory/discardable_memory_win.cc b/base/memory/discardable_memory_win.cc
index 6a9a28df2dc6fb9bdb10c5065e444b047e00aad9..9b4e9401ce4ff7c006756a9a5ed6a245431662c9 100644
--- a/base/memory/discardable_memory_win.cc
+++ b/base/memory/discardable_memory_win.cc
@@ -6,10 +6,16 @@
#include "base/logging.h"
#include "base/memory/discardable_memory_emulated.h"
+#include "base/memory/discardable_memory_shmem.h"
namespace base {
// static
+void DiscardableMemory::ReleaseFreeMemory() {
+ internal::DiscardableMemoryShmem::ReleaseFreeMemory();
+}
+
+// static
bool DiscardableMemory::ReduceMemoryUsage() {
return internal::DiscardableMemoryEmulated::ReduceMemoryUsage();
}
@@ -18,7 +24,8 @@ bool DiscardableMemory::ReduceMemoryUsage() {
void DiscardableMemory::GetSupportedTypes(
std::vector<DiscardableMemoryType>* types) {
const DiscardableMemoryType supported_types[] = {
- DISCARDABLE_MEMORY_TYPE_EMULATED
+ DISCARDABLE_MEMORY_TYPE_EMULATED,
+ DISCARDABLE_MEMORY_TYPE_SHMEM
};
types->assign(supported_types, supported_types + arraysize(supported_types));
}
@@ -35,6 +42,14 @@ scoped_ptr<DiscardableMemory> DiscardableMemory::CreateLockedMemoryWithType(
return memory.Pass();
}
+ case DISCARDABLE_MEMORY_TYPE_SHMEM: {
+ scoped_ptr<internal::DiscardableMemoryShmem> memory(
+ new internal::DiscardableMemoryShmem(size));
+ if (!memory->Initialize())
+ return nullptr;
+
+ return memory.Pass();
+ }
case DISCARDABLE_MEMORY_TYPE_NONE:
case DISCARDABLE_MEMORY_TYPE_ASHMEM:
case DISCARDABLE_MEMORY_TYPE_MACH:
@@ -49,6 +64,7 @@ scoped_ptr<DiscardableMemory> DiscardableMemory::CreateLockedMemoryWithType(
// static
void DiscardableMemory::PurgeForTesting() {
internal::DiscardableMemoryEmulated::PurgeForTesting();
+ internal::DiscardableMemoryShmem::PurgeForTesting();
}
} // namespace base
« no previous file with comments | « base/memory/discardable_memory_shmem_allocator.cc ('k') | base/memory/discardable_shared_memory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698