Bug 1394395 - Fix mscom build when ACCESSIBILITY is disabled. r=jimm

MozReview-Commit-ID: KmMTWR9FQcx

--HG--
extra : rebase_source : afb5ebce0c9478b4fba26610c2ee4292ee4afcb2
This commit is contained in:
Aaron Klotz 2017-08-28 12:27:28 -06:00
Родитель 440ff638ee
Коммит f550f56c7e
5 изменённых файлов: 34 добавлений и 28 удалений

Просмотреть файл

@ -8,6 +8,7 @@
#define mozilla_mscom_PassthruProxy_h
#include "mozilla/Atomics.h"
#include "mozilla/mscom/Ptr.h"
#include "mozilla/NotNull.h"
#include <objbase.h>

Просмотреть файл

@ -90,7 +90,11 @@ ProxyStream::ProxyStream(REFIID aIID, const BYTE* aInitBuf,
// correctness with IPDL. We'll request an IUnknown and then QI the
// actual interface later.
#if defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
auto marshalFn = [this, &strActCtx, &unmarshalResult, &aIID]() -> void
#else
auto marshalFn = [this, &unmarshalResult, &aIID]() -> void
#endif // defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
{
#if defined(ACCESSIBILITY) && defined(MOZ_CRASHREPORTER)
auto curActCtx = ActivationContext::GetCurrent();

Просмотреть файл

@ -242,31 +242,6 @@ GUIDToString(REFGUID aGuid, nsAString& aOutString)
}
}
bool
IsCallerExternalProcess()
{
MOZ_ASSERT(XRE_IsContentProcess());
/**
* CoGetCallerTID() gives us the caller's thread ID when that thread resides
* in a single-threaded apartment. Since our chrome main thread does live
* inside an STA, we will therefore be able to check whether the caller TID
* equals our chrome main thread TID. This enables us to distinguish
* between our chrome thread vs other out-of-process callers. We check for
* S_FALSE to ensure that the caller is a different process from ours, which
* is the only scenario that we care about.
*/
DWORD callerTid;
if (::CoGetCallerTID(&callerTid) != S_FALSE) {
return false;
}
// Now check whether the caller is our parent process main thread.
const DWORD parentMainTid =
dom::ContentChild::GetSingleton()->GetChromeMainThreadId();
return callerTid != parentMainTid;
}
#endif // defined(MOZILLA_INTERNAL_API)
#if defined(ACCESSIBILITY)
@ -317,6 +292,31 @@ IsVtableIndexFromParentInterface(REFIID aInterface, unsigned long aVtableIndex)
#if defined(MOZILLA_INTERNAL_API)
bool
IsCallerExternalProcess()
{
MOZ_ASSERT(XRE_IsContentProcess());
/**
* CoGetCallerTID() gives us the caller's thread ID when that thread resides
* in a single-threaded apartment. Since our chrome main thread does live
* inside an STA, we will therefore be able to check whether the caller TID
* equals our chrome main thread TID. This enables us to distinguish
* between our chrome thread vs other out-of-process callers. We check for
* S_FALSE to ensure that the caller is a different process from ours, which
* is the only scenario that we care about.
*/
DWORD callerTid;
if (::CoGetCallerTID(&callerTid) != S_FALSE) {
return false;
}
// Now check whether the caller is our parent process main thread.
const DWORD parentMainTid =
dom::ContentChild::GetSingleton()->GetChromeMainThreadId();
return callerTid != parentMainTid;
}
bool
IsInterfaceEqualToOrInheritedFrom(REFIID aInterface, REFIID aFrom,
unsigned long aVtableIndexHint)

Просмотреть файл

@ -48,7 +48,6 @@ uint32_t CopySerializedProxy(IStream* aInStream, IStream** aOutStream);
#if defined(MOZILLA_INTERNAL_API)
void GUIDToString(REFGUID aGuid, nsAString& aOutString);
bool IsCallerExternalProcess();
#endif // defined(MOZILLA_INTERNAL_API)
#if defined(ACCESSIBILITY)
@ -56,6 +55,8 @@ bool IsVtableIndexFromParentInterface(REFIID aInterface,
unsigned long aVtableIndex);
#if defined(MOZILLA_INTERNAL_API)
bool IsCallerExternalProcess();
bool IsInterfaceEqualToOrInheritedFrom(REFIID aInterface, REFIID aFrom,
unsigned long aVtableIndexHint);
#endif // defined(MOZILLA_INTERNAL_API)

Просмотреть файл

@ -11,7 +11,6 @@ EXPORTS.mozilla.mscom += [
'COMApartmentRegion.h',
'COMPtrHolder.h',
'EnsureMTA.h',
'FastMarshaler.h',
'MainThreadClientInfo.h',
'MainThreadRuntime.h',
'Objref.h',
@ -28,7 +27,6 @@ SOURCES += [
UNIFIED_SOURCES += [
'AgileReference.cpp',
'EnsureMTA.cpp',
'FastMarshaler.cpp',
'MainThreadClientInfo.cpp',
'MainThreadRuntime.cpp',
'Objref.cpp',
@ -50,6 +48,7 @@ if CONFIG['ACCESSIBILITY']:
EXPORTS.mozilla.mscom += [
'ActivationContext.h',
'DispatchForwarder.h',
'FastMarshaler.h',
'IHandlerProvider.h',
'Interceptor.h',
'InterceptorLog.h',
@ -71,6 +70,7 @@ if CONFIG['ACCESSIBILITY']:
UNIFIED_SOURCES += [
'ActivationContext.cpp',
'DispatchForwarder.cpp',
'FastMarshaler.cpp',
'InterceptorLog.cpp',
'MainThreadHandoff.cpp',
'MainThreadInvoker.cpp',