Bug 1645540: Make IpdlQueue resize buffers when initial deserialization estimate was low r=jgilbert

When inserting an argument into the IpdlQueue for transmission, we need to resize the internal buffer if we end up with more data than expected.

Differential Revision: https://phabricator.services.mozilla.com/D79581
This commit is contained in:
David Parks 2020-06-17 18:18:00 +00:00
parent ea1d95a265
commit 10ad51e7e6

View File

@ -423,7 +423,11 @@ class IpdlProducer final : public SupportsWeakPtr<IpdlProducer<_Actor>> {
template <typename Arg>
QueueStatus WriteObject(size_t aRead, size_t* aWrite, const Arg& arg,
size_t aArgSize) {
// TODO: Queue needs one extra byte for PCQ (fixme).
if (mSerializedData.Length() < (*aWrite) + aArgSize) {
// Previous MinSizeOfArgs estimate was insufficient. Resize the
// buffer to accomodate our real needs.
mSerializedData.SetLength(*aWrite + aArgSize);
}
return mozilla::webgl::Marshaller::WriteObject(
mSerializedData.Elements(), mSerializedData.Length() + 1, aRead, aWrite,
arg, aArgSize);