Index: ipc/ipc_channel_win.cc |
diff --git a/ipc/ipc_channel_win.cc b/ipc/ipc_channel_win.cc |
index 0e603195f3e23bf32765614c3b3595ee30f486f4..6f41fd647cc9a7964b30288977a3ece891961ea8 100644 |
--- a/ipc/ipc_channel_win.cc |
+++ b/ipc/ipc_channel_win.cc |
@@ -19,6 +19,7 @@ |
#include "base/win/scoped_handle.h" |
#include "ipc/ipc_listener.h" |
#include "ipc/ipc_logging.h" |
+#include "ipc/ipc_message_attachment_set.h" |
#include "ipc/ipc_message_utils.h" |
namespace IPC { |
@@ -81,12 +82,26 @@ void ChannelWin::Close() { |
} |
bool ChannelWin::Send(Message* message) { |
+ // TODO(erikchen): Remove this DCHECK once ChannelWin fully supports |
+ // brokerable attachments. http://crbug.com/493414. |
DCHECK(!message->HasAttachments()); |
DCHECK(thread_check_->CalledOnValidThread()); |
DVLOG(2) << "sending message @" << message << " on channel @" << this |
<< " with type " << message->type() |
<< " (" << output_queue_.size() << " in queue)"; |
+ // Sending a brokerable attachment requires a call to Channel::Send(), so |
+ // Send() may be re-entrant. Brokered attachments must be sent before the |
+ // Message itself. |
+ if (message->HasBrokerableAttachments()) { |
+ DCHECK(broker_); |
+ for (const BrokerableAttachment* attachment : |
+ message->attachment_set()->PeekBrokerableAttachments()) { |
+ if (!broker_->SendAttachmentToProcess(attachment, peer_pid_)) |
+ return false; |
+ } |
+ } |
+ |
#ifdef IPC_MESSAGE_LOG_ENABLED |
Logging::GetInstance()->OnSendMessage(message, ""); |
#endif |