Removes DataFrameSource arguments from Http2Adapter methods and implementations. Also adds a compatibility method to ease the transition while callers are updated. PiperOrigin-RevId: 700011707
diff --git a/quiche/http2/adapter/adapter_impl_comparison_test.cc b/quiche/http2/adapter/adapter_impl_comparison_test.cc index 11fe362..1713bd8 100644 --- a/quiche/http2/adapter/adapter_impl_comparison_test.cc +++ b/quiche/http2/adapter/adapter_impl_comparison_test.cc
@@ -64,7 +64,7 @@ const int kConnectionWindowIncrease = 192 * 1024; const int32_t nghttp2_stream_id = - nghttp2_adapter->SubmitRequest(request_headers, nullptr, true, nullptr); + nghttp2_adapter->SubmitRequest(request_headers, true, nullptr); // Both the connection and stream flow control windows are increased. nghttp2_adapter->SubmitWindowUpdate(0, kConnectionWindowIncrease); @@ -77,7 +77,7 @@ nghttp2_window); const int32_t oghttp2_stream_id = - oghttp2_adapter->SubmitRequest(request_headers, nullptr, true, nullptr); + oghttp2_adapter->SubmitRequest(request_headers, true, nullptr); // Both the connection and stream flow control windows are increased. oghttp2_adapter->SubmitWindowUpdate(0, kConnectionWindowIncrease); oghttp2_adapter->SubmitWindowUpdate(oghttp2_stream_id,
diff --git a/quiche/http2/adapter/http2_adapter.h b/quiche/http2/adapter/http2_adapter.h index d4dccca..339bdf7 100644 --- a/quiche/http2/adapter/http2_adapter.h +++ b/quiche/http2/adapter/http2_adapter.h
@@ -122,16 +122,25 @@ // be nullptr if the request does not have a body. If |end_stream| is true, // the adapter will set the fin bit on the request HEADERS frame. virtual int32_t SubmitRequest(absl::Span<const Header> headers, - std::unique_ptr<DataFrameSource> data_source, bool end_stream, void* user_data) = 0; + // Deprecated + int32_t SubmitRequest(absl::Span<const Header> headers, + nullptr_t /*data_source*/, bool end_stream, + void* user_data) { + return SubmitRequest(headers, end_stream, user_data); + } // Returns 0 on success. |data_source| may be nullptr if the response does not // have a body. If |end_stream| is true, the adapter will set the fin bit on // the response HEADERS frame. virtual int SubmitResponse(Http2StreamId stream_id, absl::Span<const Header> headers, - std::unique_ptr<DataFrameSource> data_source, bool end_stream) = 0; + // Deprecated + int SubmitResponse(Http2StreamId stream_id, absl::Span<const Header> headers, + nullptr_t /*data_source*/, bool end_stream) { + return SubmitResponse(stream_id, headers, end_stream); + } // Queues trailers to be sent after any outstanding data on the stream with ID // |stream_id|. Returns 0 on success.
diff --git a/quiche/http2/adapter/nghttp2_adapter.cc b/quiche/http2/adapter/nghttp2_adapter.cc index fd889c4..6e9aaa5 100644 --- a/quiche/http2/adapter/nghttp2_adapter.cc +++ b/quiche/http2/adapter/nghttp2_adapter.cc
@@ -300,11 +300,8 @@ } } -int32_t NgHttp2Adapter::SubmitRequest( - absl::Span<const Header> headers, - std::unique_ptr<DataFrameSource> data_source, bool end_stream, - void* stream_user_data) { - QUICHE_DCHECK(data_source == nullptr); +int32_t NgHttp2Adapter::SubmitRequest(absl::Span<const Header> headers, + bool end_stream, void* stream_user_data) { auto nvs = GetNghttp2Nvs(headers); std::unique_ptr<nghttp2_data_provider> provider; @@ -325,9 +322,7 @@ int NgHttp2Adapter::SubmitResponse(Http2StreamId stream_id, absl::Span<const Header> headers, - std::unique_ptr<DataFrameSource> data_source, bool end_stream) { - QUICHE_DCHECK(data_source == nullptr); auto nvs = GetNghttp2Nvs(headers); std::unique_ptr<nghttp2_data_provider> provider; if (!end_stream) {
diff --git a/quiche/http2/adapter/nghttp2_adapter.h b/quiche/http2/adapter/nghttp2_adapter.h index 69f5805..1fadd68 100644 --- a/quiche/http2/adapter/nghttp2_adapter.h +++ b/quiche/http2/adapter/nghttp2_adapter.h
@@ -75,12 +75,14 @@ void MarkDataConsumedForStream(Http2StreamId stream_id, size_t num_bytes) override; + // For the deprecated overload. + using Http2Adapter::SubmitRequest; int32_t SubmitRequest(absl::Span<const Header> headers, - std::unique_ptr<DataFrameSource> data_source, bool end_stream, void* user_data) override; + // For the deprecated overload. + using Http2Adapter::SubmitResponse; int SubmitResponse(Http2StreamId stream_id, absl::Span<const Header> headers, - std::unique_ptr<DataFrameSource> data_source, bool end_stream) override; int SubmitTrailer(Http2StreamId stream_id,
diff --git a/quiche/http2/adapter/oghttp2_adapter.cc b/quiche/http2/adapter/oghttp2_adapter.cc index 9fb7e8c..321eca6 100644 --- a/quiche/http2/adapter/oghttp2_adapter.cc +++ b/quiche/http2/adapter/oghttp2_adapter.cc
@@ -139,19 +139,14 @@ stream_id, TranslateErrorCode(error_code))); } -int32_t OgHttp2Adapter::SubmitRequest( - absl::Span<const Header> headers, - std::unique_ptr<DataFrameSource> data_source, bool end_stream, - void* user_data) { - QUICHE_DCHECK(data_source == nullptr); +int32_t OgHttp2Adapter::SubmitRequest(absl::Span<const Header> headers, + bool end_stream, void* user_data) { return session_->SubmitRequest(headers, end_stream, user_data); } int OgHttp2Adapter::SubmitResponse(Http2StreamId stream_id, absl::Span<const Header> headers, - std::unique_ptr<DataFrameSource> data_source, bool end_stream) { - QUICHE_DCHECK(data_source == nullptr); return session_->SubmitResponse(stream_id, headers, end_stream); }
diff --git a/quiche/http2/adapter/oghttp2_adapter.h b/quiche/http2/adapter/oghttp2_adapter.h index 400aa87..2af239f 100644 --- a/quiche/http2/adapter/oghttp2_adapter.h +++ b/quiche/http2/adapter/oghttp2_adapter.h
@@ -53,11 +53,13 @@ void MarkDataConsumedForStream(Http2StreamId stream_id, size_t num_bytes) override; void SubmitRst(Http2StreamId stream_id, Http2ErrorCode error_code) override; + // For the deprecated overload. + using Http2Adapter::SubmitRequest; int32_t SubmitRequest(absl::Span<const Header> headers, - std::unique_ptr<DataFrameSource> data_source, bool end_stream, void* user_data) override; + // For the deprecated overload. + using Http2Adapter::SubmitResponse; int SubmitResponse(Http2StreamId stream_id, absl::Span<const Header> headers, - std::unique_ptr<DataFrameSource> data_source, bool end_stream) override; int SubmitTrailer(Http2StreamId stream_id,