Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Side by Side Diff: chrome/app/chrome_main.cc

Issue 6995121: New NaCl zygote implementation 2 (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Addressing feedback from John Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "base/i18n/icu_util.h" 11 #include "base/i18n/icu_util.h"
12 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
13 #include "base/mac/scoped_nsautorelease_pool.h" 13 #include "base/mac/scoped_nsautorelease_pool.h"
14 #include "base/message_loop.h" 14 #include "base/message_loop.h"
15 #include "base/metrics/stats_counters.h" 15 #include "base/metrics/stats_counters.h"
16 #include "base/metrics/stats_table.h" 16 #include "base/metrics/stats_table.h"
17 #include "base/path_service.h" 17 #include "base/path_service.h"
18 #include "base/process_util.h" 18 #include "base/process_util.h"
19 #include "base/stringprintf.h" 19 #include "base/stringprintf.h"
20 #include "base/string_number_conversions.h" 20 #include "base/string_number_conversions.h"
21 #include "base/utf_string_conversions.h" 21 #include "base/utf_string_conversions.h"
22 #include "build/build_config.h" 22 #include "build/build_config.h"
23 #include "crypto/nss_util.h" 23 #include "crypto/nss_util.h"
24 #include "chrome/browser/defaults.h" 24 #include "chrome/browser/defaults.h"
25 #include "chrome/browser/diagnostics/diagnostics_main.h" 25 #include "chrome/browser/diagnostics/diagnostics_main.h"
26 #include "chrome/nacl/nacl_fork_delegate_linux.h"
26 #include "chrome/browser/platform_util.h" 27 #include "chrome/browser/platform_util.h"
27 #include "chrome/common/chrome_constants.h" 28 #include "chrome/common/chrome_constants.h"
28 #include "chrome/common/chrome_content_client.h" 29 #include "chrome/common/chrome_content_client.h"
29 #include "chrome/common/chrome_content_plugin_client.h" 30 #include "chrome/common/chrome_content_plugin_client.h"
30 #include "chrome/common/chrome_paths.h" 31 #include "chrome/common/chrome_paths.h"
31 #include "chrome/common/chrome_paths_internal.h" 32 #include "chrome/common/chrome_paths_internal.h"
32 #include "chrome/common/chrome_switches.h" 33 #include "chrome/common/chrome_switches.h"
33 #include "chrome/common/chrome_version_info.h" 34 #include "chrome/common/chrome_version_info.h"
34 #include "chrome/common/logging_chrome.h" 35 #include "chrome/common/logging_chrome.h"
35 #include "chrome/common/profiling.h" 36 #include "chrome/common/profiling.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 extern int BrowserMain(const MainFunctionParams&); 107 extern int BrowserMain(const MainFunctionParams&);
107 extern int RendererMain(const MainFunctionParams&); 108 extern int RendererMain(const MainFunctionParams&);
108 extern int GpuMain(const MainFunctionParams&); 109 extern int GpuMain(const MainFunctionParams&);
109 extern int PluginMain(const MainFunctionParams&); 110 extern int PluginMain(const MainFunctionParams&);
110 extern int PpapiPluginMain(const MainFunctionParams&); 111 extern int PpapiPluginMain(const MainFunctionParams&);
111 extern int PpapiBrokerMain(const MainFunctionParams&); 112 extern int PpapiBrokerMain(const MainFunctionParams&);
112 extern int WorkerMain(const MainFunctionParams&); 113 extern int WorkerMain(const MainFunctionParams&);
113 extern int NaClMain(const MainFunctionParams&); 114 extern int NaClMain(const MainFunctionParams&);
114 extern int UtilityMain(const MainFunctionParams&); 115 extern int UtilityMain(const MainFunctionParams&);
115 extern int ProfileImportMain(const MainFunctionParams&); 116 extern int ProfileImportMain(const MainFunctionParams&);
116 extern int ZygoteMain(const MainFunctionParams&); 117 extern int ZygoteMain(const MainFunctionParams&,
118 ZygoteForkDelegate* forkdelegate);
117 #if defined(_WIN64) 119 #if defined(_WIN64)
118 extern int NaClBrokerMain(const MainFunctionParams&); 120 extern int NaClBrokerMain(const MainFunctionParams&);
119 #endif 121 #endif
120 extern int ServiceProcessMain(const MainFunctionParams&); 122 extern int ServiceProcessMain(const MainFunctionParams&);
121 123
122 #if defined(OS_WIN) 124 #if defined(OS_WIN)
123 // TODO(erikkay): isn't this already defined somewhere? 125 // TODO(erikkay): isn't this already defined somewhere?
124 #define DLLEXPORT __declspec(dllexport) 126 #define DLLEXPORT __declspec(dllexport)
125 127
126 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. 128 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling.
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 }; 434 };
433 435
434 // Each Renderer we spawn will re-attempt initialization of the media 436 // Each Renderer we spawn will re-attempt initialization of the media
435 // libraries, at which point failure will be detected and handled, so 437 // libraries, at which point failure will be detected and handled, so
436 // we do not need to cope with initialization failures here. 438 // we do not need to cope with initialization failures here.
437 FilePath media_path; 439 FilePath media_path;
438 if (PathService::Get(chrome::DIR_MEDIA_LIBS, &media_path)) 440 if (PathService::Get(chrome::DIR_MEDIA_LIBS, &media_path))
439 media::InitializeMediaLibrary(media_path); 441 media::InitializeMediaLibrary(media_path);
440 442
441 // This function call can return multiple times, once per fork(). 443 // This function call can return multiple times, once per fork().
442 if (!ZygoteMain(main_function_params)) 444 if (!ZygoteMain(main_function_params, new NaClForkDelegate()))
443 return 1; 445 return 1;
444 446
445 // Zygote::HandleForkRequest may have reallocated the command 447 // Zygote::HandleForkRequest may have reallocated the command
446 // line so update it here with the new version. 448 // line so update it here with the new version.
447 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 449 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
448 450
449 // The StatsTable must be initialized in each process; we already 451 // The StatsTable must be initialized in each process; we already
450 // initialized for the browser process, now we need to initialize 452 // initialized for the browser process, now we need to initialize
451 // within the new processes as well. 453 // within the new processes as well.
452 pid_t browser_pid = base::GetParentProcessId( 454 pid_t browser_pid = base::GetParentProcessId(
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 841
840 if (SubprocessNeedsResourceBundle(process_type)) 842 if (SubprocessNeedsResourceBundle(process_type))
841 ResourceBundle::CleanupSharedInstance(); 843 ResourceBundle::CleanupSharedInstance();
842 844
843 logging::CleanupChromeLogging(); 845 logging::CleanupChromeLogging();
844 846
845 chrome_main::LowLevelShutdown(); 847 chrome_main::LowLevelShutdown();
846 848
847 return exit_code; 849 return exit_code;
848 } 850 }
OLDNEW
« no previous file with comments | « base/process_util_posix.cc ('k') | chrome/chrome.gyp » ('j') | chrome/chrome.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698