| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 28 matching lines...) Expand all Loading... |
| 39 #include "base/command_line.h" | 39 #include "base/command_line.h" |
| 40 #include "base/debug_util.h" | 40 #include "base/debug_util.h" |
| 41 #include "base/file_version_info.h" | 41 #include "base/file_version_info.h" |
| 42 #include "base/i18n/icu_util.h" | 42 #include "base/i18n/icu_util.h" |
| 43 #include "base/message_loop.h" | 43 #include "base/message_loop.h" |
| 44 #include "base/path_service.h" | 44 #include "base/path_service.h" |
| 45 #include "base/process_util.h" | 45 #include "base/process_util.h" |
| 46 #include "base/scoped_nsautorelease_pool.h" | 46 #include "base/scoped_nsautorelease_pool.h" |
| 47 #include "base/stats_counters.h" | 47 #include "base/stats_counters.h" |
| 48 #include "base/stats_table.h" | 48 #include "base/stats_table.h" |
| 49 #include "base/string_number_conversions.h" |
| 49 #include "base/string_util.h" | 50 #include "base/string_util.h" |
| 50 #include "base/utf_string_conversions.h" | 51 #include "base/utf_string_conversions.h" |
| 51 #include "chrome/browser/diagnostics/diagnostics_main.h" | 52 #include "chrome/browser/diagnostics/diagnostics_main.h" |
| 52 #include "chrome/browser/renderer_host/render_process_host.h" | 53 #include "chrome/browser/renderer_host/render_process_host.h" |
| 53 #include "chrome/browser/platform_util.h" | 54 #include "chrome/browser/platform_util.h" |
| 54 #include "chrome/common/chrome_constants.h" | 55 #include "chrome/common/chrome_constants.h" |
| 55 #include "chrome/common/chrome_counters.h" | 56 #include "chrome/common/chrome_counters.h" |
| 56 #include "chrome/common/chrome_descriptors.h" | 57 #include "chrome/common/chrome_descriptors.h" |
| 57 #include "chrome/common/chrome_paths.h" | 58 #include "chrome/common/chrome_paths.h" |
| 58 #include "chrome/common/chrome_switches.h" | 59 #include "chrome/common/chrome_switches.h" |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 singleton_command_line->AppendSwitch(switches::kDisableExtensions); | 577 singleton_command_line->AppendSwitch(switches::kDisableExtensions); |
| 577 } | 578 } |
| 578 #endif | 579 #endif |
| 579 | 580 |
| 580 base::ProcessId browser_pid = base::GetCurrentProcId(); | 581 base::ProcessId browser_pid = base::GetCurrentProcId(); |
| 581 if (SubprocessIsBrowserChild(process_type)) { | 582 if (SubprocessIsBrowserChild(process_type)) { |
| 582 #if defined(OS_WIN) | 583 #if defined(OS_WIN) |
| 583 std::wstring channel_name = | 584 std::wstring channel_name = |
| 584 parsed_command_line.GetSwitchValue(switches::kProcessChannelID); | 585 parsed_command_line.GetSwitchValue(switches::kProcessChannelID); |
| 585 | 586 |
| 586 browser_pid = | 587 int browser_pid_int; |
| 587 static_cast<base::ProcessId>(StringToInt(WideToASCII(channel_name))); | 588 base::StringToInt(WideToUTF8(channel_name), &browser_pid_int); |
| 589 browser_pid = static_cast<base::ProcessId>(browser_pid_int); |
| 588 DCHECK_NE(browser_pid, 0u); | 590 DCHECK_NE(browser_pid, 0u); |
| 589 #elif defined(OS_MACOSX) | 591 #elif defined(OS_MACOSX) |
| 590 browser_pid = base::GetCurrentProcId(); | 592 browser_pid = base::GetCurrentProcId(); |
| 591 #elif defined(OS_POSIX) | 593 #elif defined(OS_POSIX) |
| 592 // On linux, we're in the zygote here; so we need the parent process' id. | 594 // On linux, we're in the zygote here; so we need the parent process' id. |
| 593 browser_pid = base::GetParentProcessId(base::GetCurrentProcId()); | 595 browser_pid = base::GetParentProcessId(base::GetCurrentProcId()); |
| 594 #endif | 596 #endif |
| 595 | 597 |
| 596 #if defined(OS_POSIX) | 598 #if defined(OS_POSIX) |
| 597 // When you hit Ctrl-C in a terminal running the browser | 599 // When you hit Ctrl-C in a terminal running the browser |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 | 916 |
| 915 logging::CleanupChromeLogging(); | 917 logging::CleanupChromeLogging(); |
| 916 | 918 |
| 917 #if defined(OS_MACOSX) && defined(GOOGLE_CHROME_BUILD) | 919 #if defined(OS_MACOSX) && defined(GOOGLE_CHROME_BUILD) |
| 918 // TODO(mark): See the TODO(mark) above at InitCrashReporter. | 920 // TODO(mark): See the TODO(mark) above at InitCrashReporter. |
| 919 DestructCrashReporter(); | 921 DestructCrashReporter(); |
| 920 #endif // OS_MACOSX && GOOGLE_CHROME_BUILD | 922 #endif // OS_MACOSX && GOOGLE_CHROME_BUILD |
| 921 | 923 |
| 922 return rv; | 924 return rv; |
| 923 } | 925 } |
| OLD | NEW |