Граф коммитов

23 Коммитов

Автор SHA1 Сообщение Дата
James Teh 2dcfeebd6f Bug 1627084 part 2: mscom: Provide access to the HandlerProvider from the Interceptor. r=aklotz
Because MainThreadHandoff sits between the Interceptor and the HandlerProvider, the caller must:

1. Get the event sink (the IInterceptorSink) from the Interceptor using IInterceptor::GetEventSink.
2. QI to the new IMainThreadHandoff interface. (An IInterceptorSink might not necessarily be a MainThreadHandoff.)
3. Get the HandlerProvider from the MainThreadHandoff using IMainThreadHandoff::GetHandlerProvider.

Differential Revision: https://phabricator.services.mozilla.com/D69484
2020-04-24 20:25:21 +00:00
James Teh 132a49a8a1 Bug 1626802 part 1: mscom: Provide a way for Interceptors to avoid unnecessary cross-thread QueryInterface calls. r=aklotz
When marshaling a11y calls from the content process, there are quite a lot of cross-thread QueryInterface calls (ipc::mscom::Interceptor::QueryInterfaceTarget).
Some of these are for special COM interfaces like IAgileObject and IFastRundown, which we could just special case in Interceptor::QueryInterface like we do for INoMarshal.
However, it seems there are a lot of other interfaces being queried and it's not clear why.
This patch adds a new HandlerProvider method: IsInterfaceMaybeSupported.
This allows implementations to indicate when there are interfaces which they definitely don't support, allowing the call to be answered without a cross-thread call.

Differential Revision: https://phabricator.services.mozilla.com/D69285

--HG--
extra : moz-landing-system : lando
2020-04-01 23:30:21 +00:00
Emilio Cobos Álvarez 256c124f94 Bug 1609996 - Reorder some includes affected by the previous patches. r=froydnj
This was done by:

This was done by applying:

```
diff --git a/python/mozbuild/mozbuild/code-analysis/mach_commands.py b/python/mozbuild/mozbuild/code-analysis/mach_commands.py
index 789affde7bbf..fe33c4c7d4d1 100644
--- a/python/mozbuild/mozbuild/code-analysis/mach_commands.py
+++ b/python/mozbuild/mozbuild/code-analysis/mach_commands.py
@@ -2007,7 +2007,7 @@ class StaticAnalysis(MachCommandBase):
         from subprocess import Popen, PIPE, check_output, CalledProcessError

         diff_process = Popen(self._get_clang_format_diff_command(commit), stdout=PIPE)
-        args = [sys.executable, clang_format_diff, "-p1", "-binary=%s" % clang_format]
+        args = [sys.executable, clang_format_diff, "-p1", "-binary=%s" % clang_format, '-sort-includes']

         if not output_file:
             args.append("-i")
```

Then running `./mach clang-format -c <commit-hash>`

Then undoing that patch.

Then running check_spidermonkey_style.py --fixup

Then running `./mach clang-format`

I had to fix four things:

 * I needed to move <utility> back down in GuardObjects.h because I was hitting
   obscure problems with our system include wrappers like this:

0:03.94 /usr/include/stdlib.h:550:14: error: exception specification in declaration does not match previous declaration
0:03.94 extern void *realloc (void *__ptr, size_t __size)
0:03.94              ^
0:03.94 /home/emilio/src/moz/gecko-2/obj-debug/dist/include/malloc_decls.h:53:1: note: previous declaration is here
0:03.94 MALLOC_DECL(realloc, void*, void*, size_t)
0:03.94 ^
0:03.94 /home/emilio/src/moz/gecko-2/obj-debug/dist/include/mozilla/mozalloc.h:22:32: note: expanded from macro 'MALLOC_DECL'
0:03.94     MOZ_MEMORY_API return_type name##_impl(__VA_ARGS__);
0:03.94                                ^
0:03.94 <scratch space>:178:1: note: expanded from here
0:03.94 realloc_impl
0:03.94 ^
0:03.94 /home/emilio/src/moz/gecko-2/obj-debug/dist/include/mozmemory_wrap.h:142:41: note: expanded from macro 'realloc_impl'
0:03.94 #define realloc_impl mozmem_malloc_impl(realloc)

   Which I really didn't feel like digging into.

 * I had to restore the order of TrustOverrideUtils.h and related files in nss
   because the .inc files depend on TrustOverrideUtils.h being included earlier.

 * I had to add a missing include to RollingNumber.h

 * Also had to partially restore include order in JsepSessionImpl.cpp to avoid
   some -WError issues due to some static inline functions being defined in a
   header but not used in the rest of the compilation unit.

Differential Revision: https://phabricator.services.mozilla.com/D60327

--HG--
extra : moz-landing-system : lando
2020-01-20 16:19:48 +00:00
Emilio Cobos Álvarez aa3a695712 Bug 1609996 - Remove mozilla/Move.h. r=froydnj
rg -l 'mozilla/Move.h' | xargs sed -i 's/#include "mozilla\/Move.h"/#include <utility>/g'

Further manual fixups and cleanups to the include order incoming.

Differential Revision: https://phabricator.services.mozilla.com/D60323

--HG--
extra : moz-landing-system : lando
2020-01-20 16:18:20 +00:00
Sylvestre Ledru 265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Emilio Cobos Álvarez fffb25b74f Bug 1465585: Switch from mozilla::Move to std::move. r=froydnj
This was done automatically replacing:

  s/mozilla::Move/std::move/
  s/ Move(/ std::move(/
  s/(Move(/(std::move(/

Removing the 'using mozilla::Move;' lines.

And then with a few manual fixups, see the bug for the split series..

MozReview-Commit-ID: Jxze3adipUh
2018-06-01 10:45:27 +02:00
James Teh a26d4b939e Bug 1434822 part 2: mscom: Add a function to disconnect all remote clients associated with a given target. r=aklotz
Because Interceptors disable COM garbage collection to improve performance, they never receive Release calls from remote clients.
If the object can be shut down while clients still hold a reference, this function can be used to force COM to disconnect all remote connections (using CoDisconnectObject) and thus release the associated references to the Interceptor, its target and any objects associated with the HandlerProvider.
A HandlerProvider::DisconnectHandlerRemotes method also had to be added to allow HandlerProviders to disconnect clients for their own objects.

MozReview-Commit-ID: JaxEkOtrP1M

--HG--
extra : rebase_source : bc7a4ab79458eaaddcef8df74ff4d6f685fbfdce
extra : histedit_source : 087f17f09a0c0e1c8e3b5f6d9690f331c15f0b95
2018-02-19 16:08:57 +10:00
Bogdan Tara 3cadf78110 Backed out changeset 54526e7c7b6c (bug 1434822) for causing 1442523. a=backout 2018-03-02 11:27:35 +02:00
James Teh 6fc08ce5ed Bug 1434822 part 2: mscom: Add a function to disconnect all remote clients associated with a given target. r=aklotz
Because Interceptors disable COM garbage collection to improve performance, they never receive Release calls from remote clients.
If the object can be shut down while clients still hold a reference, this function can be used to force COM to disconnect all remote connections (using CoDisconnectObject) and thus release the associated references to the Interceptor, its target and any objects associated with the HandlerProvider.
A HandlerProvider::DisconnectHandlerRemotes method also had to be added to allow HandlerProviders to disconnect clients for their own objects.

MozReview-Commit-ID: JaxEkOtrP1M

--HG--
extra : rebase_source : 2262af8fc3cb1aec8d9c8fc2762f3d61e188cb37
2018-02-19 16:08:57 +10:00
Aaron Klotz 5a394f86cf Bug 1411439: Pass reference to owning interceptor into HandlerProvider for payload creation; r=Jamie
MozReview-Commit-ID: GUW4DrsJEn

--HG--
extra : amend_source : 755ff37c8bc40de408f8668e9e44ebfd41bd9136
2017-10-24 17:48:51 -06:00
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
Aaron Klotz bf041cb767 Bug 1303060: Simplifications to mscom handler code; r=jimm
MozReview-Commit-ID: 5YEVtL8gw6S

--HG--
rename : ipc/mscom/IHandlerPayload.h => ipc/mscom/IHandlerProvider.h
extra : rebase_source : 167f69b591f55228859f3941903f776208f22067
2017-03-27 18:41:06 -06:00
Aaron Klotz 518de5dc75 Bug 1346910: Ensure that the interface output by IServiceProvider::QueryService is correctly wrapped by the mscom interceptor; r=jimm
MozReview-Commit-ID: 40fF7cS0Mpx

--HG--
extra : rebase_source : 79573a2b845c65164dac35a5ad2b99fe7af13ac7
2017-03-14 11:04:46 -06:00
Aaron Klotz 116698fb6b Bug 1344965: Clean up mscom interfaces to improve separation of concerns; r=jimm
MozReview-Commit-ID: C96y3i8hjWs

--HG--
extra : histedit_source : 8cee3ff07ecd0310ac9648d903328d54588d3dde
2017-03-06 17:22:43 -07:00
Aaron Klotz f3fa5ee8d2 Bug 1303060: ipc/mscom changes for handler and payload support; r=jimm
MozReview-Commit-ID: 13NFW1pgxix

--HG--
extra : rebase_source : 18cc11d4c1dc62bc0ee428608f6cb57e32c4d0af
2017-02-17 17:30:03 -07:00
Phil Ringnalda 68316b419c Backed out 2 changesets (bug 1303060) for Windows static-analysis bustage
CLOSED TREE

Backed out changeset 729a1b8c7e47 (bug 1303060)
Backed out changeset 604605ca738c (bug 1303060)
2017-02-22 21:55:15 -08:00
Aaron Klotz af5bd498da Bug 1303060: ipc/mscom changes for handler and payload support; r=jimm
MozReview-Commit-ID: 13NFW1pgxix

--HG--
extra : rebase_source : 18cc11d4c1dc62bc0ee428608f6cb57e32c4d0af
2017-02-17 17:30:03 -07:00
Nathan Froyd 40d6f37643 Bug 1298462 - tidy ipc/mscom/ files to avoid warnings from clang-cl; r=aklotz
Changing classes to `final` avoids complaints about deleting a class with
virtual functions.  Making destructors private avoids static_asserts from
XPCOM code about refcounted classes with public destructors.

MozReview-Commit-ID: IiPrZln1wvj

--HG--
extra : rebase_source : 5d70eea909e9d8c7f191c465b700b778b7ff564c
2016-08-26 14:26:29 -04:00
Aaron Klotz 63a3869bb8 Bug 1298412: Fix Interceptor construction to use Move semantics for STAUniquePtr instead of pass-by-reference; r=jimm
MozReview-Commit-ID: 8DzeT35Ao4O

--HG--
extra : rebase_source : 14a94903843e54c1c4a4b6c980805ed37d878911
2016-08-26 10:03:17 -06:00
Aaron Klotz bed7a5af8c Bug 1292452: MainThreadHandoff enhancements to support array outparams in IA2; r=jimm
MozReview-Commit-ID: LTxj7fHEoAb

--HG--
extra : histedit_source : cbf34c9dac0acee94f0a8fe6488567530ededd0d
2016-08-08 18:06:51 -06:00
Sebastian Hengst 1ab23ac869 Backed out changeset dd26b9ddef2c (bug 1292452) 2016-08-19 10:02:02 +02:00
Aaron Klotz cf36a3119b Bug 1292452: MainThreadHandoff enhancements to support array outparams in IA2; r=jimm
MozReview-Commit-ID: LTxj7fHEoAb
2016-08-08 18:06:51 -06:00
Aaron Klotz 1e94ab2a1b Bug 1263224: Add ability to wrap a COM method invocation and hand it off to the main thread for execution; r=jimm
MozReview-Commit-ID: EfoH3imaev5

--HG--
extra : rebase_source : d158c737c5ae789ea64bec99ab09b14a92e8c4f3
2016-07-19 13:31:25 -06:00