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

Side by Side Diff: base/allocator/allocator_shim_win.cc

Issue 872153002: Restore debug allocator functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include <malloc.h> 5 #include <malloc.h>
6 #include <new.h> 6 #include <new.h>
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 10
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 if (elem_size != 0 && size / elem_size != n) 246 if (elem_size != 0 && size / elem_size != n)
247 return NULL; 247 return NULL;
248 return realloc(p, size); 248 return realloc(p, size);
249 } 249 }
250 250
251 // calloc_impl.c 251 // calloc_impl.c
252 void* _calloc_impl(size_t n, size_t size) { 252 void* _calloc_impl(size_t n, size_t size) {
253 return calloc(n, size); 253 return calloc(n, size);
254 } 254 }
255 255
256 #ifndef NDEBUG
257 #undef malloc
258 #undef free
259 #undef calloc
260
261 static int error_handler(int reportType) {
262 switch (reportType) {
263 case 0: // _CRT_WARN
264 __debugbreak();
265 return 0;
266
267 case 1: // _CRT_ERROR
268 __debugbreak();
269 return 0;
270
271 case 2: // _CRT_ASSERT
272 __debugbreak();
273 return 0;
274 }
275 char* p = NULL;
276 *p = '\0';
277 return 0;
278 }
279
280 int _CrtDbgReport(int reportType,
281 const char*,
282 int,
283 const char*,
284 const char*,
285 ...) {
286 return error_handler(reportType);
287 }
288
289 int _CrtDbgReportW(int reportType,
290 const wchar_t*,
291 int,
292 const wchar_t*,
293 const wchar_t*,
294 ...) {
295 return error_handler(reportType);
296 }
297
298 int _CrtSetReportMode(int, int) {
299 return 0;
300 }
301
302 void* _malloc_dbg(size_t size, int, const char*, int) {
303 return malloc(size);
304 }
305
306 void* _realloc_dbg(void* ptr, size_t size, int, const char*, int) {
307 return realloc(ptr, size);
308 }
309
310 void _free_dbg(void* ptr, int) {
311 free(ptr);
312 }
313
314 void* _calloc_dbg(size_t n, size_t size, int, const char*, int) {
315 return calloc(n, size);
316 }
317 #endif // NDEBUG
318
256 } // extern C 319 } // extern C
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698