Bug 1339713 - Use IPCStream everywhere - part 6 - fixing AutoIPCStream when inputStream is null, r=smaug

This commit is contained in:
Andrea Marchesini 2017-03-09 14:11:21 +01:00
Родитель 2c988363eb
Коммит 7006d4e231
1 изменённых файлов: 20 добавлений и 6 удалений

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

@ -118,6 +118,21 @@ SerializeInputStreamWithFdsParent(nsIInputStream* aStream,
}
}
template<typename M>
void
SerializeInputStreamWithFdsParent(nsIInputStream* aStream,
OptionalIPCStream& aValue,
M* aManager)
{
if (!aStream) {
aValue = void_t();
return;
}
aValue = IPCStream();
SerializeInputStreamWithFdsParent(aStream, aValue.get_IPCStream(), aManager);
}
template<typename M>
void
SerializeInputStream(nsIInputStream* aStream, IPCStream& aValue, M* aManager)
@ -178,8 +193,7 @@ SerializeInputStream(nsIInputStream* aStream, OptionalIPCStream& aValue,
}
aValue = IPCStream();
SerializeInputStream(aStream, aValue.get_IPCStream(),
aManager);
SerializeInputStream(aStream, aValue.get_IPCStream(), aManager);
}
void
@ -378,7 +392,7 @@ AutoIPCStream::~AutoIPCStream()
void
AutoIPCStream::Serialize(nsIInputStream* aStream, dom::nsIContentChild* aManager)
{
MOZ_ASSERT(aStream);
MOZ_ASSERT(aStream || !mValue);
MOZ_ASSERT(aManager);
MOZ_ASSERT(mValue || mOptionalValue);
MOZ_ASSERT(!mTaken);
@ -396,7 +410,7 @@ AutoIPCStream::Serialize(nsIInputStream* aStream, dom::nsIContentChild* aManager
void
AutoIPCStream::Serialize(nsIInputStream* aStream, PBackgroundChild* aManager)
{
MOZ_ASSERT(aStream);
MOZ_ASSERT(aStream || !mValue);
MOZ_ASSERT(aManager);
MOZ_ASSERT(mValue || mOptionalValue);
MOZ_ASSERT(!mTaken);
@ -414,7 +428,7 @@ AutoIPCStream::Serialize(nsIInputStream* aStream, PBackgroundChild* aManager)
void
AutoIPCStream::Serialize(nsIInputStream* aStream, dom::PContentParent* aManager)
{
MOZ_ASSERT(aStream);
MOZ_ASSERT(aStream || !mValue);
MOZ_ASSERT(aManager);
MOZ_ASSERT(mValue || mOptionalValue);
MOZ_ASSERT(!mTaken);
@ -432,7 +446,7 @@ AutoIPCStream::Serialize(nsIInputStream* aStream, dom::PContentParent* aManager)
void
AutoIPCStream::Serialize(nsIInputStream* aStream, PBackgroundParent* aManager)
{
MOZ_ASSERT(aStream);
MOZ_ASSERT(aStream || !mValue);
MOZ_ASSERT(aManager);
MOZ_ASSERT(mValue || mOptionalValue);
MOZ_ASSERT(!mTaken);