| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/browser/mach_broker_mac.h" | 5 #include "chrome/browser/mach_broker_mac.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/mach_ipc_mac.h" | 9 #include "base/mach_ipc_mac.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 11 #include "base/sys_string_conversions.h" | 11 #include "base/sys_string_conversions.h" |
| 12 #include "base/threading/platform_thread.h" | 12 #include "base/threading/platform_thread.h" |
| 13 #include "chrome/browser/extensions/extension_host.h" | 13 #include "chrome/browser/extensions/extension_host.h" |
| 14 #include "chrome/common/child_process_info.h" | |
| 15 #include "chrome/common/chrome_switches.h" | 14 #include "chrome/common/chrome_switches.h" |
| 16 #include "content/browser/browser_thread.h" | 15 #include "content/browser/browser_thread.h" |
| 17 #include "content/browser/renderer_host/render_process_host.h" | 16 #include "content/browser/renderer_host/render_process_host.h" |
| 17 #include "content/common/child_process_info.h" |
| 18 #include "content/common/notification_service.h" | 18 #include "content/common/notification_service.h" |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 // Prints a string representation of a Mach error code. | 21 // Prints a string representation of a Mach error code. |
| 22 std::string MachErrorCode(kern_return_t err) { | 22 std::string MachErrorCode(kern_return_t err) { |
| 23 return StringPrintf("0x%x %s", err, mach_error_string(err)); | 23 return StringPrintf("0x%x %s", err, mach_error_string(err)); |
| 24 } | 24 } |
| 25 } // namespace | 25 } // namespace |
| 26 | 26 |
| 27 // Required because notifications happen on the UI thread. | 27 // Required because notifications happen on the UI thread. |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 #endif | 235 #endif |
| 236 ".rohitfork.%d"; | 236 ".rohitfork.%d"; |
| 237 | 237 |
| 238 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 238 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 239 const bool is_child = command_line.HasSwitch(switches::kProcessType); | 239 const bool is_child = command_line.HasSwitch(switches::kProcessType); |
| 240 | 240 |
| 241 // In non-browser (child) processes, use the parent's pid. | 241 // In non-browser (child) processes, use the parent's pid. |
| 242 const pid_t pid = is_child ? getppid() : getpid(); | 242 const pid_t pid = is_child ? getppid() : getpid(); |
| 243 return StringPrintf(kFormatString, pid); | 243 return StringPrintf(kFormatString, pid); |
| 244 } | 244 } |
| OLD | NEW |