| 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 "content/app/content_main.h" | 5 #include "content/app/content_main.h" |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/debug/debugger.h" | 9 #include "base/debug/debugger.h" |
| 10 #include "base/i18n/icu_util.h" | 10 #include "base/i18n/icu_util.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 #include "content/browser/mach_broker_mac.h" | 41 #include "content/browser/mach_broker_mac.h" |
| 42 #endif // OS_WIN | 42 #endif // OS_WIN |
| 43 | 43 |
| 44 #if defined(OS_POSIX) | 44 #if defined(OS_POSIX) |
| 45 #include <signal.h> | 45 #include <signal.h> |
| 46 | 46 |
| 47 #include "base/global_descriptors_posix.h" | 47 #include "base/global_descriptors_posix.h" |
| 48 #include "content/common/chrome_descriptors.h" | 48 #include "content/common/chrome_descriptors.h" |
| 49 | 49 |
| 50 #if !defined(OS_MACOSX) | 50 #if !defined(OS_MACOSX) |
| 51 #include "content/common/zygote_fork_delegate_linux.h" | 51 #include "content/public/common/zygote_fork_delegate_linux.h" |
| 52 #endif | 52 #endif |
| 53 | 53 |
| 54 #endif // OS_POSIX | 54 #endif // OS_POSIX |
| 55 | 55 |
| 56 #if !defined(OS_MACOSX) && defined(USE_TCMALLOC) | 56 #if !defined(OS_MACOSX) && defined(USE_TCMALLOC) |
| 57 extern "C" { | 57 extern "C" { |
| 58 int tc_set_new_mode(int mode); | 58 int tc_set_new_mode(int mode); |
| 59 } | 59 } |
| 60 #endif | 60 #endif |
| 61 | 61 |
| 62 extern int GpuMain(const MainFunctionParams&); | 62 extern int GpuMain(const MainFunctionParams&); |
| 63 extern int PluginMain(const MainFunctionParams&); | 63 extern int PluginMain(const MainFunctionParams&); |
| 64 extern int PpapiPluginMain(const MainFunctionParams&); | 64 extern int PpapiPluginMain(const MainFunctionParams&); |
| 65 extern int PpapiBrokerMain(const MainFunctionParams&); | 65 extern int PpapiBrokerMain(const MainFunctionParams&); |
| 66 extern int RendererMain(const MainFunctionParams&); | 66 extern int RendererMain(const MainFunctionParams&); |
| 67 extern int WorkerMain(const MainFunctionParams&); | 67 extern int WorkerMain(const MainFunctionParams&); |
| 68 extern int UtilityMain(const MainFunctionParams&); | 68 extern int UtilityMain(const MainFunctionParams&); |
| 69 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 69 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 70 extern int ZygoteMain(const MainFunctionParams&, | 70 extern int ZygoteMain(const MainFunctionParams&, |
| 71 ZygoteForkDelegate* forkdelegate); | 71 content::ZygoteForkDelegate* forkdelegate); |
| 72 #endif | 72 #endif |
| 73 | 73 |
| 74 namespace { | 74 namespace { |
| 75 | 75 |
| 76 #if defined(OS_WIN) | 76 #if defined(OS_WIN) |
| 77 | 77 |
| 78 static CAppModule _Module; | 78 static CAppModule _Module; |
| 79 | 79 |
| 80 #elif defined(OS_MACOSX) | 80 #elif defined(OS_MACOSX) |
| 81 | 81 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 // fills in some process-launching bits around ZygoteMain(). | 185 // fills in some process-launching bits around ZygoteMain(). |
| 186 // Returns the exit code of the subprocess. | 186 // Returns the exit code of the subprocess. |
| 187 int RunZygote(const MainFunctionParams& main_function_params, | 187 int RunZygote(const MainFunctionParams& main_function_params, |
| 188 content::ContentMainDelegate* delegate) { | 188 content::ContentMainDelegate* delegate) { |
| 189 static const MainFunction kMainFunctions[] = { | 189 static const MainFunction kMainFunctions[] = { |
| 190 { switches::kRendererProcess, RendererMain }, | 190 { switches::kRendererProcess, RendererMain }, |
| 191 { switches::kWorkerProcess, WorkerMain }, | 191 { switches::kWorkerProcess, WorkerMain }, |
| 192 { switches::kPpapiPluginProcess, PpapiPluginMain }, | 192 { switches::kPpapiPluginProcess, PpapiPluginMain }, |
| 193 }; | 193 }; |
| 194 | 194 |
| 195 scoped_ptr<ZygoteForkDelegate> zygote_fork_delegate; | 195 scoped_ptr<content::ZygoteForkDelegate> zygote_fork_delegate; |
| 196 if (delegate) zygote_fork_delegate.reset(delegate->ZygoteStarting()); | 196 if (delegate) zygote_fork_delegate.reset(delegate->ZygoteStarting()); |
| 197 | 197 |
| 198 // This function call can return multiple times, once per fork(). | 198 // This function call can return multiple times, once per fork(). |
| 199 if (!ZygoteMain(main_function_params, zygote_fork_delegate.get())) | 199 if (!ZygoteMain(main_function_params, zygote_fork_delegate.get())) |
| 200 return 1; | 200 return 1; |
| 201 | 201 |
| 202 if (delegate) delegate->ZygoteForked(); | 202 if (delegate) delegate->ZygoteForked(); |
| 203 | 203 |
| 204 // Zygote::HandleForkRequest may have reallocated the command | 204 // Zygote::HandleForkRequest may have reallocated the command |
| 205 // line so update it here with the new version. | 205 // line so update it here with the new version. |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 _CrtDumpMemoryLeaks(); | 457 _CrtDumpMemoryLeaks(); |
| 458 #endif // _CRTDBG_MAP_ALLOC | 458 #endif // _CRTDBG_MAP_ALLOC |
| 459 | 459 |
| 460 _Module.Term(); | 460 _Module.Term(); |
| 461 #endif // OS_WIN | 461 #endif // OS_WIN |
| 462 | 462 |
| 463 return exit_code; | 463 return exit_code; |
| 464 } | 464 } |
| 465 | 465 |
| 466 } // namespace content | 466 } // namespace content |
| OLD | NEW |