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

Unified 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: Add a test per Will's request. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/allocator/allocator_shim_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/allocator/allocator_shim_override_ucrt_symbols_win.h
diff --git a/base/allocator/allocator_shim_override_ucrt_symbols_win.h b/base/allocator/allocator_shim_override_ucrt_symbols_win.h
index 2aa872f1b3fbb1c5d4d7d120f96b5383f2d8b54d..b8d0d91ff57d6f4a5bac5bcf912c839ab12d580b 100644
--- a/base/allocator/allocator_shim_override_ucrt_symbols_win.h
+++ b/base/allocator/allocator_shim_override_ucrt_symbols_win.h
@@ -63,6 +63,30 @@ __declspec(restrict) void* calloc(size_t n, size_t size) {
return ShimCalloc(n, size);
}
+// The symbols
+// * __acrt_heap
+// * __acrt_initialize_heap
+// * __acrt_uninitialize_heap
+// * _get_heap_handle
+// must be overridden all or none, as they are otherwise supplied
+// by heap_handle.obj in the ucrt.lib file.
+HANDLE __acrt_heap = nullptr;
+
+bool __acrt_initialize_heap() {
+ __acrt_heap = ::HeapCreate(0, 0, 0);
+ return true;
+}
+
+bool __acrt_uninitialize_heap() {
+ ::HeapDestroy(__acrt_heap);
+ __acrt_heap = nullptr;
+ return true;
+}
+
+intptr_t _get_heap_handle(void) {
+ return reinterpret_cast<intptr_t>(__acrt_heap);
+}
+
// The default dispatch translation unit has to define also the following
// symbols (unless they are ultimately routed to the system symbols):
// void malloc_stats(void);
« no previous file with comments | « no previous file | base/allocator/allocator_shim_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698