2016-07-27 20:44:56 +03:00
|
|
|
/* -*- 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/. */
|
|
|
|
|
2017-02-18 03:30:03 +03:00
|
|
|
#ifndef mozilla_mscom_Interceptor_h
|
|
|
|
#define mozilla_mscom_Interceptor_h
|
2016-07-27 20:44:56 +03:00
|
|
|
|
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 19:19:48 +03:00
|
|
|
#include <callobj.h>
|
|
|
|
#include <objidl.h>
|
|
|
|
|
2020-01-20 19:18:20 +03:00
|
|
|
#include <utility>
|
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 19:19:48 +03:00
|
|
|
|
2016-07-27 20:44:56 +03:00
|
|
|
#include "mozilla/Mutex.h"
|
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 19:19:48 +03:00
|
|
|
#include "mozilla/RefPtr.h"
|
2017-03-28 03:41:06 +03:00
|
|
|
#include "mozilla/mscom/IHandlerProvider.h"
|
2016-07-27 20:44:56 +03:00
|
|
|
#include "mozilla/mscom/Ptr.h"
|
|
|
|
#include "mozilla/mscom/WeakRef.h"
|
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 19:19:48 +03:00
|
|
|
#include "nsTArray.h"
|
2016-07-27 20:44:56 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace mscom {
|
2017-06-08 20:52:53 +03:00
|
|
|
namespace detail {
|
|
|
|
|
|
|
|
class LiveSetAutoLock;
|
|
|
|
|
|
|
|
} // namespace detail
|
2016-07-27 20:44:56 +03:00
|
|
|
|
|
|
|
// {8831EB53-A937-42BC-9921-B3E1121FDF86}
|
|
|
|
DEFINE_GUID(IID_IInterceptorSink, 0x8831eb53, 0xa937, 0x42bc, 0x99, 0x21, 0xb3,
|
|
|
|
0xe1, 0x12, 0x1f, 0xdf, 0x86);
|
|
|
|
|
|
|
|
struct IInterceptorSink : public ICallFrameEvents, public HandlerProvider {
|
|
|
|
virtual STDMETHODIMP SetInterceptor(IWeakReference* aInterceptor) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
// {3710799B-ECA2-4165-B9B0-3FA1E4A9B230}
|
|
|
|
DEFINE_GUID(IID_IInterceptor, 0x3710799b, 0xeca2, 0x4165, 0xb9, 0xb0, 0x3f,
|
|
|
|
0xa1, 0xe4, 0xa9, 0xb2, 0x30);
|
|
|
|
|
|
|
|
struct IInterceptor : public IUnknown {
|
2017-03-07 03:22:43 +03:00
|
|
|
virtual STDMETHODIMP GetTargetForIID(
|
|
|
|
REFIID aIid, InterceptorTargetPtr<IUnknown>& aTarget) = 0;
|
2016-07-27 20:44:56 +03:00
|
|
|
virtual STDMETHODIMP GetInterceptorForIID(REFIID aIid,
|
|
|
|
void** aOutInterceptor) = 0;
|
2020-04-24 23:25:21 +03:00
|
|
|
virtual STDMETHODIMP GetEventSink(IInterceptorSink** aSink) = 0;
|
2016-07-27 20:44:56 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The COM interceptor is the core functionality in mscom that allows us to
|
|
|
|
* redirect method calls to different threads. It emulates the vtable of a
|
|
|
|
* target interface. When a call is made on this emulated vtable, the call is
|
|
|
|
* packaged up into an instance of the ICallFrame interface which may be passed
|
|
|
|
* to other contexts for execution.
|
|
|
|
*
|
|
|
|
* In order to accomplish this, COM itself provides the CoGetInterceptor
|
|
|
|
* function, which instantiates an ICallInterceptor. Note, however, that
|
|
|
|
* ICallInterceptor only works on a single interface; we need to be able to
|
|
|
|
* interpose QueryInterface calls so that we can instantiate a new
|
|
|
|
* ICallInterceptor for each new interface that is requested.
|
|
|
|
*
|
|
|
|
* We accomplish this by using COM aggregation, which means that the
|
|
|
|
* ICallInterceptor delegates its IUnknown implementation to its outer object
|
|
|
|
* (the mscom::Interceptor we implement and control).
|
|
|
|
*/
|
|
|
|
class Interceptor final : public WeakReferenceSupport,
|
2017-02-18 03:30:03 +03:00
|
|
|
public IStdMarshalInfo,
|
|
|
|
public IMarshal,
|
2016-07-27 20:44:56 +03:00
|
|
|
public IInterceptor {
|
|
|
|
public:
|
2016-08-26 19:03:17 +03:00
|
|
|
static HRESULT Create(STAUniquePtr<IUnknown> aTarget, IInterceptorSink* aSink,
|
2017-06-07 03:30:19 +03:00
|
|
|
REFIID aInitialIid, void** aOutInterface);
|
2016-07-27 20:44:56 +03:00
|
|
|
|
2018-02-19 09:08:57 +03:00
|
|
|
/**
|
|
|
|
* Disconnect all remote clients for a given target.
|
|
|
|
* 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.
|
|
|
|
* Note that the specified target must be the same IUnknown pointer used to
|
|
|
|
* create the Interceptor. Where there is multiple inheritance, querying for
|
|
|
|
* IID_IUnknown and calling this function with that pointer alone will not
|
|
|
|
* disconnect remotes for all interfaces. If you expect that the same object
|
|
|
|
* may be fetched with different initial interfaces, you should call this
|
|
|
|
* function once for each possible IUnknown pointer.
|
|
|
|
* @return S_OK if there was an Interceptor for the given target,
|
|
|
|
* S_FALSE if there was not.
|
|
|
|
*/
|
|
|
|
static HRESULT DisconnectRemotesForTarget(IUnknown* aTarget);
|
|
|
|
|
2016-07-27 20:44:56 +03:00
|
|
|
// IUnknown
|
|
|
|
STDMETHODIMP QueryInterface(REFIID riid, void** ppv) override;
|
|
|
|
STDMETHODIMP_(ULONG) AddRef() override;
|
|
|
|
STDMETHODIMP_(ULONG) Release() override;
|
|
|
|
|
2017-02-18 03:30:03 +03:00
|
|
|
// IStdMarshalInfo
|
|
|
|
STDMETHODIMP GetClassForHandler(DWORD aDestContext, void* aDestContextPtr,
|
|
|
|
CLSID* aHandlerClsid) override;
|
|
|
|
|
|
|
|
// IMarshal
|
|
|
|
STDMETHODIMP GetUnmarshalClass(REFIID riid, void* pv, DWORD dwDestContext,
|
|
|
|
void* pvDestContext, DWORD mshlflags,
|
|
|
|
CLSID* pCid) override;
|
|
|
|
STDMETHODIMP GetMarshalSizeMax(REFIID riid, void* pv, DWORD dwDestContext,
|
|
|
|
void* pvDestContext, DWORD mshlflags,
|
|
|
|
DWORD* pSize) override;
|
|
|
|
STDMETHODIMP MarshalInterface(IStream* pStm, REFIID riid, void* pv,
|
|
|
|
DWORD dwDestContext, void* pvDestContext,
|
|
|
|
DWORD mshlflags) override;
|
|
|
|
STDMETHODIMP UnmarshalInterface(IStream* pStm, REFIID riid,
|
|
|
|
void** ppv) override;
|
|
|
|
STDMETHODIMP ReleaseMarshalData(IStream* pStm) override;
|
|
|
|
STDMETHODIMP DisconnectObject(DWORD dwReserved) override;
|
|
|
|
|
2016-07-27 20:44:56 +03:00
|
|
|
// IInterceptor
|
2017-03-07 03:22:43 +03:00
|
|
|
STDMETHODIMP GetTargetForIID(
|
|
|
|
REFIID aIid, InterceptorTargetPtr<IUnknown>& aTarget) override;
|
2016-07-27 20:44:56 +03:00
|
|
|
STDMETHODIMP GetInterceptorForIID(REFIID aIid,
|
|
|
|
void** aOutInterceptor) override;
|
|
|
|
|
2020-04-24 23:25:21 +03:00
|
|
|
STDMETHODIMP GetEventSink(IInterceptorSink** aSink) override {
|
|
|
|
RefPtr<IInterceptorSink> sink = mEventSink;
|
|
|
|
sink.forget(aSink);
|
|
|
|
return mEventSink ? S_OK : S_FALSE;
|
|
|
|
}
|
|
|
|
|
2016-07-27 20:44:56 +03:00
|
|
|
private:
|
|
|
|
struct MapEntry {
|
|
|
|
MapEntry(REFIID aIid, IUnknown* aInterceptor, IUnknown* aTargetInterface)
|
|
|
|
: mIID(aIid),
|
|
|
|
mInterceptor(aInterceptor),
|
|
|
|
mTargetInterface(aTargetInterface) {}
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2017-06-07 23:39:15 +03:00
|
|
|
IID mIID;
|
2016-12-14 09:34:26 +03:00
|
|
|
RefPtr<IUnknown> mInterceptor;
|
2016-07-27 20:44:56 +03:00
|
|
|
IUnknown* mTargetInterface;
|
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
2017-06-07 03:30:19 +03:00
|
|
|
explicit Interceptor(IInterceptorSink* aSink);
|
2016-07-27 20:44:56 +03:00
|
|
|
~Interceptor();
|
2017-08-31 01:34:43 +03:00
|
|
|
HRESULT GetInitialInterceptorForIID(detail::LiveSetAutoLock& aLiveSetLock,
|
2017-06-08 20:52:53 +03:00
|
|
|
REFIID aTargetIid,
|
2017-06-07 03:30:19 +03:00
|
|
|
STAUniquePtr<IUnknown> aTarget,
|
|
|
|
void** aOutInterface);
|
2018-05-04 07:57:11 +03:00
|
|
|
HRESULT GetInterceptorForIID(REFIID aIid, void** aOutInterceptor,
|
|
|
|
MutexAutoLock* aAlreadyLocked);
|
2016-07-27 20:44:56 +03:00
|
|
|
MapEntry* Lookup(REFIID aIid);
|
2017-07-26 00:57:18 +03:00
|
|
|
HRESULT QueryInterfaceTarget(REFIID aIid, void** aOutput,
|
|
|
|
TimeDuration* aOutDuration = nullptr);
|
2018-01-13 00:17:18 +03:00
|
|
|
HRESULT WeakRefQueryInterface(REFIID aIid, IUnknown** aOutInterface) override;
|
2016-07-27 20:44:56 +03:00
|
|
|
HRESULT CreateInterceptor(REFIID aIid, IUnknown* aOuter, IUnknown** aOutput);
|
2017-09-22 01:53:56 +03:00
|
|
|
REFIID MarshalAs(REFIID aIid) const;
|
2017-08-31 01:34:43 +03:00
|
|
|
HRESULT PublishTarget(detail::LiveSetAutoLock& aLiveSetLock,
|
|
|
|
RefPtr<IUnknown> aInterceptor, REFIID aTargetIid,
|
|
|
|
STAUniquePtr<IUnknown> aTarget);
|
2016-07-27 20:44:56 +03:00
|
|
|
|
|
|
|
private:
|
2017-06-07 03:30:19 +03:00
|
|
|
InterceptorTargetPtr<IUnknown> mTarget;
|
2016-07-27 20:44:56 +03:00
|
|
|
RefPtr<IInterceptorSink> mEventSink;
|
2018-01-13 00:17:18 +03:00
|
|
|
mozilla::Mutex mInterceptorMapMutex; // Guards mInterceptorMap
|
2016-07-27 20:44:56 +03:00
|
|
|
// Using a nsTArray since the # of interfaces is not going to be very high
|
|
|
|
nsTArray<MapEntry> mInterceptorMap;
|
2018-01-13 00:17:18 +03:00
|
|
|
mozilla::Mutex mStdMarshalMutex; // Guards mStdMarshalUnk and mStdMarshal
|
2017-02-18 03:30:03 +03:00
|
|
|
RefPtr<IUnknown> mStdMarshalUnk;
|
|
|
|
IMarshal* mStdMarshal; // WEAK
|
2018-03-06 10:08:15 +03:00
|
|
|
static MOZ_THREAD_LOCAL(bool) tlsCreatingStdMarshal;
|
2016-07-27 20:44:56 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
template <typename InterfaceT>
|
2016-08-26 19:03:17 +03:00
|
|
|
inline HRESULT CreateInterceptor(STAUniquePtr<InterfaceT> aTargetInterface,
|
2016-07-27 20:44:56 +03:00
|
|
|
IInterceptorSink* aEventSink,
|
|
|
|
InterfaceT** aOutInterface) {
|
|
|
|
if (!aTargetInterface || !aEventSink) {
|
|
|
|
return E_INVALIDARG;
|
|
|
|
}
|
|
|
|
|
2017-08-09 13:49:45 +03:00
|
|
|
REFIID iidTarget = __uuidof(InterfaceT);
|
2016-07-27 20:44:56 +03:00
|
|
|
|
|
|
|
STAUniquePtr<IUnknown> targetUnknown(aTargetInterface.release());
|
2018-05-30 22:15:35 +03:00
|
|
|
return Interceptor::Create(std::move(targetUnknown), aEventSink, iidTarget,
|
2016-07-27 20:44:56 +03:00
|
|
|
(void**)aOutInterface);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace mscom
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2017-02-18 03:30:03 +03:00
|
|
|
#endif // mozilla_mscom_Interceptor_h
|