| 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 "chrome/app/chrome_main.h" | 5 #include "chrome/app/chrome_main.h" |
| 6 | 6 |
| 7 #include "app/app_paths.h" | 7 #include "app/app_paths.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 30 matching lines...) Expand all Loading... |
| 41 #include "content/common/content_paths.h" | 41 #include "content/common/content_paths.h" |
| 42 #include "content/common/main_function_params.h" | 42 #include "content/common/main_function_params.h" |
| 43 #include "content/common/sandbox_init_wrapper.h" | 43 #include "content/common/sandbox_init_wrapper.h" |
| 44 #include "content/common/set_process_title.h" | 44 #include "content/common/set_process_title.h" |
| 45 #include "ipc/ipc_switches.h" | 45 #include "ipc/ipc_switches.h" |
| 46 #include "media/base/media.h" | 46 #include "media/base/media.h" |
| 47 #include "ui/base/resource/resource_bundle.h" | 47 #include "ui/base/resource/resource_bundle.h" |
| 48 #include "ui/base/ui_base_paths.h" | 48 #include "ui/base/ui_base_paths.h" |
| 49 #include "ui/base/ui_base_switches.h" | 49 #include "ui/base/ui_base_switches.h" |
| 50 | 50 |
| 51 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 52 #include "chrome/common/nacl_fork_delegate_linux.h" |
| 53 #include "content/common/zygote_fork_delegate_linux.h" |
| 54 #endif |
| 55 |
| 51 #if defined(OS_WIN) | 56 #if defined(OS_WIN) |
| 52 #include <algorithm> | 57 #include <algorithm> |
| 53 #include <malloc.h> | 58 #include <malloc.h> |
| 54 #include "base/string_util.h" | 59 #include "base/string_util.h" |
| 55 #include "base/win/registry.h" | 60 #include "base/win/registry.h" |
| 56 #include "sandbox/src/sandbox.h" | 61 #include "sandbox/src/sandbox.h" |
| 57 #include "tools/memory_watcher/memory_watcher.h" | 62 #include "tools/memory_watcher/memory_watcher.h" |
| 58 #endif | 63 #endif |
| 59 | 64 |
| 60 #if defined(OS_MACOSX) | 65 #if defined(OS_MACOSX) |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 extern int BrowserMain(const MainFunctionParams&); | 111 extern int BrowserMain(const MainFunctionParams&); |
| 107 extern int RendererMain(const MainFunctionParams&); | 112 extern int RendererMain(const MainFunctionParams&); |
| 108 extern int GpuMain(const MainFunctionParams&); | 113 extern int GpuMain(const MainFunctionParams&); |
| 109 extern int PluginMain(const MainFunctionParams&); | 114 extern int PluginMain(const MainFunctionParams&); |
| 110 extern int PpapiPluginMain(const MainFunctionParams&); | 115 extern int PpapiPluginMain(const MainFunctionParams&); |
| 111 extern int PpapiBrokerMain(const MainFunctionParams&); | 116 extern int PpapiBrokerMain(const MainFunctionParams&); |
| 112 extern int WorkerMain(const MainFunctionParams&); | 117 extern int WorkerMain(const MainFunctionParams&); |
| 113 extern int NaClMain(const MainFunctionParams&); | 118 extern int NaClMain(const MainFunctionParams&); |
| 114 extern int UtilityMain(const MainFunctionParams&); | 119 extern int UtilityMain(const MainFunctionParams&); |
| 115 extern int ProfileImportMain(const MainFunctionParams&); | 120 extern int ProfileImportMain(const MainFunctionParams&); |
| 116 extern int ZygoteMain(const MainFunctionParams&); | 121 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 122 extern int ZygoteMain(const MainFunctionParams&, |
| 123 ZygoteForkDelegate* forkdelegate); |
| 124 #endif |
| 117 #if defined(_WIN64) | 125 #if defined(_WIN64) |
| 118 extern int NaClBrokerMain(const MainFunctionParams&); | 126 extern int NaClBrokerMain(const MainFunctionParams&); |
| 119 #endif | 127 #endif |
| 120 extern int ServiceProcessMain(const MainFunctionParams&); | 128 extern int ServiceProcessMain(const MainFunctionParams&); |
| 121 | 129 |
| 122 #if defined(OS_WIN) | 130 #if defined(OS_WIN) |
| 123 // TODO(erikkay): isn't this already defined somewhere? | 131 // TODO(erikkay): isn't this already defined somewhere? |
| 124 #define DLLEXPORT __declspec(dllexport) | 132 #define DLLEXPORT __declspec(dllexport) |
| 125 | 133 |
| 126 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. | 134 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 }; | 452 }; |
| 445 | 453 |
| 446 // Each Renderer we spawn will re-attempt initialization of the media | 454 // Each Renderer we spawn will re-attempt initialization of the media |
| 447 // libraries, at which point failure will be detected and handled, so | 455 // libraries, at which point failure will be detected and handled, so |
| 448 // we do not need to cope with initialization failures here. | 456 // we do not need to cope with initialization failures here. |
| 449 FilePath media_path; | 457 FilePath media_path; |
| 450 if (PathService::Get(chrome::DIR_MEDIA_LIBS, &media_path)) | 458 if (PathService::Get(chrome::DIR_MEDIA_LIBS, &media_path)) |
| 451 media::InitializeMediaLibrary(media_path); | 459 media::InitializeMediaLibrary(media_path); |
| 452 | 460 |
| 453 // This function call can return multiple times, once per fork(). | 461 // This function call can return multiple times, once per fork(). |
| 454 if (!ZygoteMain(main_function_params)) | 462 if (!ZygoteMain(main_function_params, new NaClForkDelegate())) |
| 455 return 1; | 463 return 1; |
| 456 | 464 |
| 457 // Zygote::HandleForkRequest may have reallocated the command | 465 // Zygote::HandleForkRequest may have reallocated the command |
| 458 // line so update it here with the new version. | 466 // line so update it here with the new version. |
| 459 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 467 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 460 | 468 |
| 461 // The StatsTable must be initialized in each process; we already | 469 // The StatsTable must be initialized in each process; we already |
| 462 // initialized for the browser process, now we need to initialize | 470 // initialized for the browser process, now we need to initialize |
| 463 // within the new processes as well. | 471 // within the new processes as well. |
| 464 pid_t browser_pid = base::GetParentProcessId( | 472 pid_t browser_pid = base::GetParentProcessId( |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 855 | 863 |
| 856 if (SubprocessNeedsResourceBundle(process_type)) | 864 if (SubprocessNeedsResourceBundle(process_type)) |
| 857 ResourceBundle::CleanupSharedInstance(); | 865 ResourceBundle::CleanupSharedInstance(); |
| 858 | 866 |
| 859 logging::CleanupChromeLogging(); | 867 logging::CleanupChromeLogging(); |
| 860 | 868 |
| 861 chrome_main::LowLevelShutdown(); | 869 chrome_main::LowLevelShutdown(); |
| 862 | 870 |
| 863 return exit_code; | 871 return exit_code; |
| 864 } | 872 } |
| OLD | NEW |