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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 #include "sandbox/win/src/sandbox_types.h" | 53 #include "sandbox/win/src/sandbox_types.h" |
54 #include "ui/base/ui_base_paths.h" | 54 #include "ui/base/ui_base_paths.h" |
55 #include "ui/base/ui_base_switches.h" | 55 #include "ui/base/ui_base_switches.h" |
56 | 56 |
57 #ifdef V8_USE_EXTERNAL_STARTUP_DATA | 57 #ifdef V8_USE_EXTERNAL_STARTUP_DATA |
58 #include "gin/v8_initializer.h" | 58 #include "gin/v8_initializer.h" |
59 #endif | 59 #endif |
60 | 60 |
61 #if defined(USE_TCMALLOC) | 61 #if defined(USE_TCMALLOC) |
62 #include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h" | 62 #include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h" |
63 #if defined(TYPE_PROFILING) | |
64 #include "base/allocator/type_profiler.h" | |
65 #include "base/allocator/type_profiler_tcmalloc.h" | |
66 #endif | |
67 #endif | 63 #endif |
68 | 64 |
69 #if !defined(OS_IOS) | 65 #if !defined(OS_IOS) |
70 #include "content/app/mojo/mojo_init.h" | 66 #include "content/app/mojo/mojo_init.h" |
71 #include "content/browser/gpu/gpu_process_host.h" | 67 #include "content/browser/gpu/gpu_process_host.h" |
72 #include "content/browser/renderer_host/render_process_host_impl.h" | 68 #include "content/browser/renderer_host/render_process_host_impl.h" |
73 #include "content/browser/utility_process_host_impl.h" | 69 #include "content/browser/utility_process_host_impl.h" |
74 #include "content/public/plugin/content_plugin_client.h" | 70 #include "content/public/plugin/content_plugin_client.h" |
75 #include "content/public/renderer/content_renderer_client.h" | 71 #include "content/public/renderer/content_renderer_client.h" |
76 #include "content/public/utility/content_utility_client.h" | 72 #include "content/public/utility/content_utility_client.h" |
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 TRACE_EVENT0("startup", "ContentMainRunnerImpl::Initialize"); | 453 TRACE_EVENT0("startup", "ContentMainRunnerImpl::Initialize"); |
458 #endif // OS_ANDROID | 454 #endif // OS_ANDROID |
459 | 455 |
460 // NOTE(willchan): One might ask why these TCMalloc-related calls are done | 456 // NOTE(willchan): One might ask why these TCMalloc-related calls are done |
461 // here rather than in process_util_linux.cc with the definition of | 457 // here rather than in process_util_linux.cc with the definition of |
462 // EnableTerminationOnOutOfMemory(). That's because base shouldn't have a | 458 // EnableTerminationOnOutOfMemory(). That's because base shouldn't have a |
463 // dependency on TCMalloc. Really, we ought to have our allocator shim code | 459 // dependency on TCMalloc. Really, we ought to have our allocator shim code |
464 // implement this EnableTerminationOnOutOfMemory() function. Whateverz. | 460 // implement this EnableTerminationOnOutOfMemory() function. Whateverz. |
465 // This works for now. | 461 // This works for now. |
466 #if !defined(OS_MACOSX) && defined(USE_TCMALLOC) | 462 #if !defined(OS_MACOSX) && defined(USE_TCMALLOC) |
467 | |
468 #if defined(TYPE_PROFILING) | |
469 base::type_profiler::InterceptFunctions::SetFunctions( | |
470 base::type_profiler::NewInterceptForTCMalloc, | |
471 base::type_profiler::DeleteInterceptForTCMalloc); | |
472 #endif | |
473 | |
474 // For tcmalloc, we need to tell it to behave like new. | 463 // For tcmalloc, we need to tell it to behave like new. |
475 tc_set_new_mode(1); | 464 tc_set_new_mode(1); |
476 | 465 |
477 // On windows, we've already set these thunks up in _heap_init() | 466 // On windows, we've already set these thunks up in _heap_init() |
478 base::allocator::SetGetAllocatorWasteSizeFunction( | 467 base::allocator::SetGetAllocatorWasteSizeFunction( |
479 GetAllocatorWasteSizeThunk); | 468 GetAllocatorWasteSizeThunk); |
480 base::allocator::SetGetStatsFunction(GetStatsThunk); | 469 base::allocator::SetGetStatsFunction(GetStatsThunk); |
481 base::allocator::SetReleaseFreeMemoryFunction(ReleaseFreeMemoryThunk); | 470 base::allocator::SetReleaseFreeMemoryFunction(ReleaseFreeMemoryThunk); |
482 | 471 |
483 // Provide optional hook for monitoring allocation quantities on a | 472 // Provide optional hook for monitoring allocation quantities on a |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 | 854 |
866 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 855 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
867 }; | 856 }; |
868 | 857 |
869 // static | 858 // static |
870 ContentMainRunner* ContentMainRunner::Create() { | 859 ContentMainRunner* ContentMainRunner::Create() { |
871 return new ContentMainRunnerImpl(); | 860 return new ContentMainRunnerImpl(); |
872 } | 861 } |
873 | 862 |
874 } // namespace content | 863 } // namespace content |
OLD | NEW |