Bug 1380158: Use the aIID parameter supplied to mscom::ProxyStream's constructor to simplify and speed up proxy unmarshaling; r=jimm

MozReview-Commit-ID: 5YXpQXYGgjP

--HG--
extra : rebase_source : d6a8dbb524282f9365e055bc96879eeb4bbf78e3
This commit is contained in:
Aaron Klotz 2017-07-12 15:00:27 -06:00
Родитель b4fca1d196
Коммит 3783507270
3 изменённых файлов: 6 добавлений и 24 удалений

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

@ -132,7 +132,7 @@ struct ParamTraits<mozilla::mscom::COMPtrHolder<Interface, _IID>>
}
typename paramType::COMPtrType ptr;
if (!proxyStream.GetInterface(_IID, mozilla::mscom::getter_AddRefs(ptr))) {
if (!proxyStream.GetInterface(mozilla::mscom::getter_AddRefs(ptr))) {
return false;
}

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

@ -62,7 +62,7 @@ ProxyStream::ProxyStream(REFIID aIID, const BYTE* aInitBuf,
// OK to forget mStream when calling into this function because the stream
// gets released even if the unmarshaling part fails.
unmarshalResult =
::CoGetInterfaceAndReleaseStream(mStream.forget().take(), IID_IUnknown,
::CoGetInterfaceAndReleaseStream(mStream.forget().take(), aIID,
getter_AddRefs(mUnmarshaledProxy));
MOZ_ASSERT(SUCCEEDED(unmarshalResult));
};
@ -190,7 +190,7 @@ ProxyStream::GetBuffer(int& aReturnedBufSize) const
}
bool
ProxyStream::GetInterface(REFIID aIID, void** aOutInterface) const
ProxyStream::GetInterface(void** aOutInterface)
{
// We should not have a locked buffer on this side
MOZ_ASSERT(!mGlobalLockedBuf);
@ -200,26 +200,8 @@ ProxyStream::GetInterface(REFIID aIID, void** aOutInterface) const
return false;
}
if (!mUnmarshaledProxy) {
*aOutInterface = nullptr;
return true;
}
HRESULT hr = E_UNEXPECTED;
auto qiFn = [&]() -> void
{
hr = mUnmarshaledProxy->QueryInterface(aIID, aOutInterface);
};
if (XRE_IsParentProcess()) {
qiFn();
} else {
// mUnmarshaledProxy requires that we execute this in the MTA
EnsureMTA mta(qiFn);
}
return SUCCEEDED(hr);
*aOutInterface = mUnmarshaledProxy.release();
return true;
}
ProxyStream::ProxyStream(REFIID aIID, IUnknown* aObject)

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

@ -37,7 +37,7 @@ public:
return !(mStream && mUnmarshaledProxy);
}
bool GetInterface(REFIID aIID, void** aOutInterface) const;
bool GetInterface(void** aOutInterface);
const BYTE* GetBuffer(int& aReturnedBufSize) const;
bool operator==(const ProxyStream& aOther) const