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"
16 namespace edash_packager {
22 explicit IoCache(uint64_t cache_size);
31 uint64_t
Read(
void* buffer, uint64_t size);
40 uint64_t
Write(
const void* buffer, uint64_t size);
67 uint64_t BytesCachedInternal();
68 uint64_t BytesFreeInternal();
70 const uint64_t cache_size_;
72 base::WaitableEvent read_event_;
73 base::WaitableEvent write_event_;
74 std::vector<uint8_t> circular_buffer_;
75 const uint8_t* end_ptr_;
80 DISALLOW_COPY_AND_ASSIGN(
IoCache);
86 #endif // PACKAGER_FILE_IO_CACHE_H