| 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 "content/public/app/content_main_runner.h" | 5 #include "content/public/app/content_main_runner.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include "base/allocator/allocator_extension.h" | 9 #include "base/allocator/allocator_extension.h" |
| 10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 #include "ipc/ipc_switches.h" | 41 #include "ipc/ipc_switches.h" |
| 42 #include "media/base/media.h" | 42 #include "media/base/media.h" |
| 43 #include "sandbox/win/src/sandbox_types.h" | 43 #include "sandbox/win/src/sandbox_types.h" |
| 44 #include "ui/base/ui_base_switches.h" | 44 #include "ui/base/ui_base_switches.h" |
| 45 #include "ui/base/ui_base_paths.h" | 45 #include "ui/base/ui_base_paths.h" |
| 46 #include "ui/base/win/dpi.h" | 46 #include "ui/base/win/dpi.h" |
| 47 #include "webkit/glue/webkit_glue.h" | 47 #include "webkit/glue/webkit_glue.h" |
| 48 | 48 |
| 49 #if defined(USE_TCMALLOC) | 49 #if defined(USE_TCMALLOC) |
| 50 #include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h" | 50 #include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h" |
| 51 #if defined(PROFILING_ALLOCATED_TYPE) |
| 52 #include "base/allocator/allocated_type_profiler_tcmalloc.h" |
| 53 #endif |
| 51 #endif | 54 #endif |
| 52 | 55 |
| 53 #if defined(OS_WIN) | 56 #if defined(OS_WIN) |
| 54 #include <cstring> | 57 #include <cstring> |
| 55 #include <atlbase.h> | 58 #include <atlbase.h> |
| 56 #include <atlapp.h> | 59 #include <atlapp.h> |
| 57 #include <malloc.h> | 60 #include <malloc.h> |
| 58 #elif defined(OS_MACOSX) | 61 #elif defined(OS_MACOSX) |
| 59 #include "base/mac/scoped_nsautorelease_pool.h" | 62 #include "base/mac/scoped_nsautorelease_pool.h" |
| 60 #include "base/mach_ipc_mac.h" | 63 #include "base/mach_ipc_mac.h" |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 const char** argv, | 443 const char** argv, |
| 441 ContentMainDelegate* delegate) OVERRIDE { | 444 ContentMainDelegate* delegate) OVERRIDE { |
| 442 | 445 |
| 443 // NOTE(willchan): One might ask why this call is done here rather than in | 446 // NOTE(willchan): One might ask why this call is done here rather than in |
| 444 // process_util_linux.cc with the definition of | 447 // process_util_linux.cc with the definition of |
| 445 // EnableTerminationOnOutOfMemory(). That's because base shouldn't have a | 448 // EnableTerminationOnOutOfMemory(). That's because base shouldn't have a |
| 446 // dependency on TCMalloc. Really, we ought to have our allocator shim code | 449 // dependency on TCMalloc. Really, we ought to have our allocator shim code |
| 447 // implement this EnableTerminationOnOutOfMemory() function. Whateverz. | 450 // implement this EnableTerminationOnOutOfMemory() function. Whateverz. |
| 448 // This works for now. | 451 // This works for now. |
| 449 #if !defined(OS_MACOSX) && defined(USE_TCMALLOC) | 452 #if !defined(OS_MACOSX) && defined(USE_TCMALLOC) |
| 453 |
| 454 #if defined(PROFILING_ALLOCATED_TYPE) |
| 455 base::allocated_type_profiler::SetInterceptFunctions( |
| 456 base::allocated_type_profiler::NewInterceptForTCMalloc, |
| 457 base::allocated_type_profiler::DeleteInterceptForTCMalloc); |
| 458 #endif |
| 459 |
| 450 // For tcmalloc, we need to tell it to behave like new. | 460 // For tcmalloc, we need to tell it to behave like new. |
| 451 tc_set_new_mode(1); | 461 tc_set_new_mode(1); |
| 452 | 462 |
| 453 // On windows, we've already set these thunks up in _heap_init() | 463 // On windows, we've already set these thunks up in _heap_init() |
| 454 base::allocator::SetGetStatsFunction(GetStatsThunk); | 464 base::allocator::SetGetStatsFunction(GetStatsThunk); |
| 455 base::allocator::SetReleaseFreeMemoryFunction(ReleaseFreeMemoryThunk); | 465 base::allocator::SetReleaseFreeMemoryFunction(ReleaseFreeMemoryThunk); |
| 456 | 466 |
| 457 // Provide optional hook for monitoring allocation quantities on a | 467 // Provide optional hook for monitoring allocation quantities on a |
| 458 // per-thread basis. Only set the hook if the environment indicates this | 468 // per-thread basis. Only set the hook if the environment indicates this |
| 459 // needs to be enabled. | 469 // needs to be enabled. |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 | 719 |
| 710 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 720 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
| 711 }; | 721 }; |
| 712 | 722 |
| 713 // static | 723 // static |
| 714 ContentMainRunner* ContentMainRunner::Create() { | 724 ContentMainRunner* ContentMainRunner::Create() { |
| 715 return new ContentMainRunnerImpl(); | 725 return new ContentMainRunnerImpl(); |
| 716 } | 726 } |
| 717 | 727 |
| 718 } // namespace content | 728 } // namespace content |
| OLD | NEW |