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

Unified Diff: base/metrics/persistent_memory_allocator.h

Issue 2000523003: Fully support read/write memory-mapped files for persistent memory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 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
« no previous file with comments | « no previous file | 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 56edd2ca24e0131d633b7aea805bd80e3681cb66..e1c85904b2168351e5d981acd9a22fe22b8218d4 100644
--- a/base/metrics/persistent_memory_allocator.h
+++ b/base/metrics/persistent_memory_allocator.h
@@ -386,21 +386,25 @@ class BASE_EXPORT SharedPersistentMemoryAllocator
// This allocator takes a memory-mapped file object and performs allocation
-// from it. The allocator takes ownership of the file object. Only read access
-// is provided due to limitions of the MemoryMappedFile class.
+// from it. The allocator takes ownership of the file object.
class BASE_EXPORT FilePersistentMemoryAllocator
: public PersistentMemoryAllocator {
public:
+ // A |max_size| of zero will use the length of the file as the maximum
+ // size. The |file| object must have been already created with sufficient
+ // permissions (read, read/write, or read/write/extend).
FilePersistentMemoryAllocator(std::unique_ptr<MemoryMappedFile> file,
+ size_t max_size,
uint64_t id,
- base::StringPiece name);
+ base::StringPiece name,
+ bool read_only);
~FilePersistentMemoryAllocator() override;
// Ensure that the file isn't so invalid that it won't crash when passing it
// to the allocator. This doesn't guarantee the file is valid, just that it
// won't cause the program to abort. The existing IsCorrupt() call will handle
// the rest.
- static bool IsFileAcceptable(const MemoryMappedFile& file);
+ static bool IsFileAcceptable(const MemoryMappedFile& file, bool read_only);
private:
std::unique_ptr<MemoryMappedFile> mapped_file_;
« no previous file with comments | « no previous file | base/metrics/persistent_memory_allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698