Index: base/allocator/allocator_shim_win.cc |
diff --git a/base/allocator/allocator_shim_win.cc b/base/allocator/allocator_shim_win.cc |
index 1e7fe19f9520e0fd091c521e7d02ce306cd21c4e..a1473e5fd29f104f5759ade6982ca40a72848e96 100644 |
--- a/base/allocator/allocator_shim_win.cc |
+++ b/base/allocator/allocator_shim_win.cc |
@@ -253,4 +253,67 @@ void* _calloc_impl(size_t n, size_t size) { |
return calloc(n, size); |
} |
+#ifndef NDEBUG |
+#undef malloc |
+#undef free |
+#undef calloc |
+ |
+static int error_handler(int reportType) { |
+ switch (reportType) { |
+ case 0: // _CRT_WARN |
+ __debugbreak(); |
+ return 0; |
+ |
+ case 1: // _CRT_ERROR |
+ __debugbreak(); |
+ return 0; |
+ |
+ case 2: // _CRT_ASSERT |
+ __debugbreak(); |
+ return 0; |
+ } |
+ char* p = NULL; |
+ *p = '\0'; |
+ return 0; |
+} |
+ |
+int _CrtDbgReport(int reportType, |
+ const char*, |
+ int, |
+ const char*, |
+ const char*, |
+ ...) { |
+ return error_handler(reportType); |
+} |
+ |
+int _CrtDbgReportW(int reportType, |
+ const wchar_t*, |
+ int, |
+ const wchar_t*, |
+ const wchar_t*, |
+ ...) { |
+ return error_handler(reportType); |
+} |
+ |
+int _CrtSetReportMode(int, int) { |
+ return 0; |
+} |
+ |
+void* _malloc_dbg(size_t size, int, const char*, int) { |
+ return malloc(size); |
+} |
+ |
+void* _realloc_dbg(void* ptr, size_t size, int, const char*, int) { |
+ return realloc(ptr, size); |
+} |
+ |
+void _free_dbg(void* ptr, int) { |
+ free(ptr); |
+} |
+ |
+void* _calloc_dbg(size_t n, size_t size, int, const char*, int) { |
+ return calloc(n, size); |
+} |
+#endif // NDEBUG |
+ |
} // extern C |