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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | base/test/test_discardable_memory_allocator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_MEMORY_DISCARDABLE_MEMORY_H_ 5 #ifndef BASE_MEMORY_DISCARDABLE_MEMORY_H_
6 #define BASE_MEMORY_DISCARDABLE_MEMORY_H_ 6 #define BASE_MEMORY_DISCARDABLE_MEMORY_H_
7 7
8 #include "base/base_export.h" 8 #include "base/base_export.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // Locks the memory so that it will not be purged by the system. Returns 45 // Locks the memory so that it will not be purged by the system. Returns
46 // true on success. If the return value is false then this object should be 46 // true on success. If the return value is false then this object should be
47 // discarded and a new one should be created. 47 // discarded and a new one should be created.
48 virtual bool Lock() WARN_UNUSED_RESULT = 0; 48 virtual bool Lock() WARN_UNUSED_RESULT = 0;
49 49
50 // Unlocks the memory so that it can be purged by the system. Must be called 50 // Unlocks the memory so that it can be purged by the system. Must be called
51 // after every successful lock call. 51 // after every successful lock call.
52 virtual void Unlock() = 0; 52 virtual void Unlock() = 0;
53 53
54 // Returns the memory address held by this object. The object must be locked 54 // Returns the memory address held by this object. The object must be locked
55 // before calling this. Otherwise, this will cause a DCHECK error. 55 // before calling this.
56 virtual void* Memory() const = 0; 56 virtual void* data() const = 0;
57
58 // Handy method to simplify calling data() with a reinterpret_cast.
59 template<typename T> const T* data_as() const {
60 return reinterpret_cast<const T*>(data());
61 }
57 }; 62 };
58 63
59 } // namespace base 64 } // namespace base
60 65
61 #endif // BASE_MEMORY_DISCARDABLE_MEMORY_H_ 66 #endif // BASE_MEMORY_DISCARDABLE_MEMORY_H_
OLDNEW
« 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