| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/public/app/content_main_runner.h" | 5 #include "content/public/app/content_main_runner.h" |
| 6 | 6 |
| 7 #include <stdlib.h> | 7 #include <stdlib.h> |
| 8 | 8 |
| 9 #include "base/allocator/allocator_extension.h" | 9 #include "base/allocator/allocator_extension.h" |
| 10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 // Completes the Mach IPC handshake by sending this process' task port to the | 179 // Completes the Mach IPC handshake by sending this process' task port to the |
| 180 // parent process. The parent is listening on the Mach port given by | 180 // parent process. The parent is listening on the Mach port given by |
| 181 // |GetMachPortName()|. The task port is used by the parent to get CPU/memory | 181 // |GetMachPortName()|. The task port is used by the parent to get CPU/memory |
| 182 // stats to display in the task manager. | 182 // stats to display in the task manager. |
| 183 void SendTaskPortToParentProcess() { | 183 void SendTaskPortToParentProcess() { |
| 184 const mach_msg_timeout_t kTimeoutMs = 100; | 184 const mach_msg_timeout_t kTimeoutMs = 100; |
| 185 const int32_t kMessageId = 0; | 185 const int32_t kMessageId = 0; |
| 186 std::string mach_port_name = MachBroker::GetMachPortName(); | 186 std::string mach_port_name = MachBroker::GetMachPortName(); |
| 187 | 187 |
| 188 base::MachSendMessage child_message(kMessageId); | 188 base::MachSendMessage child_message(kMessageId); |
| 189 if (!child_message.AddDescriptor(mach_task_self())) { | 189 base::MachMsgPortDescriptor descriptor(mach_task_self()); |
| 190 LOG(ERROR) << "child AddDescriptor(mach_task_self()) failed."; | 190 if (!child_message.AddDescriptor(descriptor)) { |
| 191 LOG(ERROR) << "child AddDescriptor(descriptor)) failed."; |
| 191 return; | 192 return; |
| 192 } | 193 } |
| 193 | 194 |
| 194 base::MachPortSender child_sender(mach_port_name.c_str()); | 195 base::MachPortSender child_sender(mach_port_name.c_str()); |
| 195 kern_return_t err = child_sender.SendMessage(child_message, kTimeoutMs); | 196 kern_return_t err = child_sender.SendMessage(child_message, kTimeoutMs); |
| 196 if (err != KERN_SUCCESS) { | 197 if (err != KERN_SUCCESS) { |
| 197 LOG(ERROR) << StringPrintf("child SendMessage() failed: 0x%x %s", err, | 198 LOG(ERROR) << StringPrintf("child SendMessage() failed: 0x%x %s", err, |
| 198 mach_error_string(err)); | 199 mach_error_string(err)); |
| 199 } | 200 } |
| 200 } | 201 } |
| (...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 | 813 |
| 813 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); | 814 DISALLOW_COPY_AND_ASSIGN(ContentMainRunnerImpl); |
| 814 }; | 815 }; |
| 815 | 816 |
| 816 // static | 817 // static |
| 817 ContentMainRunner* ContentMainRunner::Create() { | 818 ContentMainRunner* ContentMainRunner::Create() { |
| 818 return new ContentMainRunnerImpl(); | 819 return new ContentMainRunnerImpl(); |
| 819 } | 820 } |
| 820 | 821 |
| 821 } // namespace content | 822 } // namespace content |
| OLD | NEW |