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

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

Issue 2130153002: Clean up max_frame_size related constants, move storage of setting to the framer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a typo in net/spdy/spdy_protocol.h. Created 4 years, 5 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/spdy_protocol.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "net/spdy/spdy_bug_tracker.h" 8 #include "net/spdy/spdy_bug_tracker.h"
9 9
10 namespace net { 10 namespace net {
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 return 13; 684 return 13;
685 default: 685 default:
686 SPDY_BUG << "Serializing unhandled GOAWAY status " << status; 686 SPDY_BUG << "Serializing unhandled GOAWAY status " << status;
687 return -1; 687 return -1;
688 } 688 }
689 } 689 }
690 SPDY_BUG << "Unknown SpdyMajorVersion " << version; 690 SPDY_BUG << "Unknown SpdyMajorVersion " << version;
691 return -1; 691 return -1;
692 } 692 }
693 693
694 size_t SpdyConstants::GetDataFrameMinimumSize(SpdyMajorVersion version) { 694 size_t SpdyConstants::GetFrameHeaderSize(SpdyMajorVersion version) {
695 switch (version) { 695 switch (version) {
696 case SPDY3: 696 case SPDY3:
697 return 8; 697 return 8;
698 case HTTP2: 698 case HTTP2:
699 return 9; 699 return 9;
700 } 700 }
701 SPDY_BUG << "Unhandled SPDY version."; 701 SPDY_BUG << "Unhandled SPDY version.";
702 return 0; 702 return 0;
703 } 703 }
704 704
705 size_t SpdyConstants::GetDataFrameMinimumSize(SpdyMajorVersion version) {
706 return GetFrameHeaderSize(version);
707 }
708
705 size_t SpdyConstants::GetControlFrameHeaderSize(SpdyMajorVersion version) { 709 size_t SpdyConstants::GetControlFrameHeaderSize(SpdyMajorVersion version) {
706 switch (version) { 710 return GetFrameHeaderSize(version);
707 case SPDY3:
708 return 8;
709 case HTTP2:
710 return 9;
711 }
712 SPDY_BUG << "Unhandled SPDY version.";
713 return 0;
714 } 711 }
715 712
716 size_t SpdyConstants::GetPrefixLength(SpdyFrameType type, 713 size_t SpdyConstants::GetPrefixLength(SpdyFrameType type,
717 SpdyMajorVersion version) { 714 SpdyMajorVersion version) {
718 if (type != DATA) { 715 return GetFrameHeaderSize(version);
719 return GetControlFrameHeaderSize(version);
720 } else {
721 return GetDataFrameMinimumSize(version);
722 }
723 } 716 }
724 717
725 size_t SpdyConstants::GetFrameMaximumSize(SpdyMajorVersion version) { 718 size_t SpdyConstants::GetMaxFrameSizeLimit(SpdyMajorVersion version) {
726 if (version == SPDY3) { 719 return kSpdyMaxFrameSizeLimit + GetFrameHeaderSize(version);
727 // 24-bit length field plus eight-byte frame header.
728 return ((1 << 24) - 1) + 8;
729 } else {
730 // Max payload of 2^14 plus nine-byte frame header.
731 // TODO(dahollings): Change this to the actual spec
732 // max of (1 << 24) - 1 + 9.
733 return (1 << 14) + 9;
734 }
735 } 720 }
736 721
737 size_t SpdyConstants::GetSizeOfSizeField() { 722 size_t SpdyConstants::GetSizeOfSizeField() {
738 return sizeof(uint32_t); 723 return sizeof(uint32_t);
739 } 724 }
740 725
741 size_t SpdyConstants::GetPerHeaderOverhead(SpdyMajorVersion version) { 726 size_t SpdyConstants::GetPerHeaderOverhead(SpdyMajorVersion version) {
742 return (version == net::HTTP2) ? 32 : 0; 727 return (version == net::HTTP2) ? 32 : 0;
743 } 728 }
744 729
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 875
891 void SpdyAltSvcIR::Visit(SpdyFrameVisitor* visitor) const { 876 void SpdyAltSvcIR::Visit(SpdyFrameVisitor* visitor) const {
892 return visitor->VisitAltSvc(*this); 877 return visitor->VisitAltSvc(*this);
893 } 878 }
894 879
895 void SpdyPriorityIR::Visit(SpdyFrameVisitor* visitor) const { 880 void SpdyPriorityIR::Visit(SpdyFrameVisitor* visitor) const {
896 return visitor->VisitPriority(*this); 881 return visitor->VisitPriority(*this);
897 } 882 }
898 883
899 } // namespace net 884 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_protocol.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698