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

Unified Diff: base/metrics/persistent_memory_allocator.h

Issue 2387733002: Move memory management code into separate class for future reuse. (Closed)
Patch Set: object_free -> object_free_type Created 4 years, 2 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 | « base/debug/activity_tracker_unittest.cc ('k') | base/metrics/persistent_memory_allocator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/persistent_memory_allocator.h
diff --git a/base/metrics/persistent_memory_allocator.h b/base/metrics/persistent_memory_allocator.h
index 7004afecc024f2c79f3141417ee326127394c055..dea12a68daa4ad7186ba3903de00b7e9524ab8ca 100644
--- a/base/metrics/persistent_memory_allocator.h
+++ b/base/metrics/persistent_memory_allocator.h
@@ -56,6 +56,11 @@ class BASE_EXPORT PersistentMemoryAllocator {
// That means that multiple threads can share an iterator and the same
// reference will not be returned twice.
//
+ // The order of the items returned by an iterator matches the order in which
+ // MakeIterable() was called on them. Once an allocation is made iterable,
+ // it is always such so the only possible difference between successive
+ // iterations is for more to be added to the end.
+ //
// Iteration, in general, is tolerant of corrupted memory. It will return
// what it can and stop only when corruption forces it to. Bad corruption
// could cause the same object to be returned many times but it will
@@ -76,6 +81,17 @@ class BASE_EXPORT PersistentMemoryAllocator {
Iterator(const PersistentMemoryAllocator* allocator,
Reference starting_after);
+ // Resets the iterator back to the beginning.
+ void Reset();
+
+ // Resets the iterator, resuming from the |starting_after| reference.
+ void Reset(Reference starting_after);
+
+ // Returns the previously retrieved reference, or kReferenceNull if none.
+ // If constructor or reset with a starting_after location, this will return
+ // that value.
+ Reference GetLast();
+
// Gets the next iterable, storing that type in |type_return|. The actual
// return value is a reference to the allocation inside the allocator or
// zero if there are no more. GetNext() may still be called again at a
« no previous file with comments | « base/debug/activity_tracker_unittest.cc ('k') | base/metrics/persistent_memory_allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698