mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-06 00:10:25 +00:00
Bug 1637474 part 1: Provide a way to associate COM objects with an AccessibleWrap so they will be disconnected from remote clients when the Accessible shuts down. r=MarcoZ
To improve performance for cross-process COM, we disable COM garbage collection in content processes for calls from our parent process. However, this means we don't receive Release calls from in-process a11y clients. For an Accessible, we get around this by explicitly disconnecting remote clients when the Accessible shuts down. This doesn't cover COM objects which aren't interfaces of an Accessible; i.e. where the object has a different IUnknown to the Accessible. This patch adds AccessibleWrap::AssociateCOMObjectForDisconnection to allow these objects to be tracked. Tracked objects are then disconnected when the Accessible shuts down. Differential Revision: https://phabricator.services.mozilla.com/D74999
This commit is contained in:
parent
9f074fab9b
commit
ca670d92d5
@ -114,6 +114,10 @@ void AccessibleWrap::Shutdown() {
|
||||
// bug 1440267 is fixed.
|
||||
unk = static_cast<IAccessibleHyperlink*>(this);
|
||||
mscom::Interceptor::DisconnectRemotesForTarget(unk);
|
||||
for (auto& assocUnk : mAssociatedCOMObjectsForDisconnection) {
|
||||
mscom::Interceptor::DisconnectRemotesForTarget(assocUnk);
|
||||
}
|
||||
mAssociatedCOMObjectsForDisconnection.Clear();
|
||||
}
|
||||
|
||||
Accessible::Shutdown();
|
||||
|
@ -173,6 +173,20 @@ class AccessibleWrap : public Accessible,
|
||||
static void UpdateSystemCaretFor(ProxyAccessible* aProxy,
|
||||
const LayoutDeviceIntRect& aCaretRect);
|
||||
|
||||
/**
|
||||
* Associate a COM object with this Accessible so it will be disconnected
|
||||
* from remote clients when this Accessible shuts down.
|
||||
* This should only be called with separate COM objects with a different
|
||||
* IUnknown to this AccessibleWrap; e.g. IAccessibleRelation.
|
||||
*/
|
||||
void AssociateCOMObjectForDisconnection(IUnknown* aObject) {
|
||||
// We only need to track these for content processes because COM garbage
|
||||
// collection is disabled there.
|
||||
if (XRE_IsContentProcess()) {
|
||||
mAssociatedCOMObjectsForDisconnection.AppendElement(aObject);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
static void UpdateSystemCaretFor(HWND aCaretWnd,
|
||||
const LayoutDeviceIntRect& aCaretRect);
|
||||
@ -289,6 +303,8 @@ class AccessibleWrap : public Accessible,
|
||||
};
|
||||
|
||||
static StaticAutoPtr<nsTArray<HandlerControllerData>> sHandlerControllers;
|
||||
|
||||
nsTArray<RefPtr<IUnknown>> mAssociatedCOMObjectsForDisconnection;
|
||||
};
|
||||
|
||||
static inline AccessibleWrap* WrapperFor(const ProxyAccessible* aProxy) {
|
||||
|
Loading…
Reference in New Issue
Block a user