Add a proper API to create memslices from the QUIC code.

Current API provides an (allocator, size) constructor.  However, this just creates a buffer with random data in it and no way to change it, since memslices are read-only.  Current code uses const_cast; this CL creates a proper API and updates all existing call sites to use it.

gfe-relnote: n/a (no functional change)
PiperOrigin-RevId: 287072774
Change-Id: Ie4dd2eae6db2ec91b087f5d41887ea3948ee411a
diff --git a/quic/core/quic_stream_send_buffer.cc b/quic/core/quic_stream_send_buffer.cc
index 2008cf2..d91ceb8 100644
--- a/quic/core/quic_stream_send_buffer.cc
+++ b/quic/core/quic_stream_send_buffer.cc
@@ -67,10 +67,10 @@
       GetQuicFlag(FLAGS_quic_send_buffer_max_data_slice_size);
   while (data_length > 0) {
     size_t slice_len = std::min(data_length, max_data_slice_size);
-    QuicMemSlice slice(allocator_, slice_len);
+    QuicUniqueBufferPtr buffer = MakeUniqueBuffer(allocator_, slice_len);
     QuicUtils::CopyToBuffer(iov, iov_count, iov_offset, slice_len,
-                            const_cast<char*>(slice.data()));
-    SaveMemSlice(std::move(slice));
+                            buffer.get());
+    SaveMemSlice(QuicMemSlice(std::move(buffer), slice_len));
     data_length -= slice_len;
     iov_offset += slice_len;
   }