mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
AK: Add AllocatingMemoryStream::peek_some_contiguous()
Expose the next contiguous range of readable bytes at the current read offset without copying. This lets callers hand the underlying chunk straight to write/send without round-tripping through a user-space buffer, which is important when the stream is used as a back-pressure queue and the total queued size can grow to many megabytes.
This commit is contained in:
committed by
Jelle Raaijmakers
parent
25254d5a20
commit
612c61cc16
Notes:
github-actions[bot]
2026-04-22 11:33:35 +00:00
Author: https://github.com/awesomekling Commit: https://github.com/LadybirdBrowser/ladybird/commit/612c61cc165 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/9028 Reviewed-by: https://github.com/gmta ✅
@@ -91,6 +91,7 @@ public:
|
||||
static constexpr size_t CHUNK_SIZE = 4096;
|
||||
|
||||
void peek_some(Bytes) const;
|
||||
ReadonlyBytes peek_some_contiguous() const;
|
||||
|
||||
virtual ErrorOr<Bytes> read_some(Bytes) override;
|
||||
virtual ErrorOr<size_t> write_some(ReadonlyBytes) override;
|
||||
@@ -107,7 +108,7 @@ private:
|
||||
// Note: We set the inline buffer capacity to zero to make moving chunks as efficient as possible.
|
||||
using Chunk = AK::Detail::ByteBuffer<0>;
|
||||
|
||||
ErrorOr<ReadonlyBytes> next_read_range(size_t read_offset) const;
|
||||
ReadonlyBytes next_read_range(size_t read_offset) const;
|
||||
ErrorOr<Bytes> next_write_range();
|
||||
void cleanup_unused_chunks();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user