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 "content/browser/mach_broker_mac.h" | 5 #include "content/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/mac/foundation_util.h" | 9 #include "base/mac/foundation_util.h" |
10 #include "base/mach_ipc_mac.h" | 10 #include "base/mach_ipc_mac.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
13 #include "base/sys_string_conversions.h" | 13 #include "base/sys_string_conversions.h" |
14 #include "base/threading/platform_thread.h" | 14 #include "base/threading/platform_thread.h" |
15 #include "content/browser/browser_thread.h" | 15 #include "content/browser/browser_thread.h" |
16 #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" | 17 #include "content/common/child_process_info.h" |
18 #include "content/common/content_switches.h" | |
19 #include "content/common/notification_service.h" | 18 #include "content/common/notification_service.h" |
| 19 #include "content/public/common/content_switches.h" |
20 | 20 |
21 namespace { | 21 namespace { |
22 // Prints a string representation of a Mach error code. | 22 // Prints a string representation of a Mach error code. |
23 std::string MachErrorCode(kern_return_t err) { | 23 std::string MachErrorCode(kern_return_t err) { |
24 return base::StringPrintf("0x%x %s", err, mach_error_string(err)); | 24 return base::StringPrintf("0x%x %s", err, mach_error_string(err)); |
25 } | 25 } |
26 } // namespace | 26 } // namespace |
27 | 27 |
28 // Required because notifications happen on the UI thread. | 28 // Required because notifications happen on the UI thread. |
29 class RegisterNotificationTask : public Task { | 29 class RegisterNotificationTask : public Task { |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 223 |
224 // static | 224 // static |
225 std::string MachBroker::GetMachPortName() { | 225 std::string MachBroker::GetMachPortName() { |
226 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 226 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
227 const bool is_child = command_line->HasSwitch(switches::kProcessType); | 227 const bool is_child = command_line->HasSwitch(switches::kProcessType); |
228 | 228 |
229 // In non-browser (child) processes, use the parent's pid. | 229 // In non-browser (child) processes, use the parent's pid. |
230 const pid_t pid = is_child ? getppid() : getpid(); | 230 const pid_t pid = is_child ? getppid() : getpid(); |
231 return base::StringPrintf("%s.rohitfork.%d", base::mac::BaseBundleID(), pid); | 231 return base::StringPrintf("%s.rohitfork.%d", base::mac::BaseBundleID(), pid); |
232 } | 232 } |
OLD | NEW |