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

Unified Diff: base/memory/discardable_memory.h

Issue 1094433002: base: Rename DiscardableMemory::Memory() to ::data(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mojo unittest Created 5 years, 8 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 | base/test/test_discardable_memory_allocator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/discardable_memory.h
diff --git a/base/memory/discardable_memory.h b/base/memory/discardable_memory.h
index a0882ccc94e9ab280ef3a82b9492cd0525b1bb9a..4138684cec9e9076e0e7ac23accd48f2903b772a 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> const T* data_as() const {
+ return reinterpret_cast<const T*>(data());
+ }
};
} // namespace base
« no previous file with comments | « no previous file | base/test/test_discardable_memory_allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698