| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // TODO(port): the ifdefs in here are a first step towards trying to determine | 5 // TODO(port): the ifdefs in here are a first step towards trying to determine |
| 6 // the correct abstraction for all the OS functionality required at this | 6 // the correct abstraction for all the OS functionality required at this |
| 7 // stage of process initialization. It should not be taken as a final | 7 // stage of process initialization. It should not be taken as a final |
| 8 // abstraction. | 8 // abstraction. |
| 9 | 9 |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 char* error_buff; | 199 char* error_buff; |
| 200 int error = sandbox_init(kSBXProfilePureComputation, SANDBOX_NAMED, | 200 int error = sandbox_init(kSBXProfilePureComputation, SANDBOX_NAMED, |
| 201 &error_buff); | 201 &error_buff); |
| 202 if (error) | 202 if (error) |
| 203 exit(-1); | 203 exit(-1); |
| 204 #endif | 204 #endif |
| 205 } | 205 } |
| 206 } | 206 } |
| 207 } | 207 } |
| 208 | 208 |
| 209 void CommonSubprocessInit() { |
| 210 #if defined(OS_WIN) |
| 211 // Initialize ResourceBundle which handles files loaded from external |
| 212 // sources. The language should have been passed in to us from the |
| 213 // browser process as a command line flag. |
| 214 // TODO(port): enable when we figure out resource bundle issues |
| 215 ResourceBundle::InitSharedInstance(std::wstring()); |
| 216 |
| 217 // HACK: Let Windows know that we have started. This is needed to suppress |
| 218 // the IDC_APPSTARTING cursor from being displayed for a prolonged period |
| 219 // while a subprocess is starting. |
| 220 PostThreadMessage(GetCurrentThreadId(), WM_NULL, 0, 0); |
| 221 MSG msg; |
| 222 PeekMessage(&msg, NULL, 0, 0, PM_REMOVE); |
| 223 #endif |
| 224 } |
| 225 |
| 209 } // namespace | 226 } // namespace |
| 210 | 227 |
| 211 #if defined(OS_WIN) | 228 #if defined(OS_WIN) |
| 212 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, | 229 DLLEXPORT int __cdecl ChromeMain(HINSTANCE instance, |
| 213 sandbox::SandboxInterfaceInfo* sandbox_info, | 230 sandbox::SandboxInterfaceInfo* sandbox_info, |
| 214 TCHAR* command_line) { | 231 TCHAR* command_line) { |
| 215 #elif defined(OS_POSIX) | 232 #elif defined(OS_POSIX) |
| 216 int ChromeMain(int argc, const char** argv) { | 233 int ChromeMain(int argc, const char** argv) { |
| 217 #endif | 234 #endif |
| 218 RegisterInvalidParamHandler(); | 235 RegisterInvalidParamHandler(); |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 | 321 |
| 305 #ifdef NDEBUG | 322 #ifdef NDEBUG |
| 306 if (parsed_command_line.HasSwitch(switches::kSilentDumpOnDCHECK) && | 323 if (parsed_command_line.HasSwitch(switches::kSilentDumpOnDCHECK) && |
| 307 parsed_command_line.HasSwitch(switches::kEnableDCHECK)) { | 324 parsed_command_line.HasSwitch(switches::kEnableDCHECK)) { |
| 308 #if defined(OS_WIN) | 325 #if defined(OS_WIN) |
| 309 logging::SetLogAssertHandler(ChromeAssert); | 326 logging::SetLogAssertHandler(ChromeAssert); |
| 310 #endif | 327 #endif |
| 311 } | 328 } |
| 312 #endif // NDEBUG | 329 #endif // NDEBUG |
| 313 | 330 |
| 314 if (!process_type.empty()) { | 331 if (!process_type.empty()) |
| 315 #if defined(OS_WIN) | 332 CommonSubprocessInit(); |
| 316 // Initialize ResourceBundle which handles files loaded from external | |
| 317 // sources. The language should have been passed in to us from the | |
| 318 // browser process as a command line flag. | |
| 319 // TODO(port): enable when we figure out resource bundle issues | |
| 320 ResourceBundle::InitSharedInstance(std::wstring()); | |
| 321 #endif | |
| 322 } | |
| 323 | 333 |
| 324 startup_timer.Stop(); // End of Startup Time Measurement. | 334 startup_timer.Stop(); // End of Startup Time Measurement. |
| 325 | 335 |
| 326 // TODO(port): turn on these main() functions as they've been de-winified. | 336 // TODO(port): turn on these main() functions as they've been de-winified. |
| 327 int rv = -1; | 337 int rv = -1; |
| 328 if (process_type == switches::kRendererProcess) { | 338 if (process_type == switches::kRendererProcess) { |
| 329 #if defined(OS_WIN) | 339 #if defined(OS_WIN) |
| 330 rv = RendererMain(parsed_command_line, target_services); | 340 rv = RendererMain(parsed_command_line, target_services); |
| 331 #endif | 341 #endif |
| 332 } else if (process_type == switches::kPluginProcess) { | 342 } else if (process_type == switches::kPluginProcess) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 362 | 372 |
| 363 _Module.Term(); | 373 _Module.Term(); |
| 364 #endif | 374 #endif |
| 365 | 375 |
| 366 logging::CleanupChromeLogging(); | 376 logging::CleanupChromeLogging(); |
| 367 | 377 |
| 368 return rv; | 378 return rv; |
| 369 } | 379 } |
| 370 | 380 |
| 371 | 381 |
| OLD | NEW |