summaryrefslogtreecommitdiffstats
path: root/ipc/attachment_broker_privileged_win_unittest.cc
Commit message (Collapse)AuthorAgeFilesLines
* Add support for Attachment Brokering of IPC::Channels on multiple threads.erikchen2016-03-211-1/+1
| | | | | | | | | | | | Attachment brokering makes the assumption that there's a single thread on which IO related to IPC::Channels occurs. This assumption is violated when the flag --single-process is set. BUG=590213 Review URL: https://codereview.chromium.org/1739203004 Cr-Commit-Position: refs/heads/master@{#382431}
* Replace base::Tuple in //ipc with std::tupletzik2016-03-081-4/+6
| | | | | | | | BUG=554987 Review URL: https://codereview.chromium.org/1770013002 Cr-Commit-Position: refs/heads/master@{#379759}
* Clean up public interface of AttachmentBrokerUnprivileged.erikchen2016-02-171-1/+1
| | | | | | | | | | | | | | | | | In the old interface, a static factory method returns a scoped_ptr, and the caller had to manage the lifetime. Since this is a global object with minimal memory footprint, and is required to outlive every IPC::Channel, it's much easier for the global to never be destroyed. This also matches the interface for AttachmentBrokerPrivileged. BUG=584297 Committed: https://crrev.com/11fea2242b3a197993dbd5a1f977f9a31c6b98e4 Cr-Commit-Position: refs/heads/master@{#375674} Review URL: https://codereview.chromium.org/1679763002 Cr-Commit-Position: refs/heads/master@{#375776}
* Revert of Clean up public interface of AttachmentBrokerUnprivileged. ↵erikchen2016-02-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (patchset #6 id:120001 of https://codereview.chromium.org/1679763002/ ) Reason for revert: failures on Chromium Memory FYI: http://build.chromium.org/p/chromium.memory.fyi/ Failure notification for "memory test: remoting" on "Chromium Mac (valgrind)(2)". Please see if the failures are related to your commit and take appropriate actions (e.g. revert, update suppressions, notify sheriff, etc.). For more info on the memory waterfall please see these links: http://dev.chromium.org/developers/tree-sheriffs/sheriff-details-chromium/memory-sheriff http://dev.chromium.org/developers/how-tos/using-valgrind http://dev.chromium.org/developers/how-tos/using-valgrind/threadsanitizer By the way, the current memory sheriff is on the CC list. http://build.chromium.org/p/chromium.memory.fyi/builders/Chromium%20Mac%20%28valgrind%29%282%29/builds/37788 Original issue's description: > Clean up public interface of AttachmentBrokerUnprivileged. > > In the old interface, a static factory method returns a scoped_ptr, and the > caller had to manage the lifetime. Since this is a global object with minimal > memory footprint, and is required to outlive every IPC::Channel, it's much > easier for the global to never be destroyed. This also matches the interface for > AttachmentBrokerPrivileged. > > BUG=584297 > > Committed: https://crrev.com/11fea2242b3a197993dbd5a1f977f9a31c6b98e4 > Cr-Commit-Position: refs/heads/master@{#375674} TBR=tsepez@chromium.org,avi@chromium.org,mseaborn@chromium.org,sergeyu@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=584297 Review URL: https://codereview.chromium.org/1704743002 Cr-Commit-Position: refs/heads/master@{#375739}
* Clean up public interface of AttachmentBrokerUnprivileged.erikchen2016-02-161-1/+1
| | | | | | | | | | | | | | In the old interface, a static factory method returns a scoped_ptr, and the caller had to manage the lifetime. Since this is a global object with minimal memory footprint, and is required to outlive every IPC::Channel, it's much easier for the global to never be destroyed. This also matches the interface for AttachmentBrokerPrivileged. BUG=584297 Review URL: https://codereview.chromium.org/1679763002 Cr-Commit-Position: refs/heads/master@{#375674}
* Enable attachment brokering of SharedMemoryHandle on Windows.erikchen2016-02-031-1/+1
| | | | | | | | | | | | | | | | | Whenever a SharedMemoryHandle associated with the current process is passed as a parameter to a Chrome IPC message, the object is automatically brokered into the destination process. This means it is no longer necessary to have a constructor of SharedMemoryHandle that takes a ProcessHandle, since the SharedMemoryHandle is always associated with the current process. BUG=493414 Committed: https://crrev.com/7ceb8901740c35cd8ebfb92739efaf2ee441391e Cr-Commit-Position: refs/heads/master@{#370193} Review URL: https://codereview.chromium.org/1588683003 Cr-Commit-Position: refs/heads/master@{#373174}
* Revert of Enable attachment brokering of SharedMemoryHandle on Windows. ↵erikchen2016-01-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (patchset #4 id:60001 of https://codereview.chromium.org/1588683003/ ) Reason for revert: Causing Dr.Memory errors. https://code.google.com/p/chromium/issues/detail?id=580636 Original issue's description: > Enable attachment brokering of SharedMemoryHandle on Windows. > > Whenever a SharedMemoryHandle associated with the current process is passed as a > parameter to a Chrome IPC message, the object is automatically brokered into the > destination process. This means it is no longer necessary to have a constructor > of SharedMemoryHandle that takes a ProcessHandle, since the SharedMemoryHandle > is always associated with the current process. > > BUG=493414 > > Committed: https://crrev.com/7ceb8901740c35cd8ebfb92739efaf2ee441391e > Cr-Commit-Position: refs/heads/master@{#370193} TBR=mark@chromium.org,tsepez@chromium.org,thestig@chromium.org,avi@chromium.org,sergeyu@chromium.org # Not skipping CQ checks because original CL landed more than 1 days ago. BUG=493414 Review URL: https://codereview.chromium.org/1645273003 Cr-Commit-Position: refs/heads/master@{#372481}
* Enable attachment brokering of SharedMemoryHandle on Windows.erikchen2016-01-191-1/+1
| | | | | | | | | | | | | | Whenever a SharedMemoryHandle associated with the current process is passed as a parameter to a Chrome IPC message, the object is automatically brokered into the destination process. This means it is no longer necessary to have a constructor of SharedMemoryHandle that takes a ProcessHandle, since the SharedMemoryHandle is always associated with the current process. BUG=493414 Review URL: https://codereview.chromium.org/1588683003 Cr-Commit-Position: refs/heads/master@{#370193}
* Fix Win Clang -Wpessimizing-move errorHans Wennborg2016-01-081-1/+1
| | | | | | | | | | | | | | | | The build was failing with: ..\..\ipc\attachment_broker_privileged_win_unittest.cc(105,10) : error: moving a local object in a return statement prevents copy elision [-Werror,-Wpessimizing-move] return std::move(shared_memory); ^ BUG=82385 TBR=erikchen Review URL: https://codereview.chromium.org/1575433002 . Cr-Commit-Position: refs/heads/master@{#368328}
* ipc: Implement attachment brokering for SharedMemoryHandle on Windows.erikchen2016-01-081-32/+102
| | | | | | | | | | | | | | | | | | 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-6/+26
| | | | | | | | | | | 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: Reenable Windows attachment brokering tests.erikchen2015-12-041-5/+5
| | | | | | | | | | Add a missing lock acquisition to AttachmentBrokerPrivilegedWin. BUG=560482 Review URL: https://codereview.chromium.org/1500463002 Cr-Commit-Position: refs/heads/master@{#363235}
* ipc: AttachmentBroker dispatches notifications onto an appropriate thread.erikchen2015-11-061-1/+1
| | | | | | | | | | | | | | Previously, there were no guarantees about the thread on which an observer of AttachmentBroker would receive its notifications. Now, the observer is guaranteed to get a notification on the same thread in which it registered itself as an observer. This also makes notification of observers asynchronous, which avoids issues related to re-entrant functions. BUG=550938 Review URL: https://codereview.chromium.org/1413893005 Cr-Commit-Position: refs/heads/master@{#358392}
* IPC: Remove unnecessary conversions of BrokerableAttachment.erikchen2015-10-291-2/+3
| | | | | | | | | | | | | | BrokerableAttachments are typically stored and passed around in a scoped_refptr. There were several locations where they were being unnecessarily converted to a raw pointer. This was probably responsible for a non-deterministic crash on GPU bots (https://code.google.com/p/chromium/issues/detail?id=535711#c28), although I haven't been able to reproduce the problem locally. BUG=535711 Review URL: https://codereview.chromium.org/1414503009 Cr-Commit-Position: refs/heads/master@{#356968}
* ipc: Write end-to-end tests for SharedMemoryHandle brokering on Mac.erikchen2015-10-121-1/+0
| | | | | | | | BUG=535711 Review URL: https://codereview.chromium.org/1397023002 Cr-Commit-Position: refs/heads/master@{#353628}
* ipc: Update MachPortMac ownership semantics.erikchen2015-10-071-1/+1
| | | | | | | | | | | | | | | This CL consists of a small refactor, a small change in ownership semantics, and a lot of documentation. The refactor removes a |const| qualifier from brokerable message attachments that are passed to the attachment broker. This allows for an improvement to ownership semantics for MachPortMac. BUG=535711 Review URL: https://codereview.chromium.org/1385143002 Cr-Commit-Position: refs/heads/master@{#352938}
* ipc: Make factory methods for attachment brokers.erikchen2015-10-071-2/+0
| | | | | | | | | | This is a refactor with no intended functional effects. BUG=535711 Review URL: https://codereview.chromium.org/1382303003 Cr-Commit-Position: refs/heads/master@{#352735}
* ipc: Extend attachment broker unit tests.erikchen2015-09-251-62/+193
| | | | | | | | | | | | Previously, attachment broker unit tests didn't test the full functionality of the receiving side of an IPC channel. This CL adds several new tests, and also extends the functionality being tested. BUG=493414 Review URL: https://codereview.chromium.org/1320233002 Cr-Commit-Position: refs/heads/master@{#350871}
* ipc: Remove unnecessary attachment broker plumbing.erikchen2015-09-241-1/+1
| | | | | | | | | | | | The original design was to pass around an instance of an attachment broker. The new design uses a single global, and no longer needs any plumbing. This CL removes the last vestiges of the plumbing. BUG=493414 Review URL: https://codereview.chromium.org/1354973006 Cr-Commit-Position: refs/heads/master@{#350471}
* ipc: Use a global for the process's attachment broker.erikchen2015-09-141-1/+2
| | | | | | | | | | | This eliminates the need for a lot of plumbing, at the expense of yet another global. BUG=493414 Review URL: https://codereview.chromium.org/1292263003 Cr-Commit-Position: refs/heads/master@{#348649}
* ipc: Temporarily disable attachment broker end-to-end tests.erikchen2015-09-041-4/+5
| | | | | | | | | | | | | | They will be re-enabled (and extended) after several major changes are made to attachment brokering. This CL is already written, but can't be landed because the changes themselves are not yet landed. https://codereview.chromium.org/1320233002/ BUG=493414 Review URL: https://codereview.chromium.org/1317753006 Cr-Commit-Position: refs/heads/master@{#347309}
* Revert of IPC: Add attachment brokering support to the message header. ↵erikchen2015-08-271-192/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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-63/+192
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-154/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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-59/+154
| | | | | | | | | | | | | | | | | | | 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/+30
| | | | | | | | | | | | 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: Make a common subclass for Channel and ProxyChannel.erikchen2015-08-101-1/+1
| | | | | | | | | | | Channel and ProxyChannel share some functionality which the attachment broker code uses. I made a new, shared superclass called Endpoint. BUG=493414 Review URL: https://codereview.chromium.org/1270683002 Cr-Commit-Position: refs/heads/master@{#342669}
* Reland #1: Clean up interface of attachment broker.erikchen2015-07-301-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | I forgot to initialize a member variable, which is why the original CL flakily succeeded (and managed to pass the CQ). Original issue's description: > ipc: Clean up interface of attachment broker. > > AttachmentBrokerUnprivileged now has a method > DesignateBrokerCommunicationChannel which is used by non-broker processes to > designate an IPC::Channel as the communication medium for brokerable attachment > messages. IPC::Channel has a new member attachment_broker_endpoint_ which causes > it to pass all messages through the attachment broker before forwarding them to > the listener. > > BUG=493414 > > Committed: https://crrev.com/9a06836982214f2edced21bbd1615b49e7f231bf > Cr-Commit-Position: refs/heads/master@{#341143} BUG=493414 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1258323004 Cr-Commit-Position: refs/heads/master@{#341207}
* Revert of ipc: Clean up interface of attachment broker. (patchset #5 ↵avi2015-07-301-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | id:80001 of https://codereview.chromium.org/1269553003/) Reason for revert: Causes failures in: IPCAttachmentBrokerPrivilegedWinTest.SendHandle IPCAttachmentBrokerPrivilegedWinTest.SendHandleToSelf IPCAttachmentBrokerPrivilegedWinTest.SendHandleWithoutPermissions on the Win7 Tests (dbg)(1) bot http://build.chromium.org/p/chromium.win/builders/Win7%20Tests%20%28dbg%29%281%29/builds/40372/steps/ipc_tests/logs/stdio Original issue's description: > ipc: Clean up interface of attachment broker. > > AttachmentBrokerUnprivileged now has a method > DesignateBrokerCommunicationChannel which is used by non-broker processes to > designate an IPC::Channel as the communication medium for brokerable attachment > messages. IPC::Channel has a new member attachment_broker_endpoint_ which causes > it to pass all messages through the attachment broker before forwarding them to > the listener. > > BUG=493414 > > Committed: https://crrev.com/9a06836982214f2edced21bbd1615b49e7f231bf > Cr-Commit-Position: refs/heads/master@{#341143} TBR=tsepez@chromium.org,erikchen@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=493414 Review URL: https://codereview.chromium.org/1259953005 Cr-Commit-Position: refs/heads/master@{#341171}
* ipc: Clean up interface of attachment broker.erikchen2015-07-301-1/+4
| | | | | | | | | | | | | | | AttachmentBrokerUnprivileged now has a method DesignateBrokerCommunicationChannel which is used by non-broker processes to designate an IPC::Channel as the communication medium for brokerable attachment messages. IPC::Channel has a new member attachment_broker_endpoint_ which causes it to pass all messages through the attachment broker before forwarding them to the listener. BUG=493414 Review URL: https://codereview.chromium.org/1269553003 Cr-Commit-Position: refs/heads/master@{#341143}
* ipc: Create AttachmentBrokerPrivileged and AttachmentBrokerUnprivileged.erikchen2015-07-281-7/+9
| | | | | | | | | | | | | | | | This CL is a refactor and contains no behavior changes. AttachmentBroker is an abstract base class. I made two new abstract subclasses, AttachmentBrokerPrivileged and AttachmentBrokerUnprivileged for use in privileged and unprivileged processes respectively. These in turn are inherited by AttachmentBrokerPrivilegedWin and AttachmentBrokerUnprivilegedWin. BUG=493414 TBR=avi@chromium.org Review URL: https://codereview.chromium.org/1256993003 Cr-Commit-Position: refs/heads/master@{#340803}
* ipc: Add attachment broker code for the privileged browser process.erikchen2015-07-271-0/+397
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}