OLD | NEW |
---|---|
(Empty) | |
1 // 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 #include "base/allocator/allocator_shim.h" | |
6 | |
7 #include "base/allocator/allocator_impl_win.h" | |
8 #include "base/logging.h" | |
9 | |
10 namespace { | |
11 | |
12 using base::allocator::AllocatorDispatch; | |
13 | |
14 void* WinHeapMalloc(const AllocatorDispatch*, size_t size) { | |
Primiano Tucci (use gerrit)
2016/07/12 14:51:05
Can you add some prefix to these functions (DoWinH
Sigurður Ásgeirsson
2016/07/14 19:04:27
Yeah, naming - I went apeshit with prefix and suff
| |
15 return base::allocator::WinHeapMalloc(size); | |
16 } | |
17 | |
18 void* WinHeapCalloc(const AllocatorDispatch* self, size_t n, size_t elem_size) { | |
19 return base::allocator::WinHeapCalloc(n, elem_size); | |
20 } | |
21 | |
22 void* WinHeapMemalign(const AllocatorDispatch* self, | |
23 size_t alignment, | |
24 size_t size) { | |
25 NOTREACHED() << "The windows heap does not support memalign."; | |
Primiano Tucci (use gerrit)
2016/07/12 14:51:05
I'd make this a CHECK(false), so shows up in produ
Sigurður Ásgeirsson
2016/07/14 19:04:27
Done.
| |
26 return nullptr; | |
27 } | |
28 | |
29 void* WinHeapRealloc(const AllocatorDispatch* self, | |
30 void* address, | |
31 size_t size) { | |
32 return base::allocator::WinHeapRealloc(address, size); | |
33 } | |
34 | |
35 void WinHeapFree(const AllocatorDispatch*, void* address) { | |
36 base::allocator::WinHeapFree(address); | |
37 } | |
38 | |
39 } // namespace | |
40 | |
41 const AllocatorDispatch AllocatorDispatch::default_dispatch = { | |
42 &WinHeapMalloc, | |
43 &WinHeapCalloc, | |
44 &WinHeapMemalign, | |
45 &WinHeapRealloc, | |
46 &WinHeapFree, | |
47 nullptr, /* next */ | |
48 }; | |
OLD | NEW |