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

Unified Diff: Source/wtf/DiscardableMemory.h

Issue 87983002: Add WTF::DiscardableMemory. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update comment Created 7 years, 1 month 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 | « Source/platform/exported/Platform.cpp ('k') | Source/wtf/WTFPlatform.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/DiscardableMemory.h
diff --git a/public/platform/WebDiscardableMemory.h b/Source/wtf/DiscardableMemory.h
similarity index 87%
copy from public/platform/WebDiscardableMemory.h
copy to Source/wtf/DiscardableMemory.h
index 0cdcfe383859b18f11da4db7a170b3fe5ea29879..217034d7ab97ac41dbe0a952ec6baa329fa76444 100644
--- a/public/platform/WebDiscardableMemory.h
+++ b/Source/wtf/DiscardableMemory.h
@@ -23,16 +23,16 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebDiscardableMemory_h
-#define WebDiscardableMemory_h
+#ifndef WTF_DiscardableMemory_h
+#define WTF_DiscardableMemory_h
-namespace blink {
+namespace WTF {
// A memory allocation that can be automatically discarded by the operating
// system under memory pressure.
//
// Discardable usage is typically:
-// WebDiscardableMemory* mem = allocateAndLockedDiscardableMemory(1024*1024);
+// DiscardableMemory* mem = WTFPlatform::getInstance()->allocateAndLockedDiscardableMemory(1024*1024);
// void* data = mem->data();
// memset(data, 3, 1024*1024);
// mem->unlock();
@@ -46,17 +46,17 @@ namespace blink {
// ... use mem->data() as much as you want
// mem->unlock();
//
-class WebDiscardableMemory {
+class DiscardableMemory {
public:
// Must not be called while locked.
- virtual ~WebDiscardableMemory() { }
+ virtual ~DiscardableMemory() { }
// Locks the memory, prevent it from being discarded. Once locked. you may
// obtain a pointer to that memory using the data() method.
//
// lock() may return false, indicating that the underlying memory was
- // discarded and that the lock failed. In this case, the
- // WebDiscardableMemory is effectively dead.
+ // discarded and that the lock failed. In this case, the DiscardableMemory
+ // is effectively dead.
//
// Nested calls to lock are not allowed.
virtual bool lock() = 0;
@@ -70,6 +70,6 @@ public:
virtual void unlock() = 0;
};
-} // namespace blink
+} // namespace WTF
#endif
« no previous file with comments | « Source/platform/exported/Platform.cpp ('k') | Source/wtf/WTFPlatform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698