| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_protocol.h" | 5 #include "net/spdy/spdy_protocol.h" |
| 6 | 6 |
| 7 namespace net { | 7 namespace net { |
| 8 | 8 |
| 9 SpdyFrameWithNameValueBlockIR::SpdyFrameWithNameValueBlockIR( | 9 SpdyFrameWithNameValueBlockIR::SpdyFrameWithNameValueBlockIR( |
| 10 SpdyStreamId stream_id) : SpdyFrameWithFinIR(stream_id) {} | 10 SpdyStreamId stream_id) : SpdyFrameWithFinIR(stream_id) {} |
| (...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 return 12; | 604 return 12; |
| 605 default: | 605 default: |
| 606 LOG(DFATAL) << "Serializing unhandled GOAWAY status " << status; | 606 LOG(DFATAL) << "Serializing unhandled GOAWAY status " << status; |
| 607 return -1; | 607 return -1; |
| 608 } | 608 } |
| 609 } | 609 } |
| 610 LOG(DFATAL) << "Unknown SpdyMajorVersion " << version; | 610 LOG(DFATAL) << "Unknown SpdyMajorVersion " << version; |
| 611 return -1; | 611 return -1; |
| 612 } | 612 } |
| 613 | 613 |
| 614 size_t SpdyConstants::GetDataFrameMinimumSize() { |
| 615 return 8; |
| 616 } |
| 617 |
| 618 size_t SpdyConstants::GetControlFrameHeaderSize(SpdyMajorVersion version) { |
| 619 switch (version) { |
| 620 case SPDY2: |
| 621 case SPDY3: |
| 622 case SPDY4: |
| 623 return 8; |
| 624 } |
| 625 LOG(DFATAL) << "Unhandled SPDY version."; |
| 626 return 0; |
| 627 } |
| 628 |
| 629 size_t SpdyConstants::GetPrefixLength(SpdyFrameType type, |
| 630 SpdyMajorVersion version) { |
| 631 if (type != DATA) { |
| 632 return GetControlFrameHeaderSize(version); |
| 633 } else { |
| 634 return GetDataFrameMinimumSize(); |
| 635 } |
| 636 } |
| 637 |
| 638 size_t SpdyConstants::GetFrameMaximumSize(SpdyMajorVersion version) { |
| 639 if (version < SPDY4) { |
| 640 // 24-bit length field plus eight-byte frame header. |
| 641 return ((1<<24) - 1) + 8; |
| 642 } else { |
| 643 // 14-bit length field. |
| 644 return (1<<14) - 1; |
| 645 } |
| 646 } |
| 647 |
| 614 void SpdyDataIR::Visit(SpdyFrameVisitor* visitor) const { | 648 void SpdyDataIR::Visit(SpdyFrameVisitor* visitor) const { |
| 615 return visitor->VisitData(*this); | 649 return visitor->VisitData(*this); |
| 616 } | 650 } |
| 617 | 651 |
| 618 void SpdySynStreamIR::Visit(SpdyFrameVisitor* visitor) const { | 652 void SpdySynStreamIR::Visit(SpdyFrameVisitor* visitor) const { |
| 619 return visitor->VisitSynStream(*this); | 653 return visitor->VisitSynStream(*this); |
| 620 } | 654 } |
| 621 | 655 |
| 622 void SpdySynReplyIR::Visit(SpdyFrameVisitor* visitor) const { | 656 void SpdySynReplyIR::Visit(SpdyFrameVisitor* visitor) const { |
| 623 return visitor->VisitSynReply(*this); | 657 return visitor->VisitSynReply(*this); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 | 717 |
| 684 void SpdyPushPromiseIR::Visit(SpdyFrameVisitor* visitor) const { | 718 void SpdyPushPromiseIR::Visit(SpdyFrameVisitor* visitor) const { |
| 685 return visitor->VisitPushPromise(*this); | 719 return visitor->VisitPushPromise(*this); |
| 686 } | 720 } |
| 687 | 721 |
| 688 void SpdyContinuationIR::Visit(SpdyFrameVisitor* visitor) const { | 722 void SpdyContinuationIR::Visit(SpdyFrameVisitor* visitor) const { |
| 689 return visitor->VisitContinuation(*this); | 723 return visitor->VisitContinuation(*this); |
| 690 } | 724 } |
| 691 | 725 |
| 692 } // namespace net | 726 } // namespace net |
| OLD | NEW |