Bug 1847780 - Make RemoteLazyInputStream and DataPipeReceiver non-nullable. r=nika

Differential Revision: https://phabricator.services.mozilla.com/D185721
This commit is contained in:
Christian Holler (:decoder) 2023-08-09 15:47:15 +00:00
parent 08a5f4e948
commit c4325468f0
5 changed files with 8 additions and 8 deletions

View file

@ -932,7 +932,7 @@ void RemoteLazyInputStream::SerializedComplexity(uint32_t aMaxSize,
void RemoteLazyInputStream::Serialize(mozilla::ipc::InputStreamParams& aParams, void RemoteLazyInputStream::Serialize(mozilla::ipc::InputStreamParams& aParams,
uint32_t aMaxSize, uint32_t* aSizeUsed) { uint32_t aMaxSize, uint32_t* aSizeUsed) {
*aSizeUsed = 0; *aSizeUsed = 0;
aParams = mozilla::ipc::RemoteLazyInputStreamParams(this); aParams = mozilla::ipc::RemoteLazyInputStreamParams(WrapNotNull(this));
} }
bool RemoteLazyInputStream::Deserialize( bool RemoteLazyInputStream::Deserialize(

View file

@ -679,7 +679,7 @@ void DataPipeReceiver::SerializedComplexity(uint32_t aMaxSize,
void DataPipeReceiver::Serialize(InputStreamParams& aParams, uint32_t aMaxSize, void DataPipeReceiver::Serialize(InputStreamParams& aParams, uint32_t aMaxSize,
uint32_t* aSizeUsed) { uint32_t* aSizeUsed) {
*aSizeUsed = 0; *aSizeUsed = 0;
aParams = DataPipeReceiverStreamParams(this); aParams = DataPipeReceiverStreamParams(WrapNotNull(this));
} }
bool DataPipeReceiver::Deserialize(const InputStreamParams& aParams) { bool DataPipeReceiver::Deserialize(const InputStreamParams& aParams) {

View file

@ -90,7 +90,7 @@ static bool SerializeLazyInputStream(nsIInputStream* aStream,
return false; return false;
} }
aValue.stream() = RemoteLazyInputStreamParams(lazyStream); aValue.stream() = RemoteLazyInputStreamParams(WrapNotNull(lazyStream));
return true; return true;
} }

View file

@ -48,12 +48,12 @@ struct SlicedInputStreamParams
struct RemoteLazyInputStreamParams struct RemoteLazyInputStreamParams
{ {
nullable RemoteLazyInputStream stream; RemoteLazyInputStream stream;
}; };
struct DataPipeReceiverStreamParams struct DataPipeReceiverStreamParams
{ {
nullable DataPipeReceiver pipe; DataPipeReceiver pipe;
}; };
union InputStreamParams union InputStreamParams

View file

@ -108,7 +108,7 @@ void InputStreamHelper::SerializeInputStreamAsPipe(nsIInputStream* aInputStream,
return; return;
} }
aParams = DataPipeReceiverStreamParams(receiver); aParams = DataPipeReceiverStreamParams(WrapNotNull(receiver));
if (length != -1) { if (length != -1) {
aParams = InputStreamLengthWrapperParams(aParams, length, false); aParams = InputStreamLengthWrapperParams(aParams, length, false);
} }
@ -130,13 +130,13 @@ already_AddRefed<nsIInputStream> InputStreamHelper::DeserializeInputStream(
params.stream()->TakeInternalStream(getter_AddRefs(innerStream)))) { params.stream()->TakeInternalStream(getter_AddRefs(innerStream)))) {
return innerStream.forget(); return innerStream.forget();
} }
return do_AddRef(params.stream()); return do_AddRef(params.stream().get());
} }
if (aParams.type() == InputStreamParams::TDataPipeReceiverStreamParams) { if (aParams.type() == InputStreamParams::TDataPipeReceiverStreamParams) {
const DataPipeReceiverStreamParams& pipeParams = const DataPipeReceiverStreamParams& pipeParams =
aParams.get_DataPipeReceiverStreamParams(); aParams.get_DataPipeReceiverStreamParams();
return do_AddRef(pipeParams.pipe()); return do_AddRef(pipeParams.pipe().get());
} }
nsCOMPtr<nsIIPCSerializableInputStream> serializable; nsCOMPtr<nsIIPCSerializableInputStream> serializable;