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

Unified Diff: base/memory/discardable_memory_linux.cc

Issue 114923005: base: Discardable memory types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add switches::kUseDiscardableMemory to kForwardSwitches Created 6 years, 11 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_emulated.cc ('k') | base/memory/discardable_memory_mac.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/discardable_memory_linux.cc
diff --git a/base/memory/discardable_memory_linux.cc b/base/memory/discardable_memory_linux.cc
index 92e39e5e7d421f3f7acd67ae39b7c9e95b060cd2..33c85bdcb86450e16c8463ea553c689ea113b609 100644
--- a/base/memory/discardable_memory_linux.cc
+++ b/base/memory/discardable_memory_linux.cc
@@ -2,24 +2,42 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/memory/discardable_memory.h"
+
+#include "base/logging.h"
#include "base/memory/discardable_memory_emulated.h"
namespace base {
// static
-bool DiscardableMemory::SupportedNatively() {
- return false;
+void DiscardableMemory::GetSupportedTypes(
+ std::vector<DiscardableMemoryType>* types) {
+ const DiscardableMemoryType supported_types[] = {
+ DISCARDABLE_MEMORY_TYPE_EMULATED
+ };
+ types->assign(supported_types, supported_types + arraysize(supported_types));
}
// static
-scoped_ptr<DiscardableMemory> DiscardableMemory::CreateLockedMemory(
- size_t size) {
- scoped_ptr<internal::DiscardableMemoryEmulated> memory(
- new internal::DiscardableMemoryEmulated(size));
- if (!memory->Initialize())
- return scoped_ptr<DiscardableMemory>();
-
- return memory.PassAs<DiscardableMemory>();
+scoped_ptr<DiscardableMemory> DiscardableMemory::CreateLockedMemoryWithType(
+ DiscardableMemoryType type, size_t size) {
+ switch (type) {
+ case DISCARDABLE_MEMORY_TYPE_NONE:
+ case DISCARDABLE_MEMORY_TYPE_ANDROID:
+ case DISCARDABLE_MEMORY_TYPE_MAC:
+ return scoped_ptr<DiscardableMemory>();
+ case DISCARDABLE_MEMORY_TYPE_EMULATED: {
+ scoped_ptr<internal::DiscardableMemoryEmulated> memory(
+ new internal::DiscardableMemoryEmulated(size));
+ if (!memory->Initialize())
+ return scoped_ptr<DiscardableMemory>();
+
+ return memory.PassAs<DiscardableMemory>();
+ }
+ }
+
+ NOTREACHED();
+ return scoped_ptr<DiscardableMemory>();
}
// static
« no previous file with comments | « base/memory/discardable_memory_emulated.cc ('k') | base/memory/discardable_memory_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698