Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(563)

Side by Side Diff: base/allocator/allocator_shim_override_ucrt_symbols_win.h

Issue 2552333002: Change the CRT initialization to create a new heap for Chrome.dll. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/trace_event/malloc_dump_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This header defines symbols to override the same functions in the Visual C++ 5 // This header defines symbols to override the same functions in the Visual C++
6 // CRT implementation. 6 // CRT implementation.
7 7
8 #ifdef BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_UCRT_SYMBOLS_WIN_H_ 8 #ifdef BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_UCRT_SYMBOLS_WIN_H_
9 #error This header is meant to be included only once by allocator_shim.cc 9 #error This header is meant to be included only once by allocator_shim.cc
10 #endif 10 #endif
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 } 56 }
57 57
58 __declspec(restrict) void* realloc(void* ptr, size_t size) { 58 __declspec(restrict) void* realloc(void* ptr, size_t size) {
59 return ShimRealloc(ptr, size); 59 return ShimRealloc(ptr, size);
60 } 60 }
61 61
62 __declspec(restrict) void* calloc(size_t n, size_t size) { 62 __declspec(restrict) void* calloc(size_t n, size_t size) {
63 return ShimCalloc(n, size); 63 return ShimCalloc(n, size);
64 } 64 }
65 65
66 // The symbols
67 // * __acrt_heap
68 // * __acrt_initialize_heap
69 // * __acrt_uninitialize_heap
70 // * _get_heap_handle
71 // must be overridden all or none, as they are otherwise supplied
72 // by heap_handle.obj in the ucrt.lib file.
73 HANDLE __acrt_heap = nullptr;
74
75 bool __acrt_initialize_heap() {
76 __acrt_heap = ::HeapCreate(0, 0, 0);
Will Harris 2016/12/06 19:46:35 do these flags match the process heap?
Sigurður Ásgeirsson 2016/12/06 20:28:15 I believe so, the only flags documented are HEAP
Will Harris 2016/12/06 21:33:09 is HeapSetInformation called on this heap as well?
77 return true;
78 }
79
80 bool __acrt_uninitialize_heap() {
81 ::HeapDestroy(__acrt_heap);
82 __acrt_heap = nullptr;
83 return true;
84 }
85
86 intptr_t _get_heap_handle(void) {
87 return reinterpret_cast<intptr_t>(__acrt_heap);
88 }
89
66 // The default dispatch translation unit has to define also the following 90 // The default dispatch translation unit has to define also the following
67 // symbols (unless they are ultimately routed to the system symbols): 91 // symbols (unless they are ultimately routed to the system symbols):
68 // void malloc_stats(void); 92 // void malloc_stats(void);
69 // int mallopt(int, int); 93 // int mallopt(int, int);
70 // struct mallinfo mallinfo(void); 94 // struct mallinfo mallinfo(void);
71 // size_t malloc_size(void*); 95 // size_t malloc_size(void*);
72 // size_t malloc_usable_size(const void*); 96 // size_t malloc_usable_size(const void*);
73 97
74 } // extern "C" 98 } // extern "C"
OLDNEW
« no previous file with comments | « no previous file | base/trace_event/malloc_dump_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698