Reland "Export the quic batch writer code to Chromium. Note it's not used anywhere in Chrome, we are just exporting the code so people outside of Google can take a look."

This reverts commit 683a348730bbea7ccea7158eacc04b928b3d5256.


In addition to the auto-revert, I also changed two bzero calls to memset calls. I don't know why, but net_unittest under msan fails with a use-of-uninitialized-value: https://logs.chromium.org/logs/chromium/buildbucket/cr-buildbucket.appspot.com/8930601665674446576/+/steps/net_unittests/0/stdout

The msan error goes away after I changed the following bzero(s) into memset(s):

diff --git a/net/third_party/quic/platform/impl/quic_linux_socket_utils.h b/net/third_party/quic/platform/impl/quic_linux_socket_utils.h
index 94f055f35564..198e266dfdf2 100644
--- a/net/third_party/quic/platform/impl/quic_linux_socket_utils.h
+++ b/net/third_party/quic/platform/impl/quic_linux_socket_utils.h
@@ -102,7 +102,7 @@ class QuicMMsgHdr {
     }

     storage_.reset(new char[StorageSize()]);
-    bzero(&storage_[0], StorageSize());
+    memset(&storage_[0], 0, StorageSize());

     int i = -1;
     for (auto it = first; it != last; ++it) {
diff --git a/net/third_party/quic/platform/impl/quic_socket_utils.cc b/net/third_party/quic/platform/impl/quic_socket_utils.cc
index c25f4697dbef..1f252e50f953 100644
--- a/net/third_party/quic/platform/impl/quic_socket_utils.cc
+++ b/net/third_party/quic/platform/impl/quic_socket_utils.cc
@@ -78,7 +78,7 @@ void* QuicMsgHdr::GetNextCmsgDataInternal(int cmsg_level,

   if (cmsg_ == nullptr) {
     DCHECK_EQ(nullptr, hdr_.msg_control);
-    bzero(cbuf_, cbuf_size_);
+    memset(cbuf_, 0, cbuf_size_);
     hdr_.msg_control = cbuf_;
     cmsg_ = CMSG_FIRSTHDR(&hdr_);
   } else {


R=rch@chromium.org

Change-Id: Ibe60068cb87c0f974088b8c1601cc516ee333106
Reviewed-on: https://chromium-review.googlesource.com/c/1329348
Commit-Queue: Bin Wu <wub@chromium.org>
Reviewed-by: Ryan Hamilton <rch@chromium.org>
Cr-Commit-Position: refs/heads/master@{#606891}
18 files changed