OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/sysinfo.h" | 8 #include "base/sysinfo.h" |
9 | 9 |
10 // When defined, different heap allocators can be used via an environment | 10 // When defined, different heap allocators can be used via an environment |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 size_t secondary_length = 0; | 290 size_t secondary_length = 0; |
291 char buffer[20]; | 291 char buffer[20]; |
292 getenv_s(&secondary_length, buffer, sizeof(buffer), secondary_name); | 292 getenv_s(&secondary_length, buffer, sizeof(buffer), secondary_name); |
293 DCHECK_GT(sizeof(buffer), secondary_length); | 293 DCHECK_GT(sizeof(buffer), secondary_length); |
294 buffer[sizeof(buffer) - 1] = '\0'; | 294 buffer[sizeof(buffer) - 1] = '\0'; |
295 | 295 |
296 if (secondary_length || !primary_length) { | 296 if (secondary_length || !primary_length) { |
297 char* secondary_value = secondary_length ? buffer : "TCMALLOC"; | 297 char* secondary_value = secondary_length ? buffer : "TCMALLOC"; |
298 // Force renderer (or other subprocesses) to use secondary_value. | 298 // Force renderer (or other subprocesses) to use secondary_value. |
299 int ret_val = _putenv_s(primary_name, secondary_value); | 299 int ret_val = _putenv_s(primary_name, secondary_value); |
300 CHECK_EQ(0, ret_val); | 300 DCHECK_EQ(0, ret_val); |
301 } | 301 } |
302 #endif // ENABLE_DYNAMIC_ALLOCATOR_SWITCHING | 302 #endif // ENABLE_DYNAMIC_ALLOCATOR_SWITCHING |
303 } | 303 } |
304 | 304 |
305 } // namespace base. | 305 } // namespace base. |
306 } // namespace allocator. | 306 } // namespace allocator. |
OLD | NEW |