7 #ifndef PACKAGER_FILE_IO_CACHE_H_
8 #define PACKAGER_FILE_IO_CACHE_H_
12 #include "packager/base/macros.h"
13 #include "packager/base/synchronization/lock.h"
14 #include "packager/base/synchronization/waitable_event.h"
21 explicit IoCache(uint64_t cache_size);
30 uint64_t
Read(
void* buffer, uint64_t size);
39 uint64_t
Write(
const void* buffer, uint64_t size);
66 uint64_t BytesCachedInternal();
67 uint64_t BytesFreeInternal();
69 const uint64_t cache_size_;
71 base::WaitableEvent read_event_;
72 base::WaitableEvent write_event_;
73 std::vector<uint8_t> circular_buffer_;
74 const uint8_t* end_ptr_;
79 DISALLOW_COPY_AND_ASSIGN(
IoCache);
84 #endif // PACKAGER_FILE_IO_CACHE_H