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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 #include "ipc/ipc_switches.h" | 47 #include "ipc/ipc_switches.h" |
48 #include "media/base/media.h" | 48 #include "media/base/media.h" |
49 #include "sandbox/win/src/sandbox_types.h" | 49 #include "sandbox/win/src/sandbox_types.h" |
50 #include "ui/base/ui_base_paths.h" | 50 #include "ui/base/ui_base_paths.h" |
51 #include "ui/base/ui_base_switches.h" | 51 #include "ui/base/ui_base_switches.h" |
52 #include "ui/gfx/win/dpi.h" | 52 #include "ui/gfx/win/dpi.h" |
53 #include "webkit/common/user_agent/user_agent.h" | 53 #include "webkit/common/user_agent/user_agent.h" |
54 | 54 |
55 #if defined(USE_TCMALLOC) | 55 #if defined(USE_TCMALLOC) |
56 #include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h" | 56 #include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h" |
57 #include "third_party/tcmalloc/chromium/src/gperftools/tcmalloc.h" | |
57 #if defined(TYPE_PROFILING) | 58 #if defined(TYPE_PROFILING) |
58 #include "base/allocator/type_profiler.h" | 59 #include "base/allocator/type_profiler.h" |
59 #include "base/allocator/type_profiler_tcmalloc.h" | 60 #include "base/allocator/type_profiler_tcmalloc.h" |
60 #endif | 61 #endif |
61 #endif | 62 #endif |
62 | 63 |
63 #if !defined(OS_IOS) | 64 #if !defined(OS_IOS) |
64 #include "content/public/plugin/content_plugin_client.h" | 65 #include "content/public/plugin/content_plugin_client.h" |
65 #include "content/public/renderer/content_renderer_client.h" | 66 #include "content/public/renderer/content_renderer_client.h" |
66 #include "content/public/utility/content_utility_client.h" | 67 #include "content/public/utility/content_utility_client.h" |
(...skipping 21 matching lines...) Expand all Loading... | |
88 | 89 |
89 #if !defined(OS_MACOSX) | 90 #if !defined(OS_MACOSX) |
90 #include "content/public/common/zygote_fork_delegate_linux.h" | 91 #include "content/public/common/zygote_fork_delegate_linux.h" |
91 #endif | 92 #endif |
92 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) | 93 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
93 #include "content/zygote/zygote_main.h" | 94 #include "content/zygote/zygote_main.h" |
94 #endif | 95 #endif |
95 | 96 |
96 #endif // OS_POSIX | 97 #endif // OS_POSIX |
97 | 98 |
98 #if !defined(OS_MACOSX) && defined(USE_TCMALLOC) | |
willchan no longer on Chromium
2014/01/16 01:30:05
Thanks for the cleanup.
| |
99 extern "C" { | |
100 int tc_set_new_mode(int mode); | |
101 } | |
102 #endif | |
103 | |
104 namespace content { | 99 namespace content { |
105 extern int GpuMain(const content::MainFunctionParams&); | 100 extern int GpuMain(const content::MainFunctionParams&); |
106 #if defined(ENABLE_PLUGINS) | 101 #if defined(ENABLE_PLUGINS) |
107 extern int PluginMain(const content::MainFunctionParams&); | 102 extern int PluginMain(const content::MainFunctionParams&); |
108 extern int PpapiPluginMain(const MainFunctionParams&); | 103 extern int PpapiPluginMain(const MainFunctionParams&); |
109 extern int PpapiBrokerMain(const MainFunctionParams&); | 104 extern int PpapiBrokerMain(const MainFunctionParams&); |
110 #endif | 105 #endif |
111 extern int RendererMain(const content::MainFunctionParams&); | 106 extern int RendererMain(const content::MainFunctionParams&); |
112 extern int UtilityMain(const MainFunctionParams&); | 107 extern int UtilityMain(const MainFunctionParams&); |
113 extern int WorkerMain(const MainFunctionParams&); | 108 extern int WorkerMain(const MainFunctionParams&); |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
565 | 560 |
566 #if defined(TYPE_PROFILING) | 561 #if defined(TYPE_PROFILING) |
567 base::type_profiler::InterceptFunctions::SetFunctions( | 562 base::type_profiler::InterceptFunctions::SetFunctions( |
568 base::type_profiler::NewInterceptForTCMalloc, | 563 base::type_profiler::NewInterceptForTCMalloc, |
569 base::type_profiler::DeleteInterceptForTCMalloc); | 564 base::type_profiler::DeleteInterceptForTCMalloc); |
570 #endif | 565 #endif |
571 | 566 |
572 // For tcmalloc, we need to tell it to behave like new. | 567 // For tcmalloc, we need to tell it to behave like new. |
573 tc_set_new_mode(1); | 568 tc_set_new_mode(1); |
574 | 569 |
570 base::SetTCMallocSkipNewHandlerFunction(&tc_malloc_skip_new_handler); | |
571 | |
575 // On windows, we've already set these thunks up in _heap_init() | 572 // On windows, we've already set these thunks up in _heap_init() |
576 base::allocator::SetGetAllocatorWasteSizeFunction( | 573 base::allocator::SetGetAllocatorWasteSizeFunction( |
577 GetAllocatorWasteSizeThunk); | 574 GetAllocatorWasteSizeThunk); |
578 base::allocator::SetGetStatsFunction(GetStatsThunk); | 575 base::allocator::SetGetStatsFunction(GetStatsThunk); |
579 base::allocator::SetReleaseFreeMemoryFunction(ReleaseFreeMemoryThunk); | 576 base::allocator::SetReleaseFreeMemoryFunction(ReleaseFreeMemoryThunk); |
580 | 577 |
581 // Provide optional hook for monitoring allocation quantities on a | 578 // Provide optional hook for monitoring allocation quantities on a |
582 // per-thread basis. Only set the hook if the environment indicates this | 579 // per-thread basis. Only set the hook if the environment indicates this |
583 // needs to be enabled. | 580 // needs to be enabled. |
584 const char* profiling = getenv(tracked_objects::kAlternateProfilerTime); | 581 const char* profiling = getenv(tracked_objects::kAlternateProfilerTime); |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
850 | 847 |
851 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 848 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
852 }; | 849 }; |
853 | 850 |
854 // static | 851 // static |
855 ContentMainRunner* ContentMainRunner::Create() { | 852 ContentMainRunner* ContentMainRunner::Create() { |
856 return new ContentMainRunnerImpl(); | 853 return new ContentMainRunnerImpl(); |
857 } | 854 } |
858 | 855 |
859 } // namespace content | 856 } // namespace content |
OLD | NEW |