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

Side by Side Diff: third_party/tcmalloc/chromium/src/windows/port.cc

Issue 576001: Merged third_party/tcmalloc/vendor/src(google-perftools r87) into... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Removed the unnecessary printf and ASSERT(0) Created 10 years, 9 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 | Annotate | Revision Log
Property Changes:
Deleted: svn:eol-style
- LF
OLDNEW
1 /* Copyright (c) 2007, Google Inc. 1 /* Copyright (c) 2007, Google Inc.
2 * All rights reserved. 2 * All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 destr_fn_info.destr_fn = destr_fn; 176 destr_fn_info.destr_fn = destr_fn;
177 destr_fn_info.key_for_destr_fn_arg = key; 177 destr_fn_info.key_for_destr_fn_arg = key;
178 } 178 }
179 return key; 179 return key;
180 } 180 }
181 181
182 182
183 // ----------------------------------------------------------------------- 183 // -----------------------------------------------------------------------
184 // These functions replace system-alloc.cc 184 // These functions replace system-alloc.cc
185 185
186 static SpinLock alloc_lock(SpinLock::LINKER_INITIALIZED);
187
188 // This is mostly like MmapSysAllocator::Alloc, except it does these weird 186 // This is mostly like MmapSysAllocator::Alloc, except it does these weird
189 // munmap's in the middle of the page, which is forbidden in windows. 187 // munmap's in the middle of the page, which is forbidden in windows.
190 extern void* TCMalloc_SystemAlloc(size_t size, size_t *actual_size, 188 extern void* TCMalloc_SystemAlloc(size_t size, size_t *actual_size,
191 size_t alignment) { 189 size_t alignment) {
192 SpinLockHolder sh(&alloc_lock);
193 // Align on the pagesize boundary 190 // Align on the pagesize boundary
194 const int pagesize = getpagesize(); 191 const int pagesize = getpagesize();
195 if (alignment < pagesize) alignment = pagesize; 192 if (alignment < pagesize) alignment = pagesize;
196 size = ((size + alignment - 1) / alignment) * alignment; 193 size = ((size + alignment - 1) / alignment) * alignment;
197 194
198 // Report the total number of bytes the OS actually delivered. This might be 195 // Report the total number of bytes the OS actually delivered. This might be
199 // greater than |size| because of alignment concerns. The full size is 196 // greater than |size| because of alignment concerns. The full size is
200 // necessary so that adjacent spans can be coalesced. 197 // necessary so that adjacent spans can be coalesced.
201 // TODO(antonm): proper processing of alignments 198 // TODO(antonm): proper processing of alignments
202 // in actual_size and decommitting. 199 // in actual_size and decommitting.
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 if ((strlen(fname) >= prefix_length) && 290 if ((strlen(fname) >= prefix_length) &&
294 (memcmp(fname, prefix, prefix_length) == 0)) { 291 (memcmp(fname, prefix, prefix_length) == 0)) {
295 RAW_VLOG(0, "Removing old heap profile %s\n", fname); 292 RAW_VLOG(0, "Removing old heap profile %s\n", fname);
296 // TODO(csilvers): we really need to unlink dirname + fname 293 // TODO(csilvers): we really need to unlink dirname + fname
297 _unlink(fname); 294 _unlink(fname);
298 } 295 }
299 } while (FindNextFileA(hFind, &found) != FALSE); // A is for Ansi 296 } while (FindNextFileA(hFind, &found) != FALSE); // A is for Ansi
300 FindClose(hFind); 297 FindClose(hFind);
301 } 298 }
302 } 299 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698