Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Unified Diff: ipc/attachment_broker_unprivileged_mac.cc

Issue 1385143002: ipc: Update MachPortMac ownership semantics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix rebase errors. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ipc/attachment_broker_unprivileged_mac.h ('k') | ipc/attachment_broker_unprivileged_win.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/attachment_broker_unprivileged_mac.cc
diff --git a/ipc/attachment_broker_unprivileged_mac.cc b/ipc/attachment_broker_unprivileged_mac.cc
index b4ced08048511f597f60b46f0885d584a47b722c..65d26f245b01d8fb19ea655d3117992ea4693765 100644
--- a/ipc/attachment_broker_unprivileged_mac.cc
+++ b/ipc/attachment_broker_unprivileged_mac.cc
@@ -50,16 +50,19 @@ AttachmentBrokerUnprivilegedMac::AttachmentBrokerUnprivilegedMac() {}
AttachmentBrokerUnprivilegedMac::~AttachmentBrokerUnprivilegedMac() {}
bool AttachmentBrokerUnprivilegedMac::SendAttachmentToProcess(
- const BrokerableAttachment* attachment,
+ BrokerableAttachment* attachment,
base::ProcessId destination_process) {
switch (attachment->GetBrokerableType()) {
case BrokerableAttachment::MACH_PORT: {
- const internal::MachPortAttachmentMac* mach_port_attachment =
- static_cast<const internal::MachPortAttachmentMac*>(attachment);
+ internal::MachPortAttachmentMac* mach_port_attachment =
+ static_cast<internal::MachPortAttachmentMac*>(attachment);
internal::MachPortAttachmentMac::WireFormat format =
mach_port_attachment->GetWireFormat(destination_process);
- return get_sender()->Send(
- new AttachmentBrokerMsg_DuplicateMachPort(format));
+ bool success =
+ get_sender()->Send(new AttachmentBrokerMsg_DuplicateMachPort(format));
+ if (success)
+ mach_port_attachment->reset_mach_port_ownership();
+ return success;
}
default:
NOTREACHED();
« no previous file with comments | « ipc/attachment_broker_unprivileged_mac.h ('k') | ipc/attachment_broker_unprivileged_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698