blob: 422dfe0da762049b6cb51c788ac3338a982fe721 [file] [log] [blame]
siggi25da2db2016-07-18 14:37:441// Copyright 2016 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Thin allocation wrappers for the windows heap. This file should be deleted
6// once the win-specific allocation shim has been removed, and the generic shim
7// has becaome the default.
8
9#ifndef BASE_ALLOCATOR_WINHEAP_STUBS_H_
10#define BASE_ALLOCATOR_WINHEAP_STUBS_H_
11
12#include <stdint.h>
13
14namespace base {
15namespace allocator {
16
17// Set to true if the link-time magic has successfully hooked into the CRT's
18// heap initialization.
19extern bool g_is_win_shim_layer_initialized;
20
21// Thin wrappers to implement the standard C allocation semantics on the
22// CRT's Windows heap.
23void* WinHeapMalloc(size_t size);
siggi46e1b072016-09-09 16:43:3124void WinHeapFree(void* ptr);
siggi25da2db2016-07-18 14:37:4425void* WinHeapRealloc(void* ptr, size_t size);
26
siggi46e1b072016-09-09 16:43:3127// Returns a lower-bound estimate for the full amount of memory consumed by the
28// the allocation |ptr|.
29size_t WinHeapGetSizeEstimate(void* ptr);
30
siggi25da2db2016-07-18 14:37:4431// Call the new handler, if one has been set.
32// Returns true on successfully calling the handler, false otherwise.
33bool WinCallNewHandler(size_t size);
34
35} // namespace allocator
36} // namespace base
37
38#endif // BASE_ALLOCATOR_WINHEAP_STUBS_H_