IOStream: allow subclasses of IOStream to influence how alloc() works

bug: 140112486

Currently, once one large transfer goes through, the buffer
is _permanently_ stuck at that size even if every other transfer
to the host is much smaller.

This CL makes that decision explicit, as a virtual method,
so that subclasses can decide on a better policy if it is ok for them.

This is especially important for shared memory ring-based transports
because it's preferred to keep the ring size at a constant small value.

Consistently large transfers will then either expand the ring too much
or permanently switch to a non-ring fallback.

Change-Id: Ia47ddb90c5521ee1f5918d77d492abc0f31ebfb8
1 file changed