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 "base/allocator/allocator_extension.h" | 7 #include "base/allocator/allocator_extension.h" |
8 #include "base/at_exit.h" | 8 #include "base/at_exit.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/debugger.h" | 10 #include "base/debug/debugger.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 #endif | 73 #endif |
74 | 74 |
75 extern int GpuMain(const content::MainFunctionParams&); | 75 extern int GpuMain(const content::MainFunctionParams&); |
76 extern int PluginMain(const content::MainFunctionParams&); | 76 extern int PluginMain(const content::MainFunctionParams&); |
77 extern int PpapiPluginMain(const content::MainFunctionParams&); | 77 extern int PpapiPluginMain(const content::MainFunctionParams&); |
78 extern int PpapiBrokerMain(const content::MainFunctionParams&); | 78 extern int PpapiBrokerMain(const content::MainFunctionParams&); |
79 extern int RendererMain(const content::MainFunctionParams&); | 79 extern int RendererMain(const content::MainFunctionParams&); |
80 extern int WorkerMain(const content::MainFunctionParams&); | 80 extern int WorkerMain(const content::MainFunctionParams&); |
81 extern int UtilityMain(const content::MainFunctionParams&); | 81 extern int UtilityMain(const content::MainFunctionParams&); |
82 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 82 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 83 namespace content { |
83 extern int ZygoteMain(const content::MainFunctionParams&, | 84 extern int ZygoteMain(const content::MainFunctionParams&, |
84 content::ZygoteForkDelegate* forkdelegate); | 85 content::ZygoteForkDelegate* forkdelegate); |
| 86 } // namespace content |
85 #endif | 87 #endif |
86 | 88 |
87 namespace { | 89 namespace { |
88 | 90 |
89 #if defined(OS_WIN) | 91 #if defined(OS_WIN) |
90 | 92 |
91 static CAppModule _Module; | 93 static CAppModule _Module; |
92 | 94 |
93 #elif defined(OS_MACOSX) | 95 #elif defined(OS_MACOSX) |
94 | 96 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 zygote_fork_delegate.reset(delegate->ZygoteStarting()); | 213 zygote_fork_delegate.reset(delegate->ZygoteStarting()); |
212 // Each Renderer we spawn will re-attempt initialization of the media | 214 // Each Renderer we spawn will re-attempt initialization of the media |
213 // libraries, at which point failure will be detected and handled, so | 215 // libraries, at which point failure will be detected and handled, so |
214 // we do not need to cope with initialization failures here. | 216 // we do not need to cope with initialization failures here. |
215 FilePath media_path; | 217 FilePath media_path; |
216 if (PathService::Get(content::DIR_MEDIA_LIBS, &media_path)) | 218 if (PathService::Get(content::DIR_MEDIA_LIBS, &media_path)) |
217 media::InitializeMediaLibrary(media_path); | 219 media::InitializeMediaLibrary(media_path); |
218 } | 220 } |
219 | 221 |
220 // This function call can return multiple times, once per fork(). | 222 // This function call can return multiple times, once per fork(). |
221 if (!ZygoteMain(main_function_params, zygote_fork_delegate.get())) | 223 if (!content::ZygoteMain(main_function_params, zygote_fork_delegate.get())) |
222 return 1; | 224 return 1; |
223 | 225 |
224 if (delegate) delegate->ZygoteForked(); | 226 if (delegate) delegate->ZygoteForked(); |
225 | 227 |
226 // Zygote::HandleForkRequest may have reallocated the command | 228 // Zygote::HandleForkRequest may have reallocated the command |
227 // line so update it here with the new version. | 229 // line so update it here with the new version. |
228 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 230 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
229 | 231 |
230 // If a custom user agent was passed on the command line, we need | 232 // If a custom user agent was passed on the command line, we need |
231 // to (re)set it now, rather than using the default one the zygote | 233 // to (re)set it now, rather than using the default one the zygote |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 } // namespace | 606 } // namespace |
605 | 607 |
606 namespace content { | 608 namespace content { |
607 | 609 |
608 // static | 610 // static |
609 ContentMainRunner* ContentMainRunner::Create() { | 611 ContentMainRunner* ContentMainRunner::Create() { |
610 return new ContentMainRunnerImpl(); | 612 return new ContentMainRunnerImpl(); |
611 } | 613 } |
612 | 614 |
613 } // namespace content | 615 } // namespace content |
OLD | NEW |