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

Side by Side Diff: net/http2/decoder/payload_decoders/unknown_payload_decoder.cc

Issue 2554683003: Revert of Add new HTTP/2 and HPACK decoder in net/http2/. (Closed)
Patch Set: Created 4 years 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "net/http2/decoder/payload_decoders/unknown_payload_decoder.h"
6
7 #include <stddef.h>
8
9 #include "base/logging.h"
10 #include "net/http2/decoder/decode_buffer.h"
11 #include "net/http2/decoder/http2_frame_decoder_listener.h"
12 #include "net/http2/http2_constants.h"
13 #include "net/http2/http2_structures.h"
14
15 namespace net {
16
17 DecodeStatus UnknownPayloadDecoder::StartDecodingPayload(
18 FrameDecoderState* state,
19 DecodeBuffer* db) {
20 const Http2FrameHeader& frame_header = state->frame_header();
21
22 DVLOG(2) << "UnknownPayloadDecoder::StartDecodingPayload: " << frame_header;
23 DCHECK(!IsSupportedHttp2FrameType(frame_header.type)) << frame_header;
24 DCHECK_LE(db->Remaining(), frame_header.payload_length);
25
26 state->InitializeRemainders();
27 state->listener()->OnUnknownStart(frame_header);
28 return ResumeDecodingPayload(state, db);
29 }
30
31 DecodeStatus UnknownPayloadDecoder::ResumeDecodingPayload(
32 FrameDecoderState* state,
33 DecodeBuffer* db) {
34 DVLOG(2) << "UnknownPayloadDecoder::ResumeDecodingPayload "
35 << "remaining_payload=" << state->remaining_payload()
36 << "; db->Remaining=" << db->Remaining();
37 DCHECK(!IsSupportedHttp2FrameType(state->frame_header().type))
38 << state->frame_header();
39 DCHECK_LE(state->remaining_payload(), state->frame_header().payload_length);
40 DCHECK_LE(db->Remaining(), state->remaining_payload());
41
42 size_t avail = db->Remaining();
43 if (avail > 0) {
44 state->listener()->OnUnknownPayload(db->cursor(), avail);
45 db->AdvanceCursor(avail);
46 state->ConsumePayload(avail);
47 }
48 if (state->remaining_payload() == 0) {
49 state->listener()->OnUnknownEnd();
50 return DecodeStatus::kDecodeDone;
51 }
52 return DecodeStatus::kDecodeInProgress;
53 }
54
55 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698