gfe-relnote: Unifiy QuicPacketCreator::DelegateInterface and QuicPacketGenerator::DelegateInterface. No functional change expected, not protected.

This is intended to combine generator and creator.

PiperOrigin-RevId: 269403664
Change-Id: I9f54ccfe320f917b616843ac3628736bb78028fa
diff --git a/quic/core/quic_connection.h b/quic/core/quic_connection.h
index c811e96..843f973 100644
--- a/quic/core/quic_connection.h
+++ b/quic/core/quic_connection.h
@@ -344,7 +344,7 @@
 class QUIC_EXPORT_PRIVATE QuicConnection
     : public QuicFramerVisitorInterface,
       public QuicBlockedWriterInterface,
-      public QuicPacketGenerator::DelegateInterface,
+      public QuicPacketCreator::DelegateInterface,
       public QuicSentPacketManager::NetworkChangeVisitor {
  public:
   // Constructs a new QuicConnection for |connection_id| and
diff --git a/quic/core/quic_dispatcher.cc b/quic/core/quic_dispatcher.cc
index a855482..0f27a13 100644
--- a/quic/core/quic_dispatcher.cc
+++ b/quic/core/quic_dispatcher.cc
@@ -75,6 +75,17 @@
   void OnUnrecoverableError(QuicErrorCode /*error*/,
                             const std::string& /*error_details*/) override {}
 
+  bool ShouldGeneratePacket(HasRetransmittableData /*retransmittable*/,
+                            IsHandshake /*handshake*/) override {
+    DCHECK(false);
+    return true;
+  }
+
+  const QuicFrames MaybeBundleAckOpportunistically() override {
+    DCHECK(false);
+    return {};
+  }
+
   // QuicStreamFrameDataProducer
   WriteStreamDataResult WriteStreamData(QuicStreamId /*id*/,
                                         QuicStreamOffset offset,
diff --git a/quic/core/quic_packet_creator.h b/quic/core/quic_packet_creator.h
index a3f6c00..9ef910a 100644
--- a/quic/core/quic_packet_creator.h
+++ b/quic/core/quic_packet_creator.h
@@ -42,6 +42,13 @@
     // Called when an unrecoverable error is encountered.
     virtual void OnUnrecoverableError(QuicErrorCode error,
                                       const std::string& error_details) = 0;
+
+    // Consults delegate whether a packet should be generated.
+    virtual bool ShouldGeneratePacket(HasRetransmittableData retransmittable,
+                                      IsHandshake handshake) = 0;
+    // Called when there is data to be sent. Retrieves updated ACK frame from
+    // the delegate.
+    virtual const QuicFrames MaybeBundleAckOpportunistically() = 0;
   };
 
   // Interface which gets callbacks from the QuicPacketCreator at interesting
diff --git a/quic/core/quic_packet_generator.cc b/quic/core/quic_packet_generator.cc
index 14e6b63..5240b01 100644
--- a/quic/core/quic_packet_generator.cc
+++ b/quic/core/quic_packet_generator.cc
@@ -18,10 +18,11 @@
 
 namespace quic {
 
-QuicPacketGenerator::QuicPacketGenerator(QuicConnectionId server_connection_id,
-                                         QuicFramer* framer,
-                                         QuicRandom* random_generator,
-                                         DelegateInterface* delegate)
+QuicPacketGenerator::QuicPacketGenerator(
+    QuicConnectionId server_connection_id,
+    QuicFramer* framer,
+    QuicRandom* random_generator,
+    QuicPacketCreator::DelegateInterface* delegate)
     : delegate_(delegate),
       packet_creator_(server_connection_id, framer, random_generator, delegate),
       next_transmission_type_(NOT_RETRANSMISSION),
diff --git a/quic/core/quic_packet_generator.h b/quic/core/quic_packet_generator.h
index 69c69ea..4b27d1d 100644
--- a/quic/core/quic_packet_generator.h
+++ b/quic/core/quic_packet_generator.h
@@ -59,22 +59,10 @@
 
 class QUIC_EXPORT_PRIVATE QuicPacketGenerator {
  public:
-  class QUIC_EXPORT_PRIVATE DelegateInterface
-      : public QuicPacketCreator::DelegateInterface {
-   public:
-    ~DelegateInterface() override {}
-    // Consults delegate whether a packet should be generated.
-    virtual bool ShouldGeneratePacket(HasRetransmittableData retransmittable,
-                                      IsHandshake handshake) = 0;
-    // Called when there is data to be sent. Retrieves updated ACK frame from
-    // the delegate.
-    virtual const QuicFrames MaybeBundleAckOpportunistically() = 0;
-  };
-
   QuicPacketGenerator(QuicConnectionId server_connection_id,
                       QuicFramer* framer,
                       QuicRandom* random_generator,
-                      DelegateInterface* delegate);
+                      QuicPacketCreator::DelegateInterface* delegate);
   QuicPacketGenerator(const QuicPacketGenerator&) = delete;
   QuicPacketGenerator& operator=(const QuicPacketGenerator&) = delete;
 
@@ -259,7 +247,7 @@
   // delegate_ and flushes it.
   void MaybeBundleAckOpportunistically();
 
-  DelegateInterface* delegate_;
+  QuicPacketCreator::DelegateInterface* delegate_;
 
   QuicPacketCreator packet_creator_;
 
diff --git a/quic/core/quic_packet_generator_test.cc b/quic/core/quic_packet_generator_test.cc
index 6e395df..35085c2 100644
--- a/quic/core/quic_packet_generator_test.cc
+++ b/quic/core/quic_packet_generator_test.cc
@@ -36,7 +36,7 @@
 namespace test {
 namespace {
 
-class MockDelegate : public QuicPacketGenerator::DelegateInterface {
+class MockDelegate : public QuicPacketCreator::DelegateInterface {
  public:
   MockDelegate() {}
   MockDelegate(const MockDelegate&) = delete;
@@ -108,7 +108,7 @@
   TestPacketGenerator(QuicConnectionId connection_id,
                       QuicFramer* framer,
                       QuicRandom* random_generator,
-                      DelegateInterface* delegate,
+                      QuicPacketCreator::DelegateInterface* delegate,
                       SimpleDataProducer* producer)
       : QuicPacketGenerator(connection_id, framer, random_generator, delegate),
         ack_frame_(InitAckFrame(1)),
diff --git a/quic/test_tools/quic_test_utils.h b/quic/test_tools/quic_test_utils.h
index da04f42..8ba9615 100644
--- a/quic/test_tools/quic_test_utils.h
+++ b/quic/test_tools/quic_test_utils.h
@@ -1077,6 +1077,10 @@
   MOCK_METHOD0(GetPacketBuffer, char*());
   MOCK_METHOD1(OnSerializedPacket, void(SerializedPacket* packet));
   MOCK_METHOD2(OnUnrecoverableError, void(QuicErrorCode, const std::string&));
+  MOCK_METHOD2(ShouldGeneratePacket,
+               bool(HasRetransmittableData retransmittable,
+                    IsHandshake handshake));
+  MOCK_METHOD0(MaybeBundleAckOpportunistically, const QuicFrames());
 };
 
 class MockSessionNotifier : public SessionNotifierInterface {