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

Side by Side Diff: Source/wtf/FastMalloc.cpp

Issue 22084002: Eliminate HAVE(ERRNO_H) guard. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix author Created 7 years, 4 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 | « Source/wtf/DateMath.cpp ('k') | Source/wtf/Platform.h » ('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 (c) 2005, 2007, Google Inc. 1 // Copyright (c) 2005, 2007, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserv ed. 3 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserv ed.
4 // 4 //
5 // Redistribution and use in source and binary forms, with or without 5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are 6 // modification, are permitted provided that the following conditions are
7 // met: 7 // met:
8 // 8 //
9 // * Redistributions of source code must retain the above copyright 9 // * Redistributions of source code must retain the above copyright
10 // notice, this list of conditions and the following disclaimer. 10 // notice, this list of conditions and the following disclaimer.
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 #endif 404 #endif
405 405
406 #else // FORCE_SYSTEM_MALLOC 406 #else // FORCE_SYSTEM_MALLOC
407 407
408 #include "Compiler.h" 408 #include "Compiler.h"
409 #include "TCPackedCache.h" 409 #include "TCPackedCache.h"
410 #include "TCPageMap.h" 410 #include "TCPageMap.h"
411 #include "TCSpinLock.h" 411 #include "TCSpinLock.h"
412 #include "TCSystemAlloc.h" 412 #include "TCSystemAlloc.h"
413 #include <algorithm> 413 #include <algorithm>
414 #include <errno.h>
414 #include <pthread.h> 415 #include <pthread.h>
415 #include <stdarg.h> 416 #include <stdarg.h>
416 #include <stddef.h> 417 #include <stddef.h>
417 #include <stdint.h> 418 #include <stdint.h>
418 #include <stdio.h> 419 #include <stdio.h>
419 #if HAVE(ERRNO_H)
420 #include <errno.h>
421 #endif
422 #if OS(UNIX) 420 #if OS(UNIX)
423 #include <unistd.h> 421 #include <unistd.h>
424 #endif 422 #endif
425 #if OS(WINDOWS) 423 #if OS(WINDOWS)
426 #ifndef WIN32_LEAN_AND_MEAN 424 #ifndef WIN32_LEAN_AND_MEAN
427 #define WIN32_LEAN_AND_MEAN 425 #define WIN32_LEAN_AND_MEAN
428 #endif 426 #endif
429 #include <windows.h> 427 #include <windows.h>
430 #endif 428 #endif
431 429
(...skipping 2523 matching lines...) Expand 10 before | Expand all | Expand 10 after
2955 lock_.Unlock(); 2953 lock_.Unlock();
2956 const size_t npages = class_to_pages[size_class_]; 2954 const size_t npages = class_to_pages[size_class_];
2957 2955
2958 Span* span; 2956 Span* span;
2959 { 2957 {
2960 SpinLockHolder h(&pageheap_lock); 2958 SpinLockHolder h(&pageheap_lock);
2961 span = pageheap->New(npages); 2959 span = pageheap->New(npages);
2962 if (span) pageheap->RegisterSizeClass(span, size_class_); 2960 if (span) pageheap->RegisterSizeClass(span, size_class_);
2963 } 2961 }
2964 if (span == NULL) { 2962 if (span == NULL) {
2965 #if HAVE(ERRNO_H) 2963 #if OS(WINDOWS)
2966 MESSAGE("allocation failed: %d\n", errno);
2967 #elif OS(WINDOWS)
2968 MESSAGE("allocation failed: %d\n", ::GetLastError()); 2964 MESSAGE("allocation failed: %d\n", ::GetLastError());
2969 #else 2965 #else
2970 MESSAGE("allocation failed\n"); 2966 MESSAGE("allocation failed: %d\n", errno);
2971 #endif 2967 #endif
2972 lock_.Lock(); 2968 lock_.Lock();
2973 return; 2969 return;
2974 } 2970 }
2975 ASSERT_SPAN_COMMITTED(span); 2971 ASSERT_SPAN_COMMITTED(span);
2976 ASSERT(span->length == npages); 2972 ASSERT(span->length == npages);
2977 // Cache sizeclass info eagerly. Locking is not necessary. 2973 // Cache sizeclass info eagerly. Locking is not necessary.
2978 // (Instead of being eager, we could just replace any stale info 2974 // (Instead of being eager, we could just replace any stale info
2979 // about this span, but that seems to be no better in practice.) 2975 // about this span, but that seems to be no better in practice.)
2980 for (size_t i = 0; i < npages; i++) { 2976 for (size_t i = 0; i < npages; i++) {
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after
4160 void FastMallocZone::init() 4156 void FastMallocZone::init()
4161 { 4157 {
4162 static FastMallocZone zone(pageheap, &thread_heaps, static_cast<TCMalloc_Cen tral_FreeListPadded*>(central_cache), &span_allocator, &threadheap_allocator); 4158 static FastMallocZone zone(pageheap, &thread_heaps, static_cast<TCMalloc_Cen tral_FreeListPadded*>(central_cache), &span_allocator, &threadheap_allocator);
4163 } 4159 }
4164 4160
4165 #endif // OS(DARWIN) 4161 #endif // OS(DARWIN)
4166 4162
4167 } // namespace WTF 4163 } // namespace WTF
4168 4164
4169 #endif // FORCE_SYSTEM_MALLOC 4165 #endif // FORCE_SYSTEM_MALLOC
OLDNEW
« no previous file with comments | « Source/wtf/DateMath.cpp ('k') | Source/wtf/Platform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698