summaryrefslogtreecommitdiffstats
path: root/ipc/handle_attachment_win.h
Commit message (Collapse)AuthorAgeFilesLines
* Fix failing tests with ChannelMojo enabled.sammc2016-03-101-0/+7
| | | | | | | | | | | | | | | | | | | This ChannelMojo to: - take a ScopedMessagePipeHandle instead of a string token so an in-process renderer can be passed the message pipe directly; - send brokered attachments as mojo handles; and - offer messages to AttachmentBroker. This also fixes and re-enables ipc_channel_mojo_unittest.cc. BUG=579813 Committed: https://crrev.com/013cfed7ecf91b0700bec7147631d4fbedb6b64e Cr-Commit-Position: refs/heads/master@{#380294} Review URL: https://codereview.chromium.org/1768903002 Cr-Commit-Position: refs/heads/master@{#380360}
* Revert of Fix failing tests with ChannelMojo enabled. (patchset #3 id:300001 ↵tsergeant2016-03-101-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of https://codereview.chromium.org/1768903002/ ) Reason for revert: This CL is causing failures in ipc_mojo_unittests. See: https://build.chromium.org/p/chromium.linux/builders/Linux%20Tests%20%28dbg%29%281%29/builds/52715 https://build.chromium.org/p/chromium.linux/builders/Linux%20Tests%20%28dbg%29%281%29%2832%29/builds/26588 Original issue's description: > Fix failing tests with ChannelMojo enabled. > > This ChannelMojo to: > - take a ScopedMessagePipeHandle instead of a string token so an > in-process renderer can be passed the message pipe directly; > - send brokered attachments as mojo handles; and > - offer messages to AttachmentBroker. > > This also fixes and re-enables ipc_channel_mojo_unittest.cc. > > BUG=579813 > > Committed: https://crrev.com/013cfed7ecf91b0700bec7147631d4fbedb6b64e > Cr-Commit-Position: refs/heads/master@{#380294} TBR=rockot@chromium.org,tsepez@chromium.org,ben@chromium.org,sammc@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=579813 Review URL: https://codereview.chromium.org/1784773002 Cr-Commit-Position: refs/heads/master@{#380325}
* Fix failing tests with ChannelMojo enabled.sammc2016-03-101-0/+7
| | | | | | | | | | | | | | | | This ChannelMojo to: - take a ScopedMessagePipeHandle instead of a string token so an in-process renderer can be passed the message pipe directly; - send brokered attachments as mojo handles; and - offer messages to AttachmentBroker. This also fixes and re-enables ipc_channel_mojo_unittest.cc. BUG=579813 Review URL: https://codereview.chromium.org/1768903002 Cr-Commit-Position: refs/heads/master@{#380294}
* ipc: Implement attachment brokering for SharedMemoryHandle on Windows.erikchen2016-01-081-7/+8
| | | | | | | | | | | | | | | | | | Each SharedMemoryHandle is backed by a HANDLE, and that HANDLE is associated with a specific process. If a SharedMemoryHandle passed to IPC is associated with the current process, the IPC stack will automatically broker the handle to the destination process. This functionality has been implemented and tested, but is not yet turned on, because there are a couple of Windows-specific Chrome IPC messages that intentionally pass a HANDLE associated with another process. I will write a follow-up CL that turns on this functionality, and removes those IPC messages. BUG=493414 Review URL: https://codereview.chromium.org/1493413004 Cr-Commit-Position: refs/heads/master@{#368244}
* ipc: Update Windows attachment brokering ownership semantics.erikchen2015-12-041-1/+17
| | | | | | | | | | | I updated the semantics to match the Mac attachment brokering semantics, which are much more precise. This fixes a HANDLE leak. BUG=493414 Review URL: https://codereview.chromium.org/1494313002 Cr-Commit-Position: refs/heads/master@{#363296}
* ipc: Refactor some attachment broker classes.erikchen2015-09-241-0/+19
| | | | | | | | | | | | | | This CL makes the members of BrokerableAttachment::AttachmentId and HandleWin::WireFormat private, and makes getters for the members. This CL also makes the default constructor of BrokerableAttachment::AttachmentId not generate a random nonce, since the default constructor is invoked frequently by the IPC translation system when it doesn't require a random nonce. BUG=493414 Review URL: https://codereview.chromium.org/1357723003 Cr-Commit-Position: refs/heads/master@{#350399}
* ipc: Make a new class PlaceholderBrokerableAttachment.erikchen2015-09-151-1/+0
| | | | | | | | | | | | | Instances of this class need to be replaced before the message can be dispatched. This mechanism is a lot cleaner than the previous mechanism, which had an "unbrokered" state for every type of BrokerableAttachment, which had to be mutated before being dispatched. BUG=493414 Review URL: https://codereview.chromium.org/1317093007 Cr-Commit-Position: refs/heads/master@{#348952}
* Revert of IPC: Add attachment brokering support to the message header. ↵erikchen2015-08-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (patchset #3 id:40001 of https://codereview.chromium.org/1303103002/ ) Reason for revert: Reverting on suspicion of causing crashes in Canary. https://code.google.com/p/chromium/issues/detail?id=524032 Original issue's description: > Reland #1: IPC: Add attachment brokering support to the message header. > > This reland fixes a race condition in the unit test SendHandleTwice that caused > the test to flakily fail, mostly on XP machines. This reland also updates switch > statements to contain a block for the newly added enum > BrokerableAttachment::PLACEHOLDER, which was causing problems with the clang > Windows build. > > > 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 > > TBR=tsepez@chromium.org > BUG=493414 > > Committed: https://crrev.com/37a2e0b682555bf35852d707dbd74b68f345841f > Cr-Commit-Position: refs/heads/master@{#344933} TBR= NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=493414 Review URL: https://codereview.chromium.org/1312433009 Cr-Commit-Position: refs/heads/master@{#345960}
* Reland #1: IPC: Add attachment brokering support to the message header.erikchen2015-08-221-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This reland fixes a race condition in the unit test SendHandleTwice that caused the test to flakily fail, mostly on XP machines. This reland also updates switch statements to contain a block for the newly added enum BrokerableAttachment::PLACEHOLDER, which was causing problems with the clang Windows build. > 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 TBR=tsepez@chromium.org BUG=493414 Review URL: https://codereview.chromium.org/1303103002 Cr-Commit-Position: refs/heads/master@{#344933}
* Revert of IPC: Add attachment brokering support to the message header. ↵ricea2015-08-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (patchset #20 id:420001 of https://codereview.chromium.org/1286253002/ ) Reason for revert: Suspected of breaking XP Tests. See, for example https://build.chromium.org/p/chromium.win/builders/XP%20Tests%20%281%29/builds/39586 . Original issue's description: > 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 > > Committed: https://crrev.com/e8e4f4fa67ee9db6c2910020ef49318e5df68481 > Cr-Commit-Position: refs/heads/master@{#344389} TBR=tsepez@chromium.org,thakis@chromium.org,erikchen@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=493414 Review URL: https://codereview.chromium.org/1286883003 Cr-Commit-Position: refs/heads/master@{#344461}
* IPC: Add attachment brokering support to the message header.erikchen2015-08-201-1/+0
| | | | | | | | | | | | | | | | | | | 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}
* ipc: Add the class HandleWin.erikchen2015-08-111-1/+5
| | | | | | | | | | | | HandleWin is a wrapper around a Windows HANDLE that can be transported across IPC channels that support attachment brokering. The attachment broker is responsible for duplicating the HANDLE into the destination process. BUG=493414 Review URL: https://codereview.chromium.org/1281083004 Cr-Commit-Position: refs/heads/master@{#342897}
* ipc: Add attachment broker code for the privileged browser process.erikchen2015-07-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | No intended behavior change. This CL adds the class AttachmentBrokerPrivilegedWin, a subclass of AttachmentBroker intended for use in the privileged browser process on the Windows platform. No brokerable attachments are made outside of tests, so this code is not yet active. This CL consists of several changes: - The class AttachmentBrokerPrivilegedWin was created. - Common logic between AttachmentBrokerPrivilegedWin and AttachmentBrokerWin was moved to AttachmentBroker. - ChannelWin was given a new member prelim_queue_. This queue is normally empty, but in some circumstances messages are queued here before being processed for delivery. See the documentation for a full explanation. BUG=466437 Review URL: https://codereview.chromium.org/1246103006 Cr-Commit-Position: refs/heads/master@{#340548}
* Update ChannelReader to use AttachmentBroker.erikchen2015-07-271-0/+2
| | | | | | | | | | | | | | | | Previously, translating from bytes into messages and dispatching the messages was accomplished in a single step. I've split this into two steps. The function TranslateInputData turns bytes into messages, and puts those messages in a queue. The function DispatchMessages() dispatches messages from the queue. Messages cannot be dispatched until all attachments have been brokered, so DispatchMessages() will sometimes wait (asynchronously) for the attachments to get brokered. BUG=466437 Review URL: https://codereview.chromium.org/1206093002 Cr-Commit-Position: refs/heads/master@{#340509}
* Make attachment broker a subclass of IPC::Listener.erikchen2015-07-151-1/+4
| | | | | | | | | | In addition, hook up the IPC::Listener functionality in non-broker proceses. BUG=466437 Review URL: https://codereview.chromium.org/1205713002 Cr-Commit-Position: refs/heads/master@{#338798}
* Stub in more IPC attachment brokering functionality.erikchen2015-07-071-1/+26
| | | | | | | | | | | | | | | | | | | This CL fills in most of the logic for sending a Windows HANDLE from a non-broker process to the broker process. This consists of several small changes: - Create the new IPC messages AttachmentBrokerMsg_WinHandleHasBeenBrokered and AttachmentBrokerMsg_RequestBrokerageOfWinHandle. - Add a sender_ member variable to AttachmentBrokerWin. - Define the wire format for HandleAttachmentWin. - Add logic to ChannelWin to send AttachmentBrokerMsg_RequestBrokerageOfWinHandle for each HANDLE attachment. BUG=466437 Review URL: https://codereview.chromium.org/1188923003 Cr-Commit-Position: refs/heads/master@{#337689}
* IPC: Add new classes required for attachment brokering.erikchen2015-06-161-0/+24
The implementations of these classes are just stubs. BUG=493414 Review URL: https://codereview.chromium.org/1180313007 Cr-Commit-Position: refs/heads/master@{#334676}