Remove unused process_single_input_frame functionality from Http2DecoderAdapter.
PiperOrigin-RevId: 355608208
Change-Id: I8a4e7e10484c270a2c0d20ad42c2ce3f73dfa248
diff --git a/spdy/core/http2_frame_decoder_adapter.cc b/spdy/core/http2_frame_decoder_adapter.cc
index c275422..b9989c8 100644
--- a/spdy/core/http2_frame_decoder_adapter.cc
+++ b/spdy/core/http2_frame_decoder_adapter.cc
@@ -272,10 +272,6 @@
debug_visitor_ = debug_visitor;
}
-void Http2DecoderAdapter::set_process_single_input_frame(bool v) {
- process_single_input_frame_ = v;
-}
-
void Http2DecoderAdapter::set_extension_visitor(
ExtensionVisitorInterface* visitor) {
extension_ = visitor;
@@ -307,7 +303,7 @@
data += processed;
len -= processed;
total_processed += processed;
- if (process_single_input_frame() || processed == 0) {
+ if (processed == 0) {
break;
}
}
diff --git a/spdy/core/http2_frame_decoder_adapter.h b/spdy/core/http2_frame_decoder_adapter.h
index 44f3800..eec6958 100644
--- a/spdy/core/http2_frame_decoder_adapter.h
+++ b/spdy/core/http2_frame_decoder_adapter.h
@@ -131,20 +131,10 @@
void SetDecoderHeaderTableDebugVisitor(
std::unique_ptr<spdy::HpackHeaderTable::DebugVisitorInterface> visitor);
- // Sets whether or not ProcessInput returns after finishing a frame, or
- // continues processing additional frames. Normally ProcessInput processes
- // all input, but this method enables the caller (and visitor) to work with
- // a single frame at a time (or that portion of the frame which is provided
- // as input). Reset() does not change the value of this flag.
- void set_process_single_input_frame(bool v);
- bool process_single_input_frame() const {
- return process_single_input_frame_;
- }
-
// Decode the |len| bytes of encoded HTTP/2 starting at |*data|. Returns
// the number of bytes consumed. It is safe to pass more bytes in than
// may be consumed. Should process (or otherwise buffer) as much as
- // available, unless process_single_input_frame is true.
+ // available.
size_t ProcessInput(const char* data, size_t len);
// Reset the decoder (used just for tests at this time).
@@ -350,8 +340,6 @@
// Is the current frame payload destined for |extension_|?
bool handling_extension_payload_ = false;
-
- bool process_single_input_frame_ = false;
};
} // namespace http2
diff --git a/spdy/core/spdy_framer_test.cc b/spdy/core/spdy_framer_test.cc
index d913a05..53bfc2c 100644
--- a/spdy/core/spdy_framer_test.cc
+++ b/spdy/core/spdy_framer_test.cc
@@ -4799,8 +4799,7 @@
visitor.deframer_.spdy_framer_error());
}
-// Test that SpdyFramer processes, by default, all passed input in one call
-// to ProcessInput (i.e. will not be calling set_process_single_input_frame()).
+// Test that SpdyFramer processes all passed input in one call to ProcessInput.
TEST_P(SpdyFramerTest, ProcessAllInput) {
auto visitor =
std::make_unique<TestSpdyVisitor>(SpdyFramer::DISABLE_COMPRESSION);
@@ -4846,88 +4845,6 @@
EXPECT_EQ(strlen(four_score), static_cast<unsigned>(visitor->data_bytes_));
}
-// Test that SpdyFramer stops after processing a full frame if
-// process_single_input_frame is set. Input to ProcessInput has two frames, but
-// only processes the first when we give it the first frame split at any point,
-// or give it more than one frame in the input buffer.
-TEST_P(SpdyFramerTest, ProcessAtMostOneFrame) {
- deframer_.set_process_single_input_frame(true);
-
- // Create two input frames.
- const char four_score[] = "Four score and ...";
- SpdyDataIR four_score_ir(/* stream_id = */ 1, four_score);
- SpdySerializedFrame four_score_frame(framer_.SerializeData(four_score_ir));
-
- SpdyHeadersIR headers(/* stream_id = */ 2);
- headers.SetHeader("alpha", "beta");
- headers.SetHeader("gamma", "charlie");
- headers.SetHeader("cookie", "key1=value1; key2=value2");
- SpdySerializedFrame headers_frame(SpdyFramerPeer::SerializeHeaders(
- &framer_, headers, use_output_ ? &output_ : nullptr));
-
- // Put them in a single buffer (new variables here to make it easy to
- // change the order and type of frames).
- SpdySerializedFrame frame1 = std::move(four_score_frame);
- SpdySerializedFrame frame2 = std::move(headers_frame);
-
- const size_t frame1_size = frame1.size();
- const size_t frame2_size = frame2.size();
-
- SPDY_VLOG(1) << "frame1_size = " << frame1_size;
- SPDY_VLOG(1) << "frame2_size = " << frame2_size;
-
- std::string input_buffer;
- input_buffer.append(frame1.data(), frame1_size);
- input_buffer.append(frame2.data(), frame2_size);
-
- const char* buf = input_buffer.data();
- const size_t buf_size = input_buffer.size();
-
- SPDY_VLOG(1) << "buf_size = " << buf_size;
-
- for (size_t first_size = 0; first_size <= buf_size; ++first_size) {
- SPDY_VLOG(1) << "first_size = " << first_size;
- auto visitor =
- std::make_unique<TestSpdyVisitor>(SpdyFramer::DISABLE_COMPRESSION);
- deframer_.set_visitor(visitor.get());
-
- EXPECT_EQ(Http2DecoderAdapter::SPDY_READY_FOR_FRAME, deframer_.state());
-
- size_t processed_first = deframer_.ProcessInput(buf, first_size);
- if (first_size < frame1_size) {
- EXPECT_EQ(first_size, processed_first);
-
- if (first_size == 0) {
- EXPECT_EQ(Http2DecoderAdapter::SPDY_READY_FOR_FRAME, deframer_.state());
- } else {
- EXPECT_NE(Http2DecoderAdapter::SPDY_READY_FOR_FRAME, deframer_.state());
- }
-
- const char* rest = buf + processed_first;
- const size_t remaining = buf_size - processed_first;
- SPDY_VLOG(1) << "remaining = " << remaining;
-
- size_t processed_second = deframer_.ProcessInput(rest, remaining);
-
- // Redundant tests just to make it easier to think about.
- EXPECT_EQ(frame1_size - processed_first, processed_second);
- size_t processed_total = processed_first + processed_second;
- EXPECT_EQ(frame1_size, processed_total);
- } else {
- EXPECT_EQ(frame1_size, processed_first);
- }
-
- EXPECT_EQ(Http2DecoderAdapter::SPDY_READY_FOR_FRAME, deframer_.state());
-
- // At this point should have processed the entirety of the first frame,
- // and none of the second frame.
-
- EXPECT_EQ(1, visitor->data_frame_count_);
- EXPECT_EQ(strlen(four_score), static_cast<unsigned>(visitor->data_bytes_));
- EXPECT_EQ(0, visitor->headers_frame_count_);
- }
-}
-
namespace {
void CheckFrameAndIRSize(SpdyFrameIR* ir,
SpdyFramer* framer,