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

Unified Diff: base/memory/discardable_memory.h

Issue 1124763003: Update from https://crrev.com/327068 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: update nacl, buildtools, fix display_change_notifier_unittest Created 5 years, 7 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
Index: base/memory/discardable_memory.h
diff --git a/base/memory/discardable_memory.h b/base/memory/discardable_memory.h
index a0882ccc94e9ab280ef3a82b9492cd0525b1bb9a..fc189e746341136d0190e0329d3c375be8500af2 100644
--- a/base/memory/discardable_memory.h
+++ b/base/memory/discardable_memory.h
@@ -52,8 +52,13 @@ class BASE_EXPORT DiscardableMemory {
virtual void Unlock() = 0;
// Returns the memory address held by this object. The object must be locked
- // before calling this. Otherwise, this will cause a DCHECK error.
- virtual void* Memory() const = 0;
+ // before calling this.
+ virtual void* data() const = 0;
+
+ // Handy method to simplify calling data() with a reinterpret_cast.
+ template<typename T> T* data_as() const {
+ return reinterpret_cast<T*>(data());
+ }
};
} // namespace base

Powered by Google App Engine
This is Rietveld 408576698