Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Side by Side Diff: net/spdy/spdy_deframer_visitor.cc

Issue 2438163002: Remove SpdyFramerVisitorInterface::OnControlFrameHeaderData(). (Closed)
Patch Set: rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/spdy/mock_spdy_framer_visitor.h ('k') | net/spdy/spdy_framer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/spdy/spdy_deframer_visitor.h" 5 #include "net/spdy/spdy_deframer_visitor.h"
6 6
7 #include <stdlib.h> 7 #include <stdlib.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // as in SpdyFramerVisitorInterface. 138 // as in SpdyFramerVisitorInterface.
139 void OnAltSvc(SpdyStreamId stream_id, 139 void OnAltSvc(SpdyStreamId stream_id,
140 StringPiece origin, 140 StringPiece origin,
141 const SpdyAltSvcWireFormat::AlternativeServiceVector& 141 const SpdyAltSvcWireFormat::AlternativeServiceVector&
142 altsvc_vector) override; 142 altsvc_vector) override;
143 void OnBlocked(SpdyStreamId stream_id) override; 143 void OnBlocked(SpdyStreamId stream_id) override;
144 void OnContinuation(SpdyStreamId stream_id, bool end) override; 144 void OnContinuation(SpdyStreamId stream_id, bool end) override;
145 SpdyHeadersHandlerInterface* OnHeaderFrameStart( 145 SpdyHeadersHandlerInterface* OnHeaderFrameStart(
146 SpdyStreamId stream_id) override; 146 SpdyStreamId stream_id) override;
147 void OnHeaderFrameEnd(SpdyStreamId stream_id, bool end_headers) override; 147 void OnHeaderFrameEnd(SpdyStreamId stream_id, bool end_headers) override;
148 bool OnControlFrameHeaderData(SpdyStreamId stream_id,
149 const char* header_data,
150 size_t header_data_len) override;
151 void OnDataFrameHeader(SpdyStreamId stream_id, 148 void OnDataFrameHeader(SpdyStreamId stream_id,
152 size_t length, 149 size_t length,
153 bool fin) override; 150 bool fin) override;
154 void OnError(SpdyFramer* framer) override; 151 void OnError(SpdyFramer* framer) override;
155 void OnGoAway(SpdyStreamId last_accepted_stream_id, 152 void OnGoAway(SpdyStreamId last_accepted_stream_id,
156 SpdyGoAwayStatus status) override; 153 SpdyGoAwayStatus status) override;
157 bool OnGoAwayFrameData(const char* goaway_data, size_t len) override; 154 bool OnGoAwayFrameData(const char* goaway_data, size_t len) override;
158 void OnHeaders(SpdyStreamId stream_id, 155 void OnHeaders(SpdyStreamId stream_id,
159 bool has_priority, 156 bool has_priority,
160 int weight, 157 int weight,
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 CHECK_EQ(frame_type_, UNSET) << " frame_type_=" 458 CHECK_EQ(frame_type_, UNSET) << " frame_type_="
462 << Http2FrameTypeToString(frame_type_); 459 << Http2FrameTypeToString(frame_type_);
463 CHECK_GT(stream_id, 0u); 460 CHECK_GT(stream_id, 0u);
464 CHECK_NE(nullptr, headers_.get()); 461 CHECK_NE(nullptr, headers_.get());
465 frame_type_ = CONTINUATION; 462 frame_type_ = CONTINUATION;
466 463
467 stream_id_ = stream_id; 464 stream_id_ = stream_id;
468 end_ = end; 465 end_ = end;
469 } 466 }
470 467
471 // Called with the decompressed contents of headers, in zero or more pieces
472 // (i.e. an empty headers frame doesn't have any non-zero length data).
473 // Note that the end of the headers is indicated by header_data==nullptr
474 // AND header_data_len==0, even if there were no non-zero pieces.
475 // SpdyHeadersBlockParser decodes these.
476 // Returning false kills the connection (SpdyFramer enters state SPDY_ERROR).
477 bool SpdyTestDeframerImpl::OnControlFrameHeaderData(SpdyStreamId stream_id,
478 const char* header_data,
479 size_t header_data_len) {
480 DVLOG(1) << "OnControlFrameHeaderData stream_id: " << stream_id
481 << " len: " << header_data_len;
482 CHECK(frame_type_ == HEADERS || frame_type_ == CONTINUATION ||
483 frame_type_ == PUSH_PROMISE)
484 << " frame_type_=" << Http2FrameTypeToString(frame_type_);
485 CHECK_EQ(stream_id_, stream_id);
486 LOG(FATAL) << "Must call SpdyFramer::set_use_new_methods_for_test(true)";
487 return true;
488 }
489
490 // Note that length includes the padding length (0 to 256, when the optional 468 // Note that length includes the padding length (0 to 256, when the optional
491 // padding length field is counted). Padding comes after the payload, both 469 // padding length field is counted). Padding comes after the payload, both
492 // for DATA frames and for control frames. 470 // for DATA frames and for control frames.
493 void SpdyTestDeframerImpl::OnDataFrameHeader(SpdyStreamId stream_id, 471 void SpdyTestDeframerImpl::OnDataFrameHeader(SpdyStreamId stream_id,
494 size_t length, 472 size_t length,
495 bool fin) { 473 bool fin) {
496 DVLOG(1) << "OnDataFrameHeader stream_id: " << stream_id; 474 DVLOG(1) << "OnDataFrameHeader stream_id: " << stream_id;
497 CHECK_EQ(frame_type_, UNSET) << " frame_type_=" 475 CHECK_EQ(frame_type_, UNSET) << " frame_type_="
498 << Http2FrameTypeToString(frame_type_); 476 << Http2FrameTypeToString(frame_type_);
499 CHECK_GT(stream_id, 0u); 477 CHECK_GT(stream_id, 0u);
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 // The SpdyFramer will not process any more data at this point. 1081 // The SpdyFramer will not process any more data at this point.
1104 void DeframerCallbackCollector::OnError(SpdyFramer* framer, 1082 void DeframerCallbackCollector::OnError(SpdyFramer* framer,
1105 SpdyTestDeframer* deframer) { 1083 SpdyTestDeframer* deframer) {
1106 CollectedFrame cf; 1084 CollectedFrame cf;
1107 cf.error_reported = true; 1085 cf.error_reported = true;
1108 collected_frames_->push_back(std::move(cf)); 1086 collected_frames_->push_back(std::move(cf));
1109 } 1087 }
1110 1088
1111 } // namespace test 1089 } // namespace test
1112 } // namespace net 1090 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/mock_spdy_framer_visitor.h ('k') | net/spdy/spdy_framer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698