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

Unified Diff: base/allocator/winheap_stubs_win.h

Issue 2143693003: Start refactoring Windows allocator shim in prep for hooking in generic allocator shim on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add back necessary includes. Created 4 years, 5 months 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
Index: base/allocator/winheap_stubs_win.h
diff --git a/base/allocator/winheap_stubs_win.h b/base/allocator/winheap_stubs_win.h
new file mode 100644
index 0000000000000000000000000000000000000000..103170a1690e6fd270c9b7601db140d9050bf595
--- /dev/null
+++ b/base/allocator/winheap_stubs_win.h
@@ -0,0 +1,35 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
Primiano Tucci (use gerrit) 2016/07/13 17:42:49 nit: drop your wayback machine :P (also the new co
Sigurður Ásgeirsson 2016/07/13 18:47:45 Copy-paste FTW.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Thin allocation wrappers for the windows heap. This file should be deleted
+// once the win-specific allocation shim has been removed, and the generic shim
+// has becaome the default.
+
+#ifndef BASE_ALLOCATOR_ALLOCATOR_WINHEAP_STUBS_H_
Primiano Tucci (use gerrit) 2016/07/13 17:42:49 nit: s/ALLOCATOR_ALLOCATOR_/ALLOCATOR_/
Sigurður Ásgeirsson 2016/07/13 18:47:45 and again :/
+#define BASE_ALLOCATOR_ALLOCATOR_WINHEAP_STUBS_H_
+
+#include <windows.h>
Primiano Tucci (use gerrit) 2016/07/13 17:42:49 not sure you need this windows.h here. Looks like
Sigurður Ásgeirsson 2016/07/13 18:47:45 Done.
+
+namespace base {
+namespace allocator {
+
+// Set to true if the link-time magic has successfully hooked into the CRT's
+// heap initialization.
+extern bool g_is_win_shim_layer_initialized;
+
+// Thin wrappers to implement the standard C allocation semantics on the
+// CRT's Windows heap.
+void* WinHeapMalloc(size_t size);
+void WinHeapFree(void* size);
+void* WinHeapRealloc(void* ptr, size_t size);
+void* WinHeapCalloc(size_t n, size_t elem_size);
+
+// Call the new handler, if one has been set.
+// Returns true on successfully calling the handler, false otherwise.
+bool WinCallNewHandler(size_t size);
+
+} // namespace allocator
+} // namespace base
+
+#endif // BASE_ALLOCATOR_ALLOCATOR_WINHEAP_STUBS_H_

Powered by Google App Engine
This is Rietveld 408576698