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

Unified Diff: skia/ext/SkDiscardableMemory_chrome.h

Issue 23206002: skia: Added chrome implementation of SkDiscardableMemory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed OVERRIDE keyword from destructor. Created 7 years, 4 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 | « no previous file | skia/ext/SkDiscardableMemory_chrome.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/SkDiscardableMemory_chrome.h
diff --git a/skia/ext/SkDiscardableMemory_chrome.h b/skia/ext/SkDiscardableMemory_chrome.h
new file mode 100644
index 0000000000000000000000000000000000000000..fb6a8a8664754cb48dc0c0b77ae583bb5e5bb4f0
--- /dev/null
+++ b/skia/ext/SkDiscardableMemory_chrome.h
@@ -0,0 +1,33 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SKIA_EXT_SK_DISCARDABLE_MEMORY_CHROME_H_
+#define SKIA_EXT_SK_DISCARDABLE_MEMORY_CHROME_H_
+
+#include "base/memory/discardable_memory.h"
+#include "base/memory/scoped_ptr.h"
+#include "third_party/skia/src/core/SkDiscardableMemory.h"
+
+// This class implements the SkDiscardableMemory interface using
+// base::DiscardableMemory.
+class SK_API SkDiscardableMemoryChrome : public SkDiscardableMemory {
+public:
+ SkDiscardableMemoryChrome();
+ virtual ~SkDiscardableMemoryChrome();
+
+ // Initialize the SkDiscardableMemoryChrome object and lock the memory.
+ // Returns true on success. No memory is allocated if this call returns
+ // false. This call should only be called once.
+ bool InitializeAndLock(size_t bytes);
+
+ // Implementation of SkDiscardableMemory interface.
+ virtual bool lock() OVERRIDE;
+ virtual void* data() OVERRIDE;
+ virtual void unlock() OVERRIDE;
+
+private:
+ scoped_ptr<base::DiscardableMemory> discardable_;
+};
+
+#endif // SKIA_EXT_SK_DISCARDABLE_MEMORY_CHROME_H_
« no previous file with comments | « no previous file | skia/ext/SkDiscardableMemory_chrome.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698