Change SendOrQueueMessage to take a QuicMemSliceSpan.
QuicMemSliceSpan now has a `ConsumeAll` method in its API, which allows us to
move the mem slices into a queue of messages to send. This is now the same
mechanism used to store mem slice spans in a stream or message's send buffer.
It ensures that mem slices are properly ref-counted so that the contents are not
deleted after storing them.
This should enable zero-copy writes down the line. However, currently, we still
have two copies:
- One in the application layer, where we create mem slices by copying data
- One in the session, when converting mem slices back into a mem slice span
Nothing stops us from fixing the former, but it requires a bit of refactoring at
the application layer.
The latter requires an API for building a QuicMemSliceSpan out of QuicMemSlices
without copying them. This should be possible, but doesn't seem to exist today.
gfe-relnote: n/a (Quartc only)
PiperOrigin-RevId: 247442584
Change-Id: Ie1bc1ad2f878ee312a5e13b048fd2233864c3d18
diff --git a/quic/quartc/test/quartc_peer.h b/quic/quartc/test/quartc_peer.h
index 68cb9ee..8a62ba7 100644
--- a/quic/quartc/test/quartc_peer.h
+++ b/quic/quartc/test/quartc_peer.h
@@ -48,6 +48,7 @@
QuartcPeer(const QuicClock* clock,
QuicAlarmFactory* alarm_factory,
QuicRandom* random,
+ QuicBufferAllocator* buffer_allocator,
const std::vector<QuartcDataSource::Config>& configs);
QuartcPeer(QuartcPeer&) = delete;
QuartcPeer& operator=(QuartcPeer&) = delete;
@@ -94,6 +95,7 @@
const QuicClock* clock_;
QuicAlarmFactory* alarm_factory_;
QuicRandom* random_;
+ QuicBufferAllocator* buffer_allocator_;
// Whether the peer is currently sending.
bool enabled_;