| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 #endif | 339 #endif |
| 340 | 340 |
| 341 // Initialize the command line. | 341 // Initialize the command line. |
| 342 #if defined(OS_WIN) | 342 #if defined(OS_WIN) |
| 343 CommandLine::Init(0, NULL); | 343 CommandLine::Init(0, NULL); |
| 344 #else | 344 #else |
| 345 CommandLine::Init(argc, argv); | 345 CommandLine::Init(argc, argv); |
| 346 #endif | 346 #endif |
| 347 | 347 |
| 348 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 348 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
| 349 std::wstring process_type = | 349 std::string process_type = |
| 350 parsed_command_line.GetSwitchValue(switches::kProcessType); | 350 parsed_command_line.GetSwitchValueASCII(switches::kProcessType); |
| 351 | 351 |
| 352 #if defined(OS_MACOSX) | 352 #if defined(OS_MACOSX) |
| 353 mac_util::SetOverrideAppBundlePath(chrome::GetFrameworkBundlePath()); | 353 mac_util::SetOverrideAppBundlePath(chrome::GetFrameworkBundlePath()); |
| 354 #endif // OS_MACOSX | 354 #endif // OS_MACOSX |
| 355 | 355 |
| 356 #if defined(OS_WIN) | 356 #if defined(OS_WIN) |
| 357 // Must do this before any other usage of command line! | 357 // Must do this before any other usage of command line! |
| 358 if (HasDeprecatedArguments(parsed_command_line.command_line_string())) | 358 if (HasDeprecatedArguments(parsed_command_line.command_line_string())) |
| 359 return 1; | 359 return 1; |
| 360 #endif | 360 #endif |
| 361 | 361 |
| 362 #if defined(OS_LINUX) | 362 #if defined(OS_LINUX) |
| 363 // Show the man page on --help or -h. | 363 // Show the man page on --help or -h. |
| 364 if (parsed_command_line.HasSwitch(L"help") || | 364 if (parsed_command_line.HasSwitch("help") || |
| 365 parsed_command_line.HasSwitch(L"h")) { | 365 parsed_command_line.HasSwitch("h")) { |
| 366 FilePath binary(parsed_command_line.argv()[0]); | 366 FilePath binary(parsed_command_line.argv()[0]); |
| 367 int ret = execlp("man", "man", binary.BaseName().value().c_str(), NULL); | 367 int ret = execlp("man", "man", binary.BaseName().value().c_str(), NULL); |
| 368 LOG(FATAL) << "execlp failed: " << strerror(ret); | 368 LOG(FATAL) << "execlp failed: " << strerror(ret); |
| 369 } | 369 } |
| 370 #endif | 370 #endif |
| 371 | 371 |
| 372 #if defined(OS_POSIX) | 372 #if defined(OS_POSIX) |
| 373 // Always ignore SIGPIPE. We check the return value of write(). | 373 // Always ignore SIGPIPE. We check the return value of write(). |
| 374 CHECK(signal(SIGPIPE, SIG_IGN) != SIG_ERR); | 374 CHECK(signal(SIGPIPE, SIG_IGN) != SIG_ERR); |
| 375 #endif // OS_POSIX | 375 #endif // OS_POSIX |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 | 612 |
| 613 logging::CleanupChromeLogging(); | 613 logging::CleanupChromeLogging(); |
| 614 | 614 |
| 615 #if defined(OS_MACOSX) && defined(GOOGLE_CHROME_BUILD) | 615 #if defined(OS_MACOSX) && defined(GOOGLE_CHROME_BUILD) |
| 616 // TODO(mark): See the TODO(mark) above at InitCrashReporter. | 616 // TODO(mark): See the TODO(mark) above at InitCrashReporter. |
| 617 DestructCrashReporter(); | 617 DestructCrashReporter(); |
| 618 #endif // OS_MACOSX && GOOGLE_CHROME_BUILD | 618 #endif // OS_MACOSX && GOOGLE_CHROME_BUILD |
| 619 | 619 |
| 620 return rv; | 620 return rv; |
| 621 } | 621 } |
| OLD | NEW |