| Index: base/allocator/winheap_stubs_win.cc
|
| diff --git a/base/allocator/winheap_stubs_win.cc b/base/allocator/winheap_stubs_win.cc
|
| index 3cbbfaf038d99c3c852d6cc857e0916257fef10f..42f40dc8ad4cd48aa9ceb75d8a46b98981300fab 100644
|
| --- a/base/allocator/winheap_stubs_win.cc
|
| +++ b/base/allocator/winheap_stubs_win.cc
|
| @@ -13,6 +13,8 @@
|
| #include <new.h>
|
| #include <windows.h>
|
|
|
| +#include "base/bits.h"
|
| +
|
| namespace base {
|
| namespace allocator {
|
|
|
| @@ -51,6 +53,27 @@ void* WinHeapRealloc(void* ptr, size_t size) {
|
| return nullptr;
|
| }
|
|
|
| +size_t WinHeapGetSizeEstimate(void* ptr) {
|
| + if (!ptr)
|
| + return 0;
|
| +
|
| + // Get the user size of the allocation.
|
| + size_t size = HeapSize(get_heap_handle(), 0, ptr);
|
| +
|
| + // Account for the 8-byte HEAP_HEADER preceding the block.
|
| + size += 8;
|
| +
|
| +// Round up to the nearest allocation granularity, which is 8 for
|
| +// 32 bit machines, and 16 for 64 bit machines.
|
| +#if defined(ARCH_CPU_64_BITS)
|
| + const size_t kAllocationGranularity = 16;
|
| +#else
|
| + const size_t kAllocationGranularity = 8;
|
| +#endif
|
| +
|
| + return base::bits::Align(size, kAllocationGranularity);
|
| +}
|
| +
|
| // Call the new handler, if one has been set.
|
| // Returns true on successfully calling the handler, false otherwise.
|
| bool WinCallNewHandler(size_t size) {
|
|
|