blob: 9929763187889b2bb7455d83dcf9b0a5fba524cf [file] [log] [blame]
#include "third_party/blink/renderer/modules/compression/zlib_partition_alloc.h"
#include "third_party/blink/renderer/platform/wtf/allocator/partitions.h"
namespace blink {
void ZlibPartitionAlloc::Configure(z_stream* stream) {
stream->zalloc = Alloc;
stream->zfree = Free;
}
void* ZlibPartitionAlloc::Alloc(void*, uint32_t items, uint32_t size) {
// BufferMalloc is safer than FastMalloc when handling untrusted data.
return WTF::Partitions::BufferMalloc(items * size, "zlib");
}
void ZlibPartitionAlloc::Free(void*, void* address) {
WTF::Partitions::BufferFree(address);
}
} // namespace blink