| 6 | namespace io { |
| 7 | |
| 8 | void AllocateIOBufferResolver::resolve(SkrAsyncServicePriority priority, IOBatchId batch, IORequestId request) SKR_NOEXCEPT |
| 9 | { |
| 10 | SkrZoneScopedNC("IOBuffer::Allocate", tracy::Color::BlueViolet); |
| 11 | auto rq = skr::static_pointer_cast<RAMRequestMixin>(request); |
| 12 | auto buf = skr::static_pointer_cast<RAMIOBuffer>(rq->destination); |
| 13 | auto pFiles = io_component<FileComponent>(rq.get()); |
| 14 | // deal with 0 block size |
| 15 | if (auto pBlocks = io_component<BlocksComponent>(rq.get())) |
| 16 | { |
| 17 | for (auto& block : pBlocks->blocks) |
| 18 | { |
| 19 | if (block.size == 0) |
| 20 | { |
| 21 | block.size = pFiles->get_fsize() - block.offset; |
| 22 | } |
| 23 | if (buf->get_size() == 0) |
| 24 | { |
| 25 | buf->size += block.size; |
| 26 | } |
| 27 | } |
| 28 | } |
| 29 | // allocate |
| 30 | if (buf->get_data() == nullptr) |
| 31 | { |
| 32 | if (buf->get_size() == 0) |
| 33 | { |
| 34 | SKR_ASSERT(0 && "invalid destination size"); |
| 35 | } |
| 36 | buf->allocate_buffer(buf->size); |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | ChunkingVFSReadResolver::ChunkingVFSReadResolver(uint64_t chunk_size) SKR_NOEXCEPT |
| 41 | : chunk_size(chunk_size) |
nothing calls this directly
no test coverage detected