summaryrefslogtreecommitdiffstats
path: root/content/app
diff options
context:
space:
mode:
authorrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-11 00:07:25 +0000
committerrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-11 00:07:25 +0000
commitd52d8bff0029726f8f6e21a425b770093b57fa6b (patch)
tree005774df70f223fd59c0ffafdb23eecadedc2739 /content/app
parentc553dcdf53ca9d4c14dceab5102b6cada415e494 (diff)
downloadchromium_src-d52d8bff0029726f8f6e21a425b770093b57fa6b.zip
chromium_src-d52d8bff0029726f8f6e21a425b770093b57fa6b.tar.gz
chromium_src-d52d8bff0029726f8f6e21a425b770093b57fa6b.tar.bz2
Revert 193486 "[Mac] Remove base::LaunchSynchronize and rewrite ..."
> [Mac] Remove base::LaunchSynchronize and rewrite content::MachBroker. > > This restructures the way MachBroker parent-child communication happens. Now, > the MachBroker lock will be held for the duration of LaunchProcess until the > PID is returned and inserted into the MachMap. Since the lock must also be > acquired on the broker thread to insert the received task port into the > MachMap, this ensures that the placeholder is always inserted before the task > port. > > MachBroker has also been rewritten to use Mach IPC directly, rather than the C++ > wrappers in base/mach_ipc_mac.h. The wrappers are not flexible enough to allow > the use of an audit trailer. This trailer is used to verify the PID of the > sender of the check in message in the parent. Previously, this was done by > another kernel trap, pid_for_task. > > BUG=179923 > > > Review URL: https://chromiumcodereview.appspot.com/13845008 TBR=rsesek@chromium.org Review URL: https://codereview.chromium.org/14120002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193511 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/app')
-rw-r--r--content/app/content_main_runner.cc28
1 files changed, 27 insertions, 1 deletions
diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc
index 257f701..256f78f 100644
--- a/content/app/content_main_runner.cc
+++ b/content/app/content_main_runner.cc
@@ -180,6 +180,32 @@ base::LazyInstance<ContentUtilityClient>
static CAppModule _Module;
+#elif defined(OS_MACOSX) && !defined(OS_IOS)
+
+// Completes the Mach IPC handshake by sending this process' task port to the
+// parent process. The parent is listening on the Mach port given by
+// |GetMachPortName()|. The task port is used by the parent to get CPU/memory
+// stats to display in the task manager.
+void SendTaskPortToParentProcess() {
+ const mach_msg_timeout_t kTimeoutMs = 100;
+ const int32_t kMessageId = 0;
+ std::string mach_port_name = MachBroker::GetMachPortName();
+
+ base::MachSendMessage child_message(kMessageId);
+ if (!child_message.AddDescriptor(mach_task_self())) {
+ LOG(ERROR) << "child AddDescriptor(mach_task_self()) failed.";
+ return;
+ }
+
+ base::MachPortSender child_sender(mach_port_name.c_str());
+ kern_return_t err = child_sender.SendMessage(child_message, kTimeoutMs);
+ if (err != KERN_SUCCESS) {
+ LOG(ERROR) <<
+ base::StringPrintf("child SendMessage() failed: 0x%x %s", err,
+ mach_error_string(err));
+ }
+}
+
#endif // defined(OS_WIN)
#if defined(OS_POSIX) && !defined(OS_IOS)
@@ -640,7 +666,7 @@ class ContentMainRunnerImpl : public ContentMainRunner {
if (!process_type.empty() &&
(!delegate || delegate->ShouldSendMachPort(process_type))) {
- MachBroker::ChildSendTaskPortToParent();
+ SendTaskPortToParentProcess();
}
#elif defined(OS_WIN)
// This must be done early enough since some helper functions like