| 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 27 matching lines...) Expand all Loading... |
| 38 #include "base/message_loop.h" | 38 #include "base/message_loop.h" |
| 39 #include "base/path_service.h" | 39 #include "base/path_service.h" |
| 40 #include "base/process_util.h" | 40 #include "base/process_util.h" |
| 41 #include "base/scoped_nsautorelease_pool.h" | 41 #include "base/scoped_nsautorelease_pool.h" |
| 42 #include "base/stats_counters.h" | 42 #include "base/stats_counters.h" |
| 43 #include "base/stats_table.h" | 43 #include "base/stats_table.h" |
| 44 #include "base/string_util.h" | 44 #include "base/string_util.h" |
| 45 #if defined(OS_WIN) | 45 #if defined(OS_WIN) |
| 46 #include "base/win_util.h" | 46 #include "base/win_util.h" |
| 47 #endif | 47 #endif |
| 48 #if defined(OS_LINUX) |
| 49 #include "base/zygote_manager.h" |
| 50 #endif |
| 48 #if defined(OS_MACOSX) | 51 #if defined(OS_MACOSX) |
| 49 #include "chrome/app/breakpad_mac.h" | 52 #include "chrome/app/breakpad_mac.h" |
| 50 #elif defined(OS_LINUX) | 53 #elif defined(OS_LINUX) |
| 51 #include "chrome/app/breakpad_linux.h" | 54 #include "chrome/app/breakpad_linux.h" |
| 52 #endif | 55 #endif |
| 53 #include "chrome/app/scoped_ole_initializer.h" | 56 #include "chrome/app/scoped_ole_initializer.h" |
| 54 #include "chrome/browser/renderer_host/render_process_host.h" | 57 #include "chrome/browser/renderer_host/render_process_host.h" |
| 55 #include "chrome/common/chrome_constants.h" | 58 #include "chrome/common/chrome_constants.h" |
| 56 #include "chrome/common/chrome_counters.h" | 59 #include "chrome/common/chrome_counters.h" |
| 57 #include "chrome/common/chrome_paths.h" | 60 #include "chrome/common/chrome_paths.h" |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 | 288 |
| 286 // We need this pool for all the objects created before we get to the | 289 // We need this pool for all the objects created before we get to the |
| 287 // event loop, but we don't want to leave them hanging around until the | 290 // event loop, but we don't want to leave them hanging around until the |
| 288 // app quits. Each "main" needs to flush this pool right before it goes into | 291 // app quits. Each "main" needs to flush this pool right before it goes into |
| 289 // its main event loop to get rid of the cruft. | 292 // its main event loop to get rid of the cruft. |
| 290 base::ScopedNSAutoreleasePool autorelease_pool; | 293 base::ScopedNSAutoreleasePool autorelease_pool; |
| 291 | 294 |
| 292 // Initialize the command line. | 295 // Initialize the command line. |
| 293 #if defined(OS_WIN) | 296 #if defined(OS_WIN) |
| 294 CommandLine::Init(0, NULL); | 297 CommandLine::Init(0, NULL); |
| 298 #elif defined(OS_LINUX) |
| 299 base::ZygoteManager* zm = base::ZygoteManager::Get(); |
| 300 std::vector<std::string>* zargv = NULL; |
| 301 if (zm) |
| 302 zargv = zm->Start(); |
| 303 if (zargv) { |
| 304 // Forked child. |
| 305 CommandLine::Init(*zargv); |
| 306 } else { |
| 307 // Original process. |
| 308 CommandLine::Init(argc, argv); |
| 309 } |
| 295 #else | 310 #else |
| 296 CommandLine::Init(argc, argv); | 311 CommandLine::Init(argc, argv); |
| 297 #endif | 312 #endif |
| 298 | 313 |
| 299 #if defined(OS_MACOSX) | 314 #if defined(OS_MACOSX) |
| 300 // Needs to be called after CommandLine::Init(). | 315 // Needs to be called after CommandLine::Init(). |
| 301 InitCrashProcessInfo(); | 316 InitCrashProcessInfo(); |
| 302 #endif | 317 #endif |
| 303 | 318 |
| 304 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 319 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 _CrtDumpMemoryLeaks(); | 517 _CrtDumpMemoryLeaks(); |
| 503 #endif // _CRTDBG_MAP_ALLOC | 518 #endif // _CRTDBG_MAP_ALLOC |
| 504 | 519 |
| 505 _Module.Term(); | 520 _Module.Term(); |
| 506 #endif | 521 #endif |
| 507 | 522 |
| 508 logging::CleanupChromeLogging(); | 523 logging::CleanupChromeLogging(); |
| 509 | 524 |
| 510 return rv; | 525 return rv; |
| 511 } | 526 } |
| OLD | NEW |