Landing Recent QUIC changes until 11:30 AM, Aug 11, 2018 UTC-4

Update QUIC flag values.

Bundle BbrSender and its BandwidthSampler in memory, hopefully reduces cache misses. Not protected.

Merge internal change: 208339929

Move the delegate from PacketTransportInterface to QuartcPacketTransport.

This is the first step of getting rid of the three separate interfaces for
QuartcPacketWriter, QuartcPacketTransport, and PacketWriterInterface.

Threading requirements, debug info (packet number), and the fact that Quartc
owns and manages the entire ICE transport make this somewhat unwieldy at the
moment.  However, it should get better going forward.

This change makes quic::QuartcPacketTransport an interface for network I/O.
- Write() sends packets to the network
- Delegate::OnTransportCanWrite() indicates that writes are unblocked
- Delegate::OnTransportReceived() passes incoming packets to QUIC

PacketTransportInterface adds on the signaling and config required for ICE.
- Connect() allows the caller to specify initial parameters and start ICE
- Disconnect() allows the caller to shut down the ICE transport
- SetDeliveryMode() and SetIpPrivacyPolicy() modify ICE parameters at runtime
- OnTransportMessageReceived() and OutgoingTransportMessages() provide a
channel for signaling ICE candidates

Going forward, Quartc will share an ICE transport with other components and will
not need to manage the signaling aspects of ICE.  PacketTransportInterface can
go away once that happens.

QuartcPacketWriter remains an implementation of QuicPacketWriter.  It handles
network output through the wrapped QuartcPacketTransport.  It adds two pieces of
functionality on top of QuicPacketWriter: it adds packet numbers to every
outgoing packet and allows the caller to set the packet transport's delegate.

Once QuicPacketWriter::WritePacket() includes packet numbers in its interface,
it will also be possible to merge QuartcPacketWriter and QuartcPacketTransport
into a single network I/O interface for quic/quartc.

Finally, QUIC expects the QuartcPacketTransport::Delegate calls to be serialized
with other QUIC operations.  The way that Quartc does this serialization today
becomes slightly more complex.  Since QUIC now calls SetDelegate(), Quartc needs
a wrapper to intercept the Delegate and perform the thread hop to the QUIC
executor.  This is necessary pain induced by thread-hopping.

The thread-safe wrapper will become thinner when PacketTransportInterface is
deleted.  It will go away entirely when we replace quartc_thread_safe with a
better synchronization mechanism.


Merge internal change: 208285103

In QUIC, when session decides what to write, let IsPacketUsefulForRetransmittableData drops packets earlier. Protected by FLAGS_quic_reloadable_flag_quic_fix_is_useful_for_retrans.

Merge internal change: 207934023

Make QuicSession::GetStream slightly faster by skipping the lookup into the static stream map, when possible. Protected by FLAGS_quic_reloadable_flag_quic_session_faster_get_stream.

Merge internal change: 207921542

In QUIC, if a newer WINDOW_UPDATE frame gets acked, consider all older WINDOW_UPDATE gets acked. Protected by FLAGS_quic_reloadable_flag_quic_donot_retransmit_old_window_update2.

Merge internal change: 207915791

In QUIC, only process stateless resets on the client side. Protected by FLAGS_quic_reloadable_flag_quic_process_stateless_reset_at_client_only.

When the flag is on, server won't bother to read |header->possible_stateless_reset_token|, thus saving a small amount of cpu. This is a micro optimization. No externally visible behavior change.

Merge internal change: 207883948

In QUIC, try to aggregate acked stream frame. Protected by FLAGS_quic_reloadable_flag_quic_aggregate_acked_stream_frames.

Merge internal change: 207746798

Improve Quartc's responsiveness to changes in congestion control parameters.

Issue a callback from QUIC to Quartc whenever congestion control changes.  This
callback reports three parameters:  bandwidth estimate, pacing rate, and latest
RTT.  The callback fires whenever QuicSendPacketManager calls
OnCongestionChange().  This happens after every ack frame with an rtt update,
acked packets, or lost packets.

Reporting changes in congestion control parameters to Quartc immediately, rather
than waiting up to 200 ms for Quartc to scrape them from stats, should improve
responsiveness to congestion control changes, especially on low-RTT networks
where changes can happen on timescales much shorter than 200 ms.

Quartc now uses the minimum of BWE and pacing rate for rate controls in the
Brain.  This should avoid building long client-side buffers during PROBE_RTT,
DRAIN, or low-gain PROBE_BW phases.  During these phases, the BWE is higher than
the pacing rate.  If Quartc continues to produce data at the BWE, it will
overproduce and buffer data.

Since low-gain phases tend to last on the order of 1 RTT, it does not make sense
to adapt to the pacing rate without also getting a callback as soon as it
changes.  Scraping every 200 ms may easily miss gain transitions (either
obtaining a higher pacing rate just before the low-gain phase starts or
obtaining a lower pacing rate just before the low-gain phase ends).


Merge internal change: 207729769

Refactor quic::PerPacketOptions

Turn it from a class into a struct (since it only exists to carry a bunch of
values around).  Also make Clone() return unique_ptr.

Merge internal change: 207625151

Remove a bogus DCHECK from QuicStream::SetPriority which would be triggered if a server received a PRIORITY frame after having sent any of the response body.

Merge internal change: 207619365

Reorder an OR statement in IsPacketUsefulForRetransmittableData() to avoid calling HasRetransmittableFrames() when it's not necessary.  No functional change, not flag protected.

Merge internal change: 207585541

Change-Id: I144c4346e80b418ddf8a70b60642e9716e902cf7
Commit-Queue: Bin Wu <>
Commit-Queue: Ryan Hamilton <>
Reviewed-by: Ryan Hamilton <>
Cr-Original-Commit-Position: refs/heads/master@{#582822}
Cr-Mirrored-Commit: 076a1edc410d52aa6794f6146e1baa9d6d3fc090
40 files changed