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

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: Use IPC::Channel directly instead of ChildProcess 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/mac/scoped_nsautorelease_pool.h" 12 #include "base/mac/scoped_nsautorelease_pool.h"
13 #include "base/message_loop.h" 13 #include "base/message_loop.h"
14 #include "base/metrics/stats_counters.h" 14 #include "base/metrics/stats_counters.h"
15 #include "base/metrics/stats_table.h" 15 #include "base/metrics/stats_table.h"
16 #include "base/path_service.h" 16 #include "base/path_service.h"
17 #include "base/process_util.h" 17 #include "base/process_util.h"
18 #include "base/stringprintf.h" 18 #include "base/stringprintf.h"
19 #include "base/string_number_conversions.h" 19 #include "base/string_number_conversions.h"
20 #include "base/utf_string_conversions.h" 20 #include "base/utf_string_conversions.h"
21 #include "build/build_config.h" 21 #include "build/build_config.h"
22 #include "crypto/nss_util.h" 22 #include "crypto/nss_util.h"
23 #include "chrome/browser/defaults.h" 23 #include "chrome/browser/defaults.h"
24 #include "chrome/browser/diagnostics/diagnostics_main.h" 24 #include "chrome/browser/diagnostics/diagnostics_main.h"
25 #include "chrome/nacl/nacl_fork_delegate_linux.h"
25 #include "chrome/browser/platform_util.h" 26 #include "chrome/browser/platform_util.h"
26 #include "chrome/common/chrome_constants.h" 27 #include "chrome/common/chrome_constants.h"
27 #include "chrome/common/chrome_content_client.h" 28 #include "chrome/common/chrome_content_client.h"
28 #include "chrome/common/chrome_content_plugin_client.h" 29 #include "chrome/common/chrome_content_plugin_client.h"
29 #include "chrome/common/chrome_paths.h" 30 #include "chrome/common/chrome_paths.h"
30 #include "chrome/common/chrome_paths_internal.h" 31 #include "chrome/common/chrome_paths_internal.h"
31 #include "chrome/common/chrome_switches.h" 32 #include "chrome/common/chrome_switches.h"
32 #include "chrome/common/chrome_version_info.h" 33 #include "chrome/common/chrome_version_info.h"
33 #include "chrome/common/logging_chrome.h" 34 #include "chrome/common/logging_chrome.h"
34 #include "chrome/common/profiling.h" 35 #include "chrome/common/profiling.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 extern int BrowserMain(const MainFunctionParams&); 94 extern int BrowserMain(const MainFunctionParams&);
94 extern int RendererMain(const MainFunctionParams&); 95 extern int RendererMain(const MainFunctionParams&);
95 extern int GpuMain(const MainFunctionParams&); 96 extern int GpuMain(const MainFunctionParams&);
96 extern int PluginMain(const MainFunctionParams&); 97 extern int PluginMain(const MainFunctionParams&);
97 extern int PpapiPluginMain(const MainFunctionParams&); 98 extern int PpapiPluginMain(const MainFunctionParams&);
98 extern int PpapiBrokerMain(const MainFunctionParams&); 99 extern int PpapiBrokerMain(const MainFunctionParams&);
99 extern int WorkerMain(const MainFunctionParams&); 100 extern int WorkerMain(const MainFunctionParams&);
100 extern int NaClMain(const MainFunctionParams&); 101 extern int NaClMain(const MainFunctionParams&);
101 extern int UtilityMain(const MainFunctionParams&); 102 extern int UtilityMain(const MainFunctionParams&);
102 extern int ProfileImportMain(const MainFunctionParams&); 103 extern int ProfileImportMain(const MainFunctionParams&);
103 extern int ZygoteMain(const MainFunctionParams&); 104 extern int ZygoteMain(const MainFunctionParams&,
105 ZygoteForkDelegate* forkdelegate);
104 #if defined(_WIN64) 106 #if defined(_WIN64)
105 extern int NaClBrokerMain(const MainFunctionParams&); 107 extern int NaClBrokerMain(const MainFunctionParams&);
106 #endif 108 #endif
107 extern int ServiceProcessMain(const MainFunctionParams&); 109 extern int ServiceProcessMain(const MainFunctionParams&);
108 110
109 #if defined(OS_WIN) 111 #if defined(OS_WIN)
110 // TODO(erikkay): isn't this already defined somewhere? 112 // TODO(erikkay): isn't this already defined somewhere?
111 #define DLLEXPORT __declspec(dllexport) 113 #define DLLEXPORT __declspec(dllexport)
112 114
113 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. 115 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling.
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 { switches::kRendererProcess, RendererMain }, 409 { switches::kRendererProcess, RendererMain },
408 { switches::kExtensionProcess, RendererMain }, 410 { switches::kExtensionProcess, RendererMain },
409 { switches::kWorkerProcess, WorkerMain }, 411 { switches::kWorkerProcess, WorkerMain },
410 { switches::kPpapiPluginProcess, PpapiPluginMain }, 412 { switches::kPpapiPluginProcess, PpapiPluginMain },
411 #if !defined(DISABLE_NACL) 413 #if !defined(DISABLE_NACL)
412 { switches::kNaClLoaderProcess, NaClMain }, 414 { switches::kNaClLoaderProcess, NaClMain },
413 #endif 415 #endif
414 }; 416 };
415 417
416 // This function call can return multiple times, once per fork(). 418 // This function call can return multiple times, once per fork().
417 if (!ZygoteMain(main_function_params)) 419 if (!ZygoteMain(main_function_params, new NaClForkDelegate()))
418 return 1; 420 return 1;
419 421
420 // Zygote::HandleForkRequest may have reallocated the command 422 // Zygote::HandleForkRequest may have reallocated the command
421 // line so update it here with the new version. 423 // line so update it here with the new version.
422 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 424 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
423 425
424 // The StatsTable must be initialized in each process; we already 426 // The StatsTable must be initialized in each process; we already
425 // initialized for the browser process, now we need to initialize 427 // initialized for the browser process, now we need to initialize
426 // within the new processes as well. 428 // within the new processes as well.
427 pid_t browser_pid = base::GetParentProcessId( 429 pid_t browser_pid = base::GetParentProcessId(
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 818
817 if (SubprocessNeedsResourceBundle(process_type)) 819 if (SubprocessNeedsResourceBundle(process_type))
818 ResourceBundle::CleanupSharedInstance(); 820 ResourceBundle::CleanupSharedInstance();
819 821
820 logging::CleanupChromeLogging(); 822 logging::CleanupChromeLogging();
821 823
822 chrome_main::LowLevelShutdown(); 824 chrome_main::LowLevelShutdown();
823 825
824 return exit_code; 826 return exit_code;
825 } 827 }
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