summaryrefslogtreecommitdiffstats
path: root/ipc/handle_attachment_win.cc
diff options
context:
space:
mode:
authorerikchen <erikchen@chromium.org>2015-08-19 17:59:13 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-20 01:00:01 +0000
commite8e4f4fa67ee9db6c2910020ef49318e5df68481 (patch)
treec55abb9c58bab8564cb20c36e2c4887e0c5d095b /ipc/handle_attachment_win.cc
parent0e70552cb63a7f64d4badcf70e3e25d256b31f24 (diff)
downloadchromium_src-e8e4f4fa67ee9db6c2910020ef49318e5df68481.zip
chromium_src-e8e4f4fa67ee9db6c2910020ef49318e5df68481.tar.gz
chromium_src-e8e4f4fa67ee9db6c2910020ef49318e5df68481.tar.bz2
IPC: Add attachment brokering support to the message header.
Message dispatch happens before message translation, and message dispatch requires that all brokered attachments have been received. This means that attachment brokering needs to function without message translation. This is accomplished by modifying the message header to include a new field num_brokered_attachments, and writing the attachment ids into the IPC Channel immediately following the pickled message itself. AttachmentBrokerPrivilegedWinUnittest was expanded to test ChannelReader in the receiving process. It is now a fully functional end-to-end test of attachment brokering. BUG=493414 Review URL: https://codereview.chromium.org/1286253002 Cr-Commit-Position: refs/heads/master@{#344389}
Diffstat (limited to 'ipc/handle_attachment_win.cc')
-rw-r--r--ipc/handle_attachment_win.cc17
1 files changed, 2 insertions, 15 deletions
diff --git a/ipc/handle_attachment_win.cc b/ipc/handle_attachment_win.cc
index 50e3e6d..b7f4373 100644
--- a/ipc/handle_attachment_win.cc
+++ b/ipc/handle_attachment_win.cc
@@ -14,13 +14,13 @@ HandleAttachmentWin::HandleAttachmentWin(const HANDLE& handle,
: handle_(handle), permissions_(permissions) {}
HandleAttachmentWin::HandleAttachmentWin(const WireFormat& wire_format)
- : BrokerableAttachment(wire_format.attachment_id, false),
+ : BrokerableAttachment(wire_format.attachment_id),
handle_(LongToHandle(wire_format.handle)),
permissions_(wire_format.permissions) {}
HandleAttachmentWin::HandleAttachmentWin(
const BrokerableAttachment::AttachmentId& id)
- : BrokerableAttachment(id, true),
+ : BrokerableAttachment(id),
handle_(INVALID_HANDLE_VALUE),
permissions_(HandleWin::INVALID) {}
@@ -32,19 +32,6 @@ HandleAttachmentWin::BrokerableType HandleAttachmentWin::GetBrokerableType()
return WIN_HANDLE;
}
-void HandleAttachmentWin::PopulateWithAttachment(
- const BrokerableAttachment* attachment) {
- DCHECK(NeedsBrokering());
- DCHECK(!attachment->NeedsBrokering());
- DCHECK(GetIdentifier() == attachment->GetIdentifier());
- DCHECK_EQ(GetBrokerableType(), attachment->GetBrokerableType());
-
- const HandleAttachmentWin* handle_attachment =
- static_cast<const HandleAttachmentWin*>(attachment);
- handle_ = handle_attachment->handle_;
- SetNeedsBrokering(false);
-}
-
HandleAttachmentWin::WireFormat HandleAttachmentWin::GetWireFormat(
const base::ProcessId& destination) const {
WireFormat format;