void
nsBufferedInputStream::Serialize(InputStreamParams& aParams)
{
    BufferedInputStreamParams params;

    if (mStream) {
        nsCOMPtr<nsIIPCSerializableInputStream> stream =
            do_QueryInterface(mStream);
        NS_ASSERTION(stream, "Wrapped stream is not serializable!");

        InputStreamParams wrappedParams;
        stream->Serialize(wrappedParams);

        NS_ASSERTION(wrappedParams.type() != InputStreamParams::T__None,
                     "Wrapped stream failed to serialize!");

        params.optionalStream() = wrappedParams;
    }
    else {
        params.optionalStream() = mozilla::void_t();
    }

    params.bufferSize() = mBufferSize;

    aParams = params;
}
void
nsBufferedInputStream::Serialize(InputStreamParams& aParams,
                                 FileDescriptorArray& aFileDescriptors)
{
    BufferedInputStreamParams params;

    if (mStream) {
        nsCOMPtr<nsIInputStream> stream = do_QueryInterface(mStream);
        MOZ_ASSERT(stream);

        InputStreamParams wrappedParams;
        SerializeInputStream(stream, wrappedParams, aFileDescriptors);

        params.optionalStream() = wrappedParams;
    }
    else {
        params.optionalStream() = mozilla::void_t();
    }

    params.bufferSize() = mBufferSize;

    aParams = params;
}