MappedMemory: Support opening empty files (and extending them) / remapping files / Truncate on close

This commit is contained in:
Dr. Chat
2015-12-02 14:21:40 -06:00
committed by Ben Vanik
parent 8a9493a048
commit 0b5def1ff6
2 changed files with 62 additions and 11 deletions

View File

@@ -39,8 +39,13 @@ class MappedMemory {
uint8_t* data() const { return reinterpret_cast<uint8_t*>(data_); }
size_t size() const { return size_; }
// Close, and optionally truncate file to size
virtual void Close(uint64_t truncate_size = 0) {}
virtual void Flush() {}
// Changes the offset inside the file. This will update data() and size()!
virtual bool Remap(size_t offset, size_t length) { return false; }
protected:
std::wstring path_;
Mode mode_;