gecko-dev/ipc/mscom/IHandlerProvider.h
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

43 lines
1.5 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_mscom_IHandlerProvider_h
#define mozilla_mscom_IHandlerProvider_h
#include "mozilla/NotNull.h"
#include "mozilla/mscom/Ptr.h"
#include <objidl.h>
namespace mozilla {
namespace mscom {
struct IInterceptor;
struct HandlerProvider
{
virtual STDMETHODIMP GetHandler(NotNull<CLSID*> aHandlerClsid) = 0;
virtual STDMETHODIMP GetHandlerPayloadSize(NotNull<IInterceptor*> aInterceptor, NotNull<DWORD*> aOutPayloadSize) = 0;
virtual STDMETHODIMP WriteHandlerPayload(NotNull<IInterceptor*> aInterceptor, NotNull<IStream*> aStream) = 0;
virtual STDMETHODIMP_(REFIID) MarshalAs(REFIID aIid) = 0;
virtual STDMETHODIMP DisconnectHandlerRemotes() = 0;
};
struct IHandlerProvider : public IUnknown
, public HandlerProvider
{
virtual STDMETHODIMP_(REFIID) GetEffectiveOutParamIid(REFIID aCallIid,
ULONG aCallMethod) = 0;
virtual STDMETHODIMP NewInstance(REFIID aIid,
InterceptorTargetPtr<IUnknown> aTarget,
NotNull<IHandlerProvider**> aOutNewPayload) = 0;
};
} // namespace mscom
} // namespace mozilla
#endif // mozilla_mscom_IHandlerProvider_h