| 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/spdy/http2_frame_decoder_adapter.h" | 5 #include "net/spdy/http2_frame_decoder_adapter.h" |
| 6 | 6 |
| 7 // Logging policy: If an error in the input is detected, VLOG(n) is used so that | 7 // Logging policy: If an error in the input is detected, VLOG(n) is used so that |
| 8 // the option exists to debug the situation. Otherwise, this code mostly uses | 8 // the option exists to debug the situation. Otherwise, this code mostly uses |
| 9 // DVLOG so that the logging does not slow down production code when things are | 9 // DVLOG so that the logging does not slow down production code when things are |
| 10 // working OK. | 10 // working OK. |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 visitor()->OnStreamPadding(stream_id(), skipped_length); | 344 visitor()->OnStreamPadding(stream_id(), skipped_length); |
| 345 } else { | 345 } else { |
| 346 MaybeAnnounceEmptyFirstHpackFragment(); | 346 MaybeAnnounceEmptyFirstHpackFragment(); |
| 347 } | 347 } |
| 348 } | 348 } |
| 349 | 349 |
| 350 void OnRstStream(const Http2FrameHeader& header, | 350 void OnRstStream(const Http2FrameHeader& header, |
| 351 Http2ErrorCode http2_error_code) override { | 351 Http2ErrorCode http2_error_code) override { |
| 352 DVLOG(1) << "OnRstStream: " << header << "; code=" << http2_error_code; | 352 DVLOG(1) << "OnRstStream: " << header << "; code=" << http2_error_code; |
| 353 if (IsOkToStartFrame(header) && HasRequiredStreamId(header)) { | 353 if (IsOkToStartFrame(header) && HasRequiredStreamId(header)) { |
| 354 SpdyRstStreamStatus status = | 354 SpdyErrorCode error_code = |
| 355 ParseRstStreamStatus(static_cast<int>(http2_error_code)); | 355 ParseErrorCode(static_cast<uint32_t>(http2_error_code)); |
| 356 visitor()->OnRstStream(header.stream_id, status); | 356 visitor()->OnRstStream(header.stream_id, error_code); |
| 357 } | 357 } |
| 358 } | 358 } |
| 359 | 359 |
| 360 void OnSettingsStart(const Http2FrameHeader& header) override { | 360 void OnSettingsStart(const Http2FrameHeader& header) override { |
| 361 DVLOG(1) << "OnSettingsStart: " << header; | 361 DVLOG(1) << "OnSettingsStart: " << header; |
| 362 if (IsOkToStartFrame(header) && HasRequiredStreamIdZero(header)) { | 362 if (IsOkToStartFrame(header) && HasRequiredStreamIdZero(header)) { |
| 363 frame_header_ = header; | 363 frame_header_ = header; |
| 364 has_frame_header_ = true; | 364 has_frame_header_ = true; |
| 365 visitor()->OnSettings(0); | 365 visitor()->OnSettings(0); |
| 366 } | 366 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 visitor()->OnPing(ToSpdyPingId(ping), true); | 429 visitor()->OnPing(ToSpdyPingId(ping), true); |
| 430 } | 430 } |
| 431 } | 431 } |
| 432 | 432 |
| 433 void OnGoAwayStart(const Http2FrameHeader& header, | 433 void OnGoAwayStart(const Http2FrameHeader& header, |
| 434 const Http2GoAwayFields& goaway) override { | 434 const Http2GoAwayFields& goaway) override { |
| 435 DVLOG(1) << "OnGoAwayStart: " << header << "; goaway: " << goaway; | 435 DVLOG(1) << "OnGoAwayStart: " << header << "; goaway: " << goaway; |
| 436 if (IsOkToStartFrame(header) && HasRequiredStreamIdZero(header)) { | 436 if (IsOkToStartFrame(header) && HasRequiredStreamIdZero(header)) { |
| 437 frame_header_ = header; | 437 frame_header_ = header; |
| 438 has_frame_header_ = true; | 438 has_frame_header_ = true; |
| 439 SpdyGoAwayStatus status = | 439 SpdyErrorCode error_code = |
| 440 ParseGoAwayStatus(static_cast<int>(goaway.error_code)); | 440 ParseErrorCode(static_cast<uint32_t>(goaway.error_code)); |
| 441 visitor()->OnGoAway(goaway.last_stream_id, status); | 441 visitor()->OnGoAway(goaway.last_stream_id, error_code); |
| 442 } | 442 } |
| 443 } | 443 } |
| 444 | 444 |
| 445 void OnGoAwayOpaqueData(const char* data, size_t len) override { | 445 void OnGoAwayOpaqueData(const char* data, size_t len) override { |
| 446 DVLOG(1) << "OnGoAwayOpaqueData: len=" << len; | 446 DVLOG(1) << "OnGoAwayOpaqueData: len=" << len; |
| 447 visitor()->OnGoAwayFrameData(data, len); | 447 visitor()->OnGoAwayFrameData(data, len); |
| 448 } | 448 } |
| 449 | 449 |
| 450 void OnGoAwayEnd() override { | 450 void OnGoAwayEnd() override { |
| 451 DVLOG(1) << "OnGoAwayEnd"; | 451 DVLOG(1) << "OnGoAwayEnd"; |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 955 | 955 |
| 956 } // namespace | 956 } // namespace |
| 957 | 957 |
| 958 std::unique_ptr<SpdyFramerDecoderAdapter> CreateHttp2FrameDecoderAdapter( | 958 std::unique_ptr<SpdyFramerDecoderAdapter> CreateHttp2FrameDecoderAdapter( |
| 959 SpdyFramer* outer_framer) { | 959 SpdyFramer* outer_framer) { |
| 960 return std::unique_ptr<SpdyFramerDecoderAdapter>( | 960 return std::unique_ptr<SpdyFramerDecoderAdapter>( |
| 961 new Http2DecoderAdapter(outer_framer)); | 961 new Http2DecoderAdapter(outer_framer)); |
| 962 } | 962 } |
| 963 | 963 |
| 964 } // namespace net | 964 } // namespace net |
| OLD | NEW |