| 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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 #endif | 327 #endif |
| 328 #endif | 328 #endif |
| 329 | 329 |
| 330 // Initialize the command line. | 330 // Initialize the command line. |
| 331 #if defined(OS_WIN) | 331 #if defined(OS_WIN) |
| 332 CommandLine::Init(0, NULL); | 332 CommandLine::Init(0, NULL); |
| 333 #else | 333 #else |
| 334 CommandLine::Init(argc, argv); | 334 CommandLine::Init(argc, argv); |
| 335 #endif | 335 #endif |
| 336 | 336 |
| 337 #if defined(OS_MACOSX) | |
| 338 // TODO(mark): Right now, InitCrashReporter() needs to be called after | |
| 339 // CommandLine::Init(). Ideally, Breakpad initialization could occur | |
| 340 // sooner, preferably even before the framework dylib is even loaded, to | |
| 341 // catch potential early early crashes. | |
| 342 InitCrashReporter(); | |
| 343 | |
| 344 // If Breakpad is not present, turn off OS crash dumps to avoid having | |
| 345 // to wait eons for Apple's Crash Reporter to generate dumps for builds | |
| 346 // where debugging symbols are present. | |
| 347 if (IsCrashReporterDisabled()) | |
| 348 DebugUtil::DisableOSCrashDumps(); | |
| 349 else | |
| 350 InitCrashProcessInfo(); | |
| 351 #endif // OS_MACOSX | |
| 352 | |
| 353 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 337 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
| 354 | 338 |
| 355 #if defined(OS_WIN) | 339 #if defined(OS_WIN) |
| 356 // Must do this before any other usage of command line! | 340 // Must do this before any other usage of command line! |
| 357 if (HasDeprecatedArguments(parsed_command_line.command_line_string())) | 341 if (HasDeprecatedArguments(parsed_command_line.command_line_string())) |
| 358 return 1; | 342 return 1; |
| 359 #endif | 343 #endif |
| 360 | 344 |
| 361 #if defined(OS_LINUX) | 345 #if defined(OS_LINUX) |
| 362 // Show the man page on --help or -h. | 346 // Show the man page on --help or -h. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 if (!DebugUtil::BeingDebugged()) | 401 if (!DebugUtil::BeingDebugged()) |
| 418 signal(SIGINT, SIG_IGN); | 402 signal(SIGINT, SIG_IGN); |
| 419 #endif | 403 #endif |
| 420 } | 404 } |
| 421 SetupCRT(parsed_command_line); | 405 SetupCRT(parsed_command_line); |
| 422 | 406 |
| 423 // Initialize the Chrome path provider. | 407 // Initialize the Chrome path provider. |
| 424 app::RegisterPathProvider(); | 408 app::RegisterPathProvider(); |
| 425 chrome::RegisterPathProvider(); | 409 chrome::RegisterPathProvider(); |
| 426 | 410 |
| 411 #if defined(OS_MACOSX) |
| 412 // TODO(mark): Right now, InitCrashReporter() needs to be called after |
| 413 // CommandLine::Init() and chrome::RegisterPathProvider(). Ideally, Breakpad |
| 414 // initialization could occur sooner, preferably even before the framework |
| 415 // dylib is even loaded, to catch potential early crashes. |
| 416 InitCrashReporter(); |
| 417 |
| 418 // If Breakpad is not present, turn off OS crash dumps to avoid having |
| 419 // to wait eons for Apple's Crash Reporter to generate dumps for builds |
| 420 // where debugging symbols are present. |
| 421 if (IsCrashReporterDisabled()) |
| 422 DebugUtil::DisableOSCrashDumps(); |
| 423 else |
| 424 InitCrashProcessInfo(); |
| 425 #endif // OS_MACOSX |
| 426 |
| 427 // Initialize the Stats Counters table. With this initialized, | 427 // Initialize the Stats Counters table. With this initialized, |
| 428 // the StatsViewer can be utilized to read counters outside of | 428 // the StatsViewer can be utilized to read counters outside of |
| 429 // Chrome. These lines can be commented out to effectively turn | 429 // Chrome. These lines can be commented out to effectively turn |
| 430 // counters 'off'. The table is created and exists for the life | 430 // counters 'off'. The table is created and exists for the life |
| 431 // of the process. It is not cleaned up. | 431 // of the process. It is not cleaned up. |
| 432 // TODO(port): we probably need to shut this down correctly to avoid | 432 // TODO(port): we probably need to shut this down correctly to avoid |
| 433 // leaking shared memory regions on posix platforms. | 433 // leaking shared memory regions on posix platforms. |
| 434 if (parsed_command_line.HasSwitch(switches::kEnableStatsTable)) { | 434 if (parsed_command_line.HasSwitch(switches::kEnableStatsTable)) { |
| 435 std::string statsfile = | 435 std::string statsfile = |
| 436 StringPrintf("%s-%d", chrome::kStatsFilename, browser_pid); | 436 StringPrintf("%s-%d", chrome::kStatsFilename, browser_pid); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 | 572 |
| 573 logging::CleanupChromeLogging(); | 573 logging::CleanupChromeLogging(); |
| 574 | 574 |
| 575 #if defined(OS_MACOSX) && defined(GOOGLE_CHROME_BUILD) | 575 #if defined(OS_MACOSX) && defined(GOOGLE_CHROME_BUILD) |
| 576 // TODO(mark): See the TODO(mark) above at InitCrashReporter. | 576 // TODO(mark): See the TODO(mark) above at InitCrashReporter. |
| 577 DestructCrashReporter(); | 577 DestructCrashReporter(); |
| 578 #endif // OS_MACOSX && GOOGLE_CHROME_BUILD | 578 #endif // OS_MACOSX && GOOGLE_CHROME_BUILD |
| 579 | 579 |
| 580 return rv; | 580 return rv; |
| 581 } | 581 } |
| OLD | NEW |