Inline QuicConnection::WriteNewData.

PiperOrigin-RevId: 366429245
Change-Id: I3912fe9670970bf1c650d6bb52bdfc2572c3a562
diff --git a/quic/core/quic_connection.cc b/quic/core/quic_connection.cc
index c53ceea..e0b6921 100644
--- a/quic/core/quic_connection.cc
+++ b/quic/core/quic_connection.cc
@@ -2763,7 +2763,6 @@
     return;
   }
 
-  // Add a flusher to ensure the connection is marked app-limited.
   ScopedPacketFlusher flusher(this);
 
   WriteQueuedPackets();
@@ -2792,30 +2791,22 @@
     }
     pending_path_challenge_payloads_.pop_front();
   }
-  WriteNewData();
-}
 
-void QuicConnection::WriteNewData() {
   // Sending queued packets may have caused the socket to become write blocked,
-  // or the congestion manager to prohibit sending.  If we've sent everything
-  // we had queued and we're still not blocked, let the visitor know it can
-  // write more.
+  // or the congestion manager to prohibit sending.
   if (!CanWrite(HAS_RETRANSMITTABLE_DATA)) {
     return;
   }
 
-  {
-    ScopedPacketFlusher flusher(this);
-    visitor_->OnCanWrite();
-  }
+  // Tell the session it can write.
+  visitor_->OnCanWrite();
 
   // After the visitor writes, it may have caused the socket to become write
   // blocked or the congestion manager to prohibit sending, so check again.
   if (visitor_->WillingAndAbleToWrite() && !send_alarm_->IsSet() &&
       CanWrite(HAS_RETRANSMITTABLE_DATA)) {
-    // We're not write blocked, but some stream didn't write out all of its
-    // bytes. Register for 'immediate' resumption so we'll keep writing after
-    // other connections and events have had a chance to use the thread.
+    // We're not write blocked, but some data wasn't written. Register for
+    // 'immediate' resumption so we'll keep writing after other connections.
     send_alarm_->Set(clock_->ApproximateNow());
   }
 }
diff --git a/quic/core/quic_connection.h b/quic/core/quic_connection.h
index 2c70c04..6a1858a 100644
--- a/quic/core/quic_connection.h
+++ b/quic/core/quic_connection.h
@@ -1475,9 +1475,6 @@
   // blocked when this is called.
   void WriteQueuedPackets();
 
-  // Writes new data if congestion control allows.
-  void WriteNewData();
-
   // Queues |packet| in the hopes that it can be decrypted in the
   // future, when a new key is installed.
   void QueueUndecryptablePacket(const QuicEncryptedPacket& packet,