gecko-dev/ipc/mscom
Aaron Klotz b836337e81 Bug 1303060: Changes to a11y to enable the serving of a COM handler; r=tbsaunde
MozReview-Commit-ID: GTQF3x1pBtX

A general outline of the COM handler (a.k.a. the "smart proxy"):

COM handlers are pieces of code that are loaded by the COM runtime along with
a proxy and are layered above that proxy. This enables the COM handler to
interpose itself between the caller and the proxy, thus providing the
opportunity for the handler to manipulate an interface's method calls before
those calls reach the proxy.

Handlers are regular COM components that live in DLLs and are declared in the
Windows registry. In order to allow for the specifying of a handler (and an
optional payload to be sent with the proxy), the mscom library allows its
clients to specify an implementation of the IHandlerProvider interface.

IHandlerProvider consists of 5 functions:

* GetHandler returns the CLSID of the component that should be loaded into
  the COM client's process. If GetHandler returns a failure code, then no
  handler is loaded.
* GetHandlerPayloadSize and WriteHandlerPayload are for obtaining the payload
  data. These calls are made on a background thread but need to do their work
  on the main thread. We declare the payload struct in IDL. MIDL generates two
  functions, IA2Payload_Encode and IA2Payload_Decode, which are used by
  mscom::StructToStream to read and write that struct to and from buffers.
* The a11y payload struct also includes an interface, IGeckoBackChannel, that
  allows the handler to communicate directly with Gecko. IGeckoBackChannel
  currently provides two methods: one to allow the handler to request fresh
  cache information, and the other to provide Gecko with its IHandlerControl
  interface.
* MarshalAs accepts an IID that specifies the interface that is about to be
  proxied. We may want to send a more sophisticated proxy than the one that
  is requested. The desired IID is returned by this function. In the case of
  a11y interfaces, we should always return IAccessible2_3 if we are asked for
  one of its parent interfaces. This allows us to eliminate round trips to
  resolve more sophisticated interfaces later on.
* NewInstance, which is needed to ensure that all descendent proxies are also
  imbued with the same handler code.

The main focus of this patch is as follows:

1. Provide an implementation of the IHandlerProvider interface;
2. Populate the handler payload (ie, the cache) with data;
3. Modify CreateHolderFromAccessible to specify the HandlerPayload object;
4. Receive the IHandlerControl interface from the handler DLL and move it
   into the chrome process.

Some more information about IHandlerControl:

There is one IHandlerControl per handler DLL instance. It is the interface that
we call in Gecko when we need to dispatch an event to the handler. In order to
ensure that events are dispatched in the correct order, we need to dispatch
those events from the chrome main thread so that they occur in sequential order
with calls to NotifyWinEvent.

--HG--
extra : rebase_source : acb44dead7cc5488424720e1bf58862b7b30374f
2017-04-04 15:23:55 -06:00
..
oop Bug 1303060: Simplifications to mscom handler code; r=jimm 2017-03-27 18:41:06 -06:00
ActivationContext.cpp Bug 1310841: Make mscom registration use CoGetClassObject so that COM will retain a reference to the proxy dll; r=jimm 2016-10-25 15:04:47 -06:00
ActivationContext.h Bug 1331687: Overload mscom::RegisterProxy to allow proxy registration from within xul.dll itself; r=jimm 2017-01-17 13:19:40 -07:00
Aggregation.h Bug 1303060: ipc/mscom changes for handler and payload support; r=jimm 2017-02-17 17:30:03 -07:00
AgileReference.cpp Bug 1338596: Add support for agile references to mscom; r=jimm 2017-02-10 11:18:26 -07:00
AgileReference.h Bug 1338596: Add support for agile references to mscom; r=jimm 2017-02-10 11:18:26 -07:00
AsyncInvoker.h Bug 1344798: Allow mscom::AsyncInvoker to be able to handle proxied and non-proxied interfaces; r=jimm 2017-03-02 17:39:01 -07:00
COMApartmentRegion.h Bug 1277075: Add MainThreadRuntime class to mscom glue, enabling safe initialization of COM security and exception handlers; r=jimm 2016-07-20 11:10:46 -06:00
COMPtrHolder.h Bug 1325834: Make mscom::ProxyStream use CreateStreamOnHGlobal instead of SHCreateMemStream on Windows 7; r=jimm 2017-03-14 18:42:24 -06:00
DispatchForwarder.cpp Bug 1322460 - Don't addref/release on the return value of prohibited functions. r=aklotz,Ehsan 2016-12-14 14:34:26 +08:00
DispatchForwarder.h Bug 1298462 - tidy ipc/mscom/ files to avoid warnings from clang-cl; r=aklotz 2016-08-26 14:26:29 -04:00
DynamicallyLinkedFunctionPtr.h Bug 1338596: Add support for agile references to mscom; r=jimm 2017-02-10 11:18:26 -07:00
EnsureMTA.cpp Bug 1299384 - Use MOZ_MUST_USE with NS_warn_if_impl(). r=erahm. 2016-09-02 17:12:24 +10:00
EnsureMTA.h Bug 1322465 part 6 - Use explicit/MOZ_IMPLICIT for the unary constructors in ipc/. r=aklotz,Ehsan 2016-12-16 15:56:04 +08:00
IHandlerProvider.h Bug 1303060: Changes to a11y to enable the serving of a COM handler; r=tbsaunde 2017-04-04 15:23:55 -06:00
Interceptor.cpp Bug 1303060: Changes to a11y to enable the serving of a COM handler; r=tbsaunde 2017-04-04 15:23:55 -06:00
Interceptor.h Bug 1303060: Simplifications to mscom handler code; r=jimm 2017-03-27 18:41:06 -06:00
InterceptorLog.cpp Bug 1346910: Ensure that the interface output by IServiceProvider::QueryService is correctly wrapped by the mscom interceptor; r=jimm 2017-03-14 11:04:46 -06:00
InterceptorLog.h Bug 1287875: Adds a logging facility for intercepted COM traffic; r=jimm 2016-07-14 17:11:33 -06:00
MainThreadHandoff.cpp Bug 1303060: Changes to a11y to enable the serving of a COM handler; r=tbsaunde 2017-04-04 15:23:55 -06:00
MainThreadHandoff.h Bug 1303060: Changes to a11y to enable the serving of a COM handler; r=tbsaunde 2017-04-04 15:23:55 -06:00
MainThreadInvoker.cpp Bug 1339945: Refactor mscom::MainThreadInvoker's wait mechanism into a separate class; r=handyman 2017-02-10 11:27:01 -07:00
MainThreadInvoker.h Bug 1344965: Clean up mscom interfaces to improve separation of concerns; r=jimm 2017-03-06 17:22:43 -07:00
MainThreadRuntime.cpp Bug 1335235: Add disabling of the COM BSTR cache to mscom::MainThreadRuntime; r=jimm 2017-01-30 16:39:08 -07:00
MainThreadRuntime.h Bug 1277075: Add MainThreadRuntime class to mscom glue, enabling safe initialization of COM security and exception handlers; r=jimm 2016-07-20 11:10:46 -06:00
ProxyStream.cpp Bug 1325834: Make mscom::ProxyStream use CreateStreamOnHGlobal instead of SHCreateMemStream on Windows 7; r=jimm 2017-03-14 18:42:24 -06:00
ProxyStream.h Bug 1325834: Make mscom::ProxyStream use CreateStreamOnHGlobal instead of SHCreateMemStream on Windows 7; r=jimm 2017-03-14 18:42:24 -06:00
Ptr.h Bug 1303060: Simplifications to mscom handler code; r=jimm 2017-03-27 18:41:06 -06:00
Registration.cpp Bug 1303060: ipc/mscom changes for handler and payload support; r=jimm 2017-02-17 17:30:03 -07:00
Registration.h Bug 1303060: ipc/mscom changes for handler and payload support; r=jimm 2017-02-17 17:30:03 -07:00
SpinEvent.cpp Bug 1350688 - Use a thread safe way to get the CPU count in the SpinEvent ctor. r=aklotz 2017-03-26 06:56:01 -07:00
SpinEvent.h Bug 1339945: Refactor mscom::MainThreadInvoker's wait mechanism into a separate class; r=handyman 2017-02-10 11:27:01 -07:00
StructStream.cpp Bug 1338609: Add the ability to serialize and deserialize structs using Microsoft RPC to mscom; r=jimm 2017-02-17 14:26:56 -07:00
StructStream.h Bug 1338609: Add the ability to serialize and deserialize structs using Microsoft RPC to mscom; r=jimm 2017-02-17 14:26:56 -07:00
Utils.cpp Bug 1346910: Ensure that the interface output by IServiceProvider::QueryService is correctly wrapped by the mscom interceptor; r=jimm 2017-03-14 11:04:46 -06:00
Utils.h Bug 1346910: Ensure that the interface output by IServiceProvider::QueryService is correctly wrapped by the mscom interceptor; r=jimm 2017-03-14 11:04:46 -06:00
WeakRef.cpp Bug 1336510 - Part 10: Remove unnecessary assertion from SharedRef::Clear(), r=aklotz 2017-02-24 14:34:32 -05:00
WeakRef.h Bug 1342992: Make mscom::Weakref final; r=jimm 2017-02-27 11:44:45 -07:00
moz.build Bug 1303060: Simplifications to mscom handler code; r=jimm 2017-03-27 18:41:06 -06:00