| OLD | NEW |
| 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 "base/allocator/allocator_shim.h" | 5 #include "base/allocator/allocator_shim.h" |
| 6 | 6 |
| 7 #include <config.h> | 7 #include <config.h> |
| 8 #include "base/profiler/alternate_timer.h" | 8 #include "base/profiler/alternate_timer.h" |
| 9 #include "base/sysinfo.h" | 9 #include "base/sysinfo.h" |
| 10 | 10 |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 // you can't do anything useful anyway. | 263 // you can't do anything useful anyway. |
| 264 new TCMallocGuard(); | 264 new TCMallocGuard(); |
| 265 | 265 |
| 266 // Provide optional hook for monitoring allocation quantities on a per-thread | 266 // Provide optional hook for monitoring allocation quantities on a per-thread |
| 267 // basis. Only set the hook if the environment indicates this needs to be | 267 // basis. Only set the hook if the environment indicates this needs to be |
| 268 // enabled. | 268 // enabled. |
| 269 const char* profiling = | 269 const char* profiling = |
| 270 GetenvBeforeMain(tracked_objects::kAlternateProfilerTime); | 270 GetenvBeforeMain(tracked_objects::kAlternateProfilerTime); |
| 271 if (profiling && *profiling == '1') { | 271 if (profiling && *profiling == '1') { |
| 272 tracked_objects::SetAlternateTimeSource( | 272 tracked_objects::SetAlternateTimeSource( |
| 273 tcmalloc::ThreadCache::GetBytesAllocatedOnCurrentThread); | 273 tcmalloc::ThreadCache::GetBytesAllocatedOnCurrentThread, |
| 274 tracked_objects::TIME_SOURCE_TYPE_TCMALLOC); |
| 274 } | 275 } |
| 275 | 276 |
| 276 return 1; | 277 return 1; |
| 277 } | 278 } |
| 278 | 279 |
| 279 // The CRT heap cleanup stub. | 280 // The CRT heap cleanup stub. |
| 280 extern "C" void _heap_term() {} | 281 extern "C" void _heap_term() {} |
| 281 | 282 |
| 282 // We set this to 1 because part of the CRT uses a check of _crtheap != 0 | 283 // We set this to 1 because part of the CRT uses a check of _crtheap != 0 |
| 283 // to test whether the CRT has been initialized. Once we've ripped out | 284 // to test whether the CRT has been initialized. Once we've ripped out |
| (...skipping 25 matching lines...) Expand all Loading... |
| 309 const char* secondary_value = secondary_length ? buffer : "TCMALLOC"; | 310 const char* secondary_value = secondary_length ? buffer : "TCMALLOC"; |
| 310 // Force renderer (or other subprocesses) to use secondary_value. | 311 // Force renderer (or other subprocesses) to use secondary_value. |
| 311 int ret_val = _putenv_s(primary_name, secondary_value); | 312 int ret_val = _putenv_s(primary_name, secondary_value); |
| 312 DCHECK_EQ(0, ret_val); | 313 DCHECK_EQ(0, ret_val); |
| 313 } | 314 } |
| 314 #endif // ENABLE_DYNAMIC_ALLOCATOR_SWITCHING | 315 #endif // ENABLE_DYNAMIC_ALLOCATOR_SWITCHING |
| 315 } | 316 } |
| 316 | 317 |
| 317 } // namespace allocator. | 318 } // namespace allocator. |
| 318 } // namespace base. | 319 } // namespace base. |
| OLD | NEW |