OLD | NEW |
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/http2/decoder/payload_decoders/ping_payload_decoder.h" | 5 #include "net/http2/decoder/payload_decoders/ping_payload_decoder.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "net/http2/decoder/http2_frame_decoder_listener.h" | 8 #include "net/http2/decoder/http2_frame_decoder_listener.h" |
9 #include "net/http2/http2_constants.h" | 9 #include "net/http2/http2_constants.h" |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 // Given the size of the header and payload (17 bytes total), this is most | 27 // Given the size of the header and payload (17 bytes total), this is most |
28 // likely the case the vast majority of the time. | 28 // likely the case the vast majority of the time. |
29 if (db->Remaining() == kOpaqueSize && total_length == kOpaqueSize) { | 29 if (db->Remaining() == kOpaqueSize && total_length == kOpaqueSize) { |
30 // Special case this situation as it allows us to avoid any copying; | 30 // Special case this situation as it allows us to avoid any copying; |
31 // the other path makes two copies, first into the buffer in | 31 // the other path makes two copies, first into the buffer in |
32 // Http2StructureDecoder as it accumulates the 8 bytes of opaque data, | 32 // Http2StructureDecoder as it accumulates the 8 bytes of opaque data, |
33 // and a second copy into the Http2PingFields member of in this class. | 33 // and a second copy into the Http2PingFields member of in this class. |
34 // This supports the claim that this decoder is (mostly) non-buffering. | 34 // This supports the claim that this decoder is (mostly) non-buffering. |
35 static_assert(sizeof(Http2PingFields) == kOpaqueSize, | 35 static_assert(sizeof(Http2PingFields) == kOpaqueSize, |
36 "If not, then can't enter this block!"); | 36 "If not, then can't enter this block!"); |
37 auto ping = reinterpret_cast<const Http2PingFields*>(db->cursor()); | 37 auto* ping = reinterpret_cast<const Http2PingFields*>(db->cursor()); |
38 if (frame_header.IsAck()) { | 38 if (frame_header.IsAck()) { |
39 state->listener()->OnPingAck(frame_header, *ping); | 39 state->listener()->OnPingAck(frame_header, *ping); |
40 } else { | 40 } else { |
41 state->listener()->OnPing(frame_header, *ping); | 41 state->listener()->OnPing(frame_header, *ping); |
42 } | 42 } |
43 db->AdvanceCursor(kOpaqueSize); | 43 db->AdvanceCursor(kOpaqueSize); |
44 return DecodeStatus::kDecodeDone; | 44 return DecodeStatus::kDecodeDone; |
45 } | 45 } |
46 state->InitializeRemainders(); | 46 state->InitializeRemainders(); |
47 return HandleStatus( | 47 return HandleStatus( |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 DCHECK( | 80 DCHECK( |
81 (status == DecodeStatus::kDecodeInProgress && | 81 (status == DecodeStatus::kDecodeInProgress && |
82 state->remaining_payload() > 0) || | 82 state->remaining_payload() > 0) || |
83 (status == DecodeStatus::kDecodeError && state->remaining_payload() == 0)) | 83 (status == DecodeStatus::kDecodeError && state->remaining_payload() == 0)) |
84 << "\n status=" << status | 84 << "\n status=" << status |
85 << "; remaining_payload=" << state->remaining_payload(); | 85 << "; remaining_payload=" << state->remaining_payload(); |
86 return status; | 86 return status; |
87 } | 87 } |
88 | 88 |
89 } // namespace net | 89 } // namespace net |
OLD | NEW |