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

Unified Diff: base/memory/discardable_memory.h

Issue 114923005: base: Discardable memory types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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: base/memory/discardable_memory.h
diff --git a/base/memory/discardable_memory.h b/base/memory/discardable_memory.h
index cbc2db630a86f6e5a7b5483723cd52f75fecf380..7ca5cb6e1e76a834ed512ee16a292df2a2e9696f 100644
--- a/base/memory/discardable_memory.h
+++ b/base/memory/discardable_memory.h
@@ -5,6 +5,8 @@
#ifndef BASE_MEMORY_DISCARDABLE_MEMORY_H_
#define BASE_MEMORY_DISCARDABLE_MEMORY_H_
+#include <vector>
+
#include "base/base_export.h"
#include "base/basictypes.h"
#include "base/compiler_specific.h"
@@ -12,6 +14,13 @@
namespace base {
+enum DiscardableMemoryType {
+ DISCARDABLE_MEMORY_NONE,
+ DISCARDABLE_MEMORY_ANDROID,
reveman 2013/12/13 18:21:53 Follow up patches will replace this with DISCARDAB
+ DISCARDABLE_MEMORY_MAC,
reveman 2013/12/13 18:21:53 We might want to rename this to DISCARDABLE_MEMORY
+ DISCARDABLE_MEMORY_EMULATED
+};
+
enum LockDiscardableMemoryStatus {
reveman 2013/12/16 21:05:51 How about we rename this to DiscardableMemoryLockS
Philippe 2013/12/17 14:28:21 SGTM
reveman 2013/12/18 08:12:38 Done.
DISCARDABLE_MEMORY_FAILED = -1,
DISCARDABLE_MEMORY_PURGED = 0,
@@ -53,9 +62,15 @@ class BASE_EXPORT DiscardableMemory {
public:
virtual ~DiscardableMemory() {}
- // Check whether the system supports discardable memory natively. Returns
- // false if the support is emulated.
- static bool SupportedNatively();
+ // Get system supported discardable memory types. Preferred type at the front
+ // of vector.
+ static const std::vector<DiscardableMemoryType>& GetSupportedTypes();
+
+ // Set the current discardable memory type.
+ static void SetType(DiscardableMemoryType type);
+
+ // Get the current discardable memory type.
+ static DiscardableMemoryType GetType();
static scoped_ptr<DiscardableMemory> CreateLockedMemory(size_t size);

Powered by Google App Engine
This is Rietveld 408576698