summaryrefslogtreecommitdiffstats
path: root/base/mac
diff options
context:
space:
mode:
authorrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-10 22:57:00 +0000
committerrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-10 22:57:00 +0000
commitee58e43f691ce88e010f643f83c8e1460329d034 (patch)
treeaf2f6adfeff00f0ee32518e7777ec8c7b74af36e /base/mac
parentb171a897f6130423749daa5cf9b11d79b0b3ec07 (diff)
downloadchromium_src-ee58e43f691ce88e010f643f83c8e1460329d034.zip
chromium_src-ee58e43f691ce88e010f643f83c8e1460329d034.tar.gz
chromium_src-ee58e43f691ce88e010f643f83c8e1460329d034.tar.bz2
[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 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@193486 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/mac')
-rw-r--r--base/mac/scoped_mach_port.cc5
-rw-r--r--base/mac/scoped_mach_port.h2
2 files changed, 7 insertions, 0 deletions
diff --git a/base/mac/scoped_mach_port.cc b/base/mac/scoped_mach_port.cc
index 652e3f4..9e45a85 100644
--- a/base/mac/scoped_mach_port.cc
+++ b/base/mac/scoped_mach_port.cc
@@ -11,9 +11,14 @@ ScopedMachPort::ScopedMachPort(mach_port_t port) : port_(port) {
}
ScopedMachPort::~ScopedMachPort() {
+ reset();
+}
+
+void ScopedMachPort::reset(mach_port_t port) {
if (port_ != MACH_PORT_NULL) {
mach_port_deallocate(mach_task_self(), port_);
}
+ port_ = port;
}
} // namespace mac
diff --git a/base/mac/scoped_mach_port.h b/base/mac/scoped_mach_port.h
index d2aa2f7..cc2ef20 100644
--- a/base/mac/scoped_mach_port.h
+++ b/base/mac/scoped_mach_port.h
@@ -22,6 +22,8 @@ class BASE_EXPORT ScopedMachPort {
~ScopedMachPort();
+ void reset(mach_port_t port = MACH_PORT_NULL);
+
operator mach_port_t() const {
return port_;
}