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

Unified Diff: ipc/ipc_channel_win.cc

Issue 1188923003: Stub in more IPC attachment brokering functionality. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change the wireformat to use int32_t for HANDLE. Created 5 years, 6 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
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
« ipc/brokerable_attachment.cc ('K') | « ipc/ipc.gypi ('k') | ipc/ipc_handle_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698