зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1681529 - Part 3: Apply InputStreamLengthWrapper after DelayedStartInputStream, r=baku
Previously, we would apply the InputStreamLengthWrapper before DelayedStartInputStream, which meant that a stream serialized with aDelayedStart would not correctly implement nsIInputStreamLength. By inverting the order of these wrappers, the nsIInputStreamLength implementation is visible, without impacting the functionality of the DelayedStartInputStream wrapper. Differential Revision: https://phabricator.services.mozilla.com/D101802
This commit is contained in:
Родитель
777a09765f
Коммит
f9aa6b928e
|
@ -330,26 +330,30 @@ void IPCStreamDestination::SetLength(int64_t aLength) {
|
|||
mLengthSet = true;
|
||||
#endif
|
||||
|
||||
if (aLength != -1) {
|
||||
nsCOMPtr<nsIInputStream> finalStream;
|
||||
finalStream = new InputStreamLengthWrapper(mReader.forget(), aLength);
|
||||
mReader = do_QueryInterface(finalStream);
|
||||
MOZ_ASSERT(mReader);
|
||||
}
|
||||
mLength = aLength;
|
||||
}
|
||||
|
||||
already_AddRefed<nsIInputStream> IPCStreamDestination::TakeReader() {
|
||||
MOZ_ASSERT(mReader);
|
||||
MOZ_ASSERT(!mDelayedStartInputStream);
|
||||
|
||||
nsCOMPtr<nsIAsyncInputStream> reader{mReader.forget()};
|
||||
if (mDelayedStart) {
|
||||
mDelayedStartInputStream =
|
||||
new DelayedStartInputStream(this, std::move(mReader));
|
||||
RefPtr<nsIAsyncInputStream> inputStream = mDelayedStartInputStream;
|
||||
return inputStream.forget();
|
||||
new DelayedStartInputStream(this, std::move(reader));
|
||||
reader = mDelayedStartInputStream;
|
||||
MOZ_ASSERT(reader);
|
||||
}
|
||||
|
||||
return mReader.forget();
|
||||
if (mLength != -1) {
|
||||
MOZ_ASSERT(mLengthSet);
|
||||
nsCOMPtr<nsIInputStream> finalStream =
|
||||
new InputStreamLengthWrapper(reader.forget(), mLength);
|
||||
reader = do_QueryInterface(finalStream);
|
||||
MOZ_ASSERT(reader);
|
||||
}
|
||||
|
||||
return reader.forget();
|
||||
}
|
||||
|
||||
bool IPCStreamDestination::IsOnOwningThread() const {
|
||||
|
|
|
@ -80,6 +80,7 @@ class IPCStreamDestination {
|
|||
// away. If that happens, the reading of data will not be possible anymore.
|
||||
class DelayedStartInputStream;
|
||||
RefPtr<DelayedStartInputStream> mDelayedStartInputStream;
|
||||
int64_t mLength = -1;
|
||||
|
||||
nsCOMPtr<nsIThread> mOwningThread;
|
||||
bool mDelayedStart;
|
||||
|
|
Загрузка…
Ссылка в новой задаче