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

Side by Side Diff: net/spdy/core/spdy_protocol.h

Issue 2895993003: Misc cleanup in net/spdy/core. (Closed)
Patch Set: Rebase. Created 3 years, 6 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
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 // This file contains some protocol structures for use with SPDY 3 and HTTP 2 5 // This file contains some protocol structures for use with SPDY 3 and HTTP 2
6 // The SPDY 3 spec can be found at: 6 // The SPDY 3 spec can be found at:
7 // http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3 7 // http://dev.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3
8 8
9 #ifndef NET_SPDY_CORE_SPDY_PROTOCOL_H_ 9 #ifndef NET_SPDY_CORE_SPDY_PROTOCOL_H_
10 #define NET_SPDY_CORE_SPDY_PROTOCOL_H_ 10 #define NET_SPDY_CORE_SPDY_PROTOCOL_H_
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 ERROR_CODE_ENHANCE_YOUR_CALM = 0xb, 176 ERROR_CODE_ENHANCE_YOUR_CALM = 0xb,
177 ERROR_CODE_INADEQUATE_SECURITY = 0xc, 177 ERROR_CODE_INADEQUATE_SECURITY = 0xc,
178 ERROR_CODE_HTTP_1_1_REQUIRED = 0xd, 178 ERROR_CODE_HTTP_1_1_REQUIRED = 0xd,
179 ERROR_CODE_MAX = ERROR_CODE_HTTP_1_1_REQUIRED 179 ERROR_CODE_MAX = ERROR_CODE_HTTP_1_1_REQUIRED
180 }; 180 };
181 181
182 // A SPDY priority is a number between 0 and 7 (inclusive). 182 // A SPDY priority is a number between 0 and 7 (inclusive).
183 typedef uint8_t SpdyPriority; 183 typedef uint8_t SpdyPriority;
184 184
185 // Lowest and Highest here refer to SPDY priorities as described in 185 // Lowest and Highest here refer to SPDY priorities as described in
186
187 // https://www.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3-1#TOC-2.3.3- Stream-priority 186 // https://www.chromium.org/spdy/spdy-protocol/spdy-protocol-draft3-1#TOC-2.3.3- Stream-priority
188 const SpdyPriority kV3HighestPriority = 0; 187 const SpdyPriority kV3HighestPriority = 0;
189 const SpdyPriority kV3LowestPriority = 7; 188 const SpdyPriority kV3LowestPriority = 7;
190 189
191 // Returns SPDY 3.x priority value clamped to the valid range of [0, 7]. 190 // Returns SPDY 3.x priority value clamped to the valid range of [0, 7].
192 SPDY_EXPORT_PRIVATE SpdyPriority ClampSpdy3Priority(SpdyPriority priority); 191 SPDY_EXPORT_PRIVATE SpdyPriority ClampSpdy3Priority(SpdyPriority priority);
193 192
194 // HTTP/2 stream weights are integers in range [1, 256], as specified in RFC 193 // HTTP/2 stream weights are integers in range [1, 256], as specified in RFC
195 // 7540 section 5.3.2. Default stream weight is defined in section 5.3.5. 194 // 7540 section 5.3.2. Default stream weight is defined in section 5.3.5.
196 const int kHttp2MinStreamWeight = 1; 195 const int kHttp2MinStreamWeight = 1;
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 class SPDY_EXPORT_PRIVATE SpdySettingsIR : public SpdyFrameIR { 532 class SPDY_EXPORT_PRIVATE SpdySettingsIR : public SpdyFrameIR {
534 public: 533 public:
535 SpdySettingsIR(); 534 SpdySettingsIR();
536 ~SpdySettingsIR() override; 535 ~SpdySettingsIR() override;
537 536
538 // Overwrites as appropriate. 537 // Overwrites as appropriate.
539 const SettingsMap& values() const { return values_; } 538 const SettingsMap& values() const { return values_; }
540 void AddSetting(SpdySettingsIds id, int32_t value) { values_[id] = value; } 539 void AddSetting(SpdySettingsIds id, int32_t value) { values_[id] = value; }
541 540
542 bool is_ack() const { return is_ack_; } 541 bool is_ack() const { return is_ack_; }
543 void set_is_ack(bool is_ack) { 542 void set_is_ack(bool is_ack) { is_ack_ = is_ack; }
544 is_ack_ = is_ack;
545 }
546 543
547 void Visit(SpdyFrameVisitor* visitor) const override; 544 void Visit(SpdyFrameVisitor* visitor) const override;
548 545
549 SpdyFrameType frame_type() const override; 546 SpdyFrameType frame_type() const override;
550 547
551 private: 548 private:
552 SettingsMap values_; 549 SettingsMap values_;
553 bool is_ack_; 550 bool is_ack_;
554 551
555 DISALLOW_COPY_AND_ASSIGN(SpdySettingsIR); 552 DISALLOW_COPY_AND_ASSIGN(SpdySettingsIR);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 SpdyErrorCode error_code, 585 SpdyErrorCode error_code,
589 const char* description); 586 const char* description);
590 587
591 // Moves description into description_store_, so caller doesn't need to 588 // Moves description into description_store_, so caller doesn't need to
592 // keep description live after constructing this SpdyGoAwayIR. 589 // keep description live after constructing this SpdyGoAwayIR.
593 SpdyGoAwayIR(SpdyStreamId last_good_stream_id, 590 SpdyGoAwayIR(SpdyStreamId last_good_stream_id,
594 SpdyErrorCode error_code, 591 SpdyErrorCode error_code,
595 SpdyString description); 592 SpdyString description);
596 593
597 ~SpdyGoAwayIR() override; 594 ~SpdyGoAwayIR() override;
595
598 SpdyStreamId last_good_stream_id() const { return last_good_stream_id_; } 596 SpdyStreamId last_good_stream_id() const { return last_good_stream_id_; }
599 void set_last_good_stream_id(SpdyStreamId last_good_stream_id) { 597 void set_last_good_stream_id(SpdyStreamId last_good_stream_id) {
600 DCHECK_EQ(0u, last_good_stream_id & ~kStreamIdMask); 598 DCHECK_EQ(0u, last_good_stream_id & ~kStreamIdMask);
601 last_good_stream_id_ = last_good_stream_id; 599 last_good_stream_id_ = last_good_stream_id;
602 } 600 }
603 SpdyErrorCode error_code() const { return error_code_; } 601 SpdyErrorCode error_code() const { return error_code_; }
604 void set_error_code(SpdyErrorCode error_code) { 602 void set_error_code(SpdyErrorCode error_code) {
605 // TODO(hkhalil): Check valid ranges of error_code? 603 // TODO(hkhalil): Check valid ranges of error_code?
606 error_code_ = error_code; 604 error_code_ = error_code;
607 } 605 }
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 class SPDY_EXPORT_PRIVATE SpdyContinuationIR : public SpdyFrameIR { 722 class SPDY_EXPORT_PRIVATE SpdyContinuationIR : public SpdyFrameIR {
725 public: 723 public:
726 explicit SpdyContinuationIR(SpdyStreamId stream_id); 724 explicit SpdyContinuationIR(SpdyStreamId stream_id);
727 ~SpdyContinuationIR() override; 725 ~SpdyContinuationIR() override;
728 726
729 void Visit(SpdyFrameVisitor* visitor) const override; 727 void Visit(SpdyFrameVisitor* visitor) const override;
730 728
731 SpdyFrameType frame_type() const override; 729 SpdyFrameType frame_type() const override;
732 730
733 bool end_headers() const { return end_headers_; } 731 bool end_headers() const { return end_headers_; }
734 void set_end_headers(bool end_headers) {end_headers_ = end_headers;} 732 void set_end_headers(bool end_headers) { end_headers_ = end_headers; }
735 const SpdyString& encoding() const { return *encoding_; } 733 const SpdyString& encoding() const { return *encoding_; }
736 void take_encoding(std::unique_ptr<SpdyString> encoding) { 734 void take_encoding(std::unique_ptr<SpdyString> encoding) {
737 encoding_ = std::move(encoding); 735 encoding_ = std::move(encoding);
738 } 736 }
739 737
740 private: 738 private:
741 std::unique_ptr<SpdyString> encoding_; 739 std::unique_ptr<SpdyString> encoding_;
742 bool end_headers_; 740 bool end_headers_;
743 DISALLOW_COPY_AND_ASSIGN(SpdyContinuationIR); 741 DISALLOW_COPY_AND_ASSIGN(SpdyContinuationIR);
744 }; 742 };
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 SpdyFrameVisitor() {} 891 SpdyFrameVisitor() {}
894 virtual ~SpdyFrameVisitor() {} 892 virtual ~SpdyFrameVisitor() {}
895 893
896 private: 894 private:
897 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor); 895 DISALLOW_COPY_AND_ASSIGN(SpdyFrameVisitor);
898 }; 896 };
899 897
900 } // namespace net 898 } // namespace net
901 899
902 #endif // NET_SPDY_CORE_SPDY_PROTOCOL_H_ 900 #endif // NET_SPDY_CORE_SPDY_PROTOCOL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698