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

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: Add missing files. 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..cff0f4b6752e91ce2e4b5d10dc5b49d79e66c06b 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,28 @@ 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 (scoped_refptr<BrokerableAttachment> attachment :
Tom Sepez 2015/06/19 18:04:11 Are we sure this doesn't do needless ref/dererf on
erikchen 2015/06/23 22:37:00 As per your later suggestion, I changed the interf
+ message->attachment_set()->PeekBrokerableAttachments()) {
+ bool success =
Tom Sepez 2015/06/19 18:04:11 nit: no need for local.
erikchen 2015/06/23 22:37:00 I've removed it.
+ broker_->SendAttachmentToProcess(attachment.get(), peer_pid_);
Tom Sepez 2015/06/19 18:04:11 nit: local var not needed.
erikchen 2015/06/23 22:37:00 Done.
+ if (!success)
+ return false;
+ }
+ }
+
#ifdef IPC_MESSAGE_LOG_ENABLED
Logging::GetInstance()->OnSendMessage(message, "");
#endif

Powered by Google App Engine
This is Rietveld 408576698