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

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: Enable with command-line flag, pass channel ID from zygote 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"
(...skipping 14 matching lines...) Expand all
25 #include "chrome/browser/diagnostics/diagnostics_main.h" 25 #include "chrome/browser/diagnostics/diagnostics_main.h"
26 #include "chrome/browser/platform_util.h" 26 #include "chrome/browser/platform_util.h"
27 #include "chrome/common/chrome_constants.h" 27 #include "chrome/common/chrome_constants.h"
28 #include "chrome/common/chrome_content_client.h" 28 #include "chrome/common/chrome_content_client.h"
29 #include "chrome/common/chrome_content_plugin_client.h" 29 #include "chrome/common/chrome_content_plugin_client.h"
30 #include "chrome/common/chrome_paths.h" 30 #include "chrome/common/chrome_paths.h"
31 #include "chrome/common/chrome_paths_internal.h" 31 #include "chrome/common/chrome_paths_internal.h"
32 #include "chrome/common/chrome_switches.h" 32 #include "chrome/common/chrome_switches.h"
33 #include "chrome/common/chrome_version_info.h" 33 #include "chrome/common/chrome_version_info.h"
34 #include "chrome/common/logging_chrome.h" 34 #include "chrome/common/logging_chrome.h"
35 #include "chrome/common/nacl_fork_delegate_linux.h"
35 #include "chrome/common/profiling.h" 36 #include "chrome/common/profiling.h"
36 #include "chrome/common/url_constants.h" 37 #include "chrome/common/url_constants.h"
37 #include "chrome/renderer/chrome_content_renderer_client.h" 38 #include "chrome/renderer/chrome_content_renderer_client.h"
38 #include "chrome/utility/chrome_content_utility_client.h" 39 #include "chrome/utility/chrome_content_utility_client.h"
39 #include "content/browser/renderer_host/render_process_host.h" 40 #include "content/browser/renderer_host/render_process_host.h"
40 #include "content/common/content_client.h" 41 #include "content/common/content_client.h"
41 #include "content/common/content_counters.h" 42 #include "content/common/content_counters.h"
42 #include "content/common/content_paths.h" 43 #include "content/common/content_paths.h"
43 #include "content/common/main_function_params.h" 44 #include "content/common/main_function_params.h"
44 #include "content/common/sandbox_init_wrapper.h" 45 #include "content/common/sandbox_init_wrapper.h"
45 #include "content/common/set_process_title.h" 46 #include "content/common/set_process_title.h"
47 #include "content/common/zygote_fork_delegate_linux.h"
46 #include "ipc/ipc_switches.h" 48 #include "ipc/ipc_switches.h"
47 #include "media/base/media.h" 49 #include "media/base/media.h"
48 #include "ui/base/resource/resource_bundle.h" 50 #include "ui/base/resource/resource_bundle.h"
49 #include "ui/base/ui_base_paths.h" 51 #include "ui/base/ui_base_paths.h"
50 #include "ui/base/ui_base_switches.h" 52 #include "ui/base/ui_base_switches.h"
51 53
52 #if defined(OS_WIN) 54 #if defined(OS_WIN)
53 #include <algorithm> 55 #include <algorithm>
54 #include <malloc.h> 56 #include <malloc.h>
55 #include "base/string_util.h" 57 #include "base/string_util.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 extern int BrowserMain(const MainFunctionParams&); 108 extern int BrowserMain(const MainFunctionParams&);
107 extern int RendererMain(const MainFunctionParams&); 109 extern int RendererMain(const MainFunctionParams&);
108 extern int GpuMain(const MainFunctionParams&); 110 extern int GpuMain(const MainFunctionParams&);
109 extern int PluginMain(const MainFunctionParams&); 111 extern int PluginMain(const MainFunctionParams&);
110 extern int PpapiPluginMain(const MainFunctionParams&); 112 extern int PpapiPluginMain(const MainFunctionParams&);
111 extern int PpapiBrokerMain(const MainFunctionParams&); 113 extern int PpapiBrokerMain(const MainFunctionParams&);
112 extern int WorkerMain(const MainFunctionParams&); 114 extern int WorkerMain(const MainFunctionParams&);
113 extern int NaClMain(const MainFunctionParams&); 115 extern int NaClMain(const MainFunctionParams&);
114 extern int UtilityMain(const MainFunctionParams&); 116 extern int UtilityMain(const MainFunctionParams&);
115 extern int ProfileImportMain(const MainFunctionParams&); 117 extern int ProfileImportMain(const MainFunctionParams&);
116 extern int ZygoteMain(const MainFunctionParams&); 118 #if defined(OS_POSIX) && !defined(OS_MACOSX)
119 extern int ZygoteMain(const MainFunctionParams&,
120 ZygoteForkDelegate* forkdelegate);
121 #endif
117 #if defined(_WIN64) 122 #if defined(_WIN64)
118 extern int NaClBrokerMain(const MainFunctionParams&); 123 extern int NaClBrokerMain(const MainFunctionParams&);
119 #endif 124 #endif
120 extern int ServiceProcessMain(const MainFunctionParams&); 125 extern int ServiceProcessMain(const MainFunctionParams&);
121 126
122 #if defined(OS_WIN) 127 #if defined(OS_WIN)
123 // TODO(erikkay): isn't this already defined somewhere? 128 // TODO(erikkay): isn't this already defined somewhere?
124 #define DLLEXPORT __declspec(dllexport) 129 #define DLLEXPORT __declspec(dllexport)
125 130
126 // We use extern C for the prototype DLLEXPORT to avoid C++ name mangling. 131 // 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 }; 437 };
433 438
434 // Each Renderer we spawn will re-attempt initialization of the media 439 // Each Renderer we spawn will re-attempt initialization of the media
435 // libraries, at which point failure will be detected and handled, so 440 // libraries, at which point failure will be detected and handled, so
436 // we do not need to cope with initialization failures here. 441 // we do not need to cope with initialization failures here.
437 FilePath media_path; 442 FilePath media_path;
438 if (PathService::Get(chrome::DIR_MEDIA_LIBS, &media_path)) 443 if (PathService::Get(chrome::DIR_MEDIA_LIBS, &media_path))
439 media::InitializeMediaLibrary(media_path); 444 media::InitializeMediaLibrary(media_path);
440 445
441 // This function call can return multiple times, once per fork(). 446 // This function call can return multiple times, once per fork().
442 if (!ZygoteMain(main_function_params)) 447 if (!ZygoteMain(main_function_params, new NaClForkDelegate()))
443 return 1; 448 return 1;
444 449
445 // Zygote::HandleForkRequest may have reallocated the command 450 // Zygote::HandleForkRequest may have reallocated the command
446 // line so update it here with the new version. 451 // line so update it here with the new version.
447 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); 452 const CommandLine& command_line = *CommandLine::ForCurrentProcess();
448 453
449 // The StatsTable must be initialized in each process; we already 454 // The StatsTable must be initialized in each process; we already
450 // initialized for the browser process, now we need to initialize 455 // initialized for the browser process, now we need to initialize
451 // within the new processes as well. 456 // within the new processes as well.
452 pid_t browser_pid = base::GetParentProcessId( 457 pid_t browser_pid = base::GetParentProcessId(
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 844
840 if (SubprocessNeedsResourceBundle(process_type)) 845 if (SubprocessNeedsResourceBundle(process_type))
841 ResourceBundle::CleanupSharedInstance(); 846 ResourceBundle::CleanupSharedInstance();
842 847
843 logging::CleanupChromeLogging(); 848 logging::CleanupChromeLogging();
844 849
845 chrome_main::LowLevelShutdown(); 850 chrome_main::LowLevelShutdown();
846 851
847 return exit_code; 852 return exit_code;
848 } 853 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698