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/buffered_spdy_framer.h" | 5 #include "net/spdy/buffered_spdy_framer.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace net { | 9 namespace net { |
10 | 10 |
11 SpdyMajorVersion NextProtoToSpdyMajorVersion(NextProto next_proto) { | 11 SpdyMajorVersion NextProtoToSpdyMajorVersion(NextProto next_proto) { |
12 switch (next_proto) { | 12 switch (next_proto) { |
13 case kProtoSPDY2: | 13 case kProtoSPDY2: |
14 case kProtoSPDY21: | |
15 return SPDY2; | 14 return SPDY2; |
16 case kProtoSPDY3: | 15 case kProtoSPDY3: |
17 case kProtoSPDY31: | 16 case kProtoSPDY31: |
18 return SPDY3; | 17 return SPDY3; |
19 // SPDY/4 and HTTP/2 share the same framing for now. | 18 // SPDY/4 and HTTP/2 share the same framing for now. |
20 case kProtoSPDY4a2: | 19 case kProtoSPDY4a2: |
21 case kProtoHTTP2Draft04: | 20 case kProtoHTTP2Draft04: |
22 return SPDY4; | 21 return SPDY4; |
23 case kProtoUnknown: | 22 case kProtoUnknown: |
24 case kProtoHTTP11: | 23 case kProtoHTTP11: |
25 case kProtoSPDY1: | |
26 case kProtoQUIC1SPDY3: | 24 case kProtoQUIC1SPDY3: |
27 break; | 25 break; |
28 } | 26 } |
29 NOTREACHED(); | 27 NOTREACHED(); |
30 return SPDY2; | 28 return SPDY2; |
31 } | 29 } |
32 | 30 |
33 BufferedSpdyFramer::BufferedSpdyFramer(SpdyMajorVersion version, | 31 BufferedSpdyFramer::BufferedSpdyFramer(SpdyMajorVersion version, |
34 bool enable_compression) | 32 bool enable_compression) |
35 : spdy_framer_(version), | 33 : spdy_framer_(version), |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 | 320 |
323 void BufferedSpdyFramer::InitHeaderStreaming(SpdyStreamId stream_id) { | 321 void BufferedSpdyFramer::InitHeaderStreaming(SpdyStreamId stream_id) { |
324 memset(header_buffer_, 0, kHeaderBufferSize); | 322 memset(header_buffer_, 0, kHeaderBufferSize); |
325 header_buffer_used_ = 0; | 323 header_buffer_used_ = 0; |
326 header_buffer_valid_ = true; | 324 header_buffer_valid_ = true; |
327 header_stream_id_ = stream_id; | 325 header_stream_id_ = stream_id; |
328 DCHECK_NE(header_stream_id_, SpdyFramer::kInvalidStream); | 326 DCHECK_NE(header_stream_id_, SpdyFramer::kInvalidStream); |
329 } | 327 } |
330 | 328 |
331 } // namespace net | 329 } // namespace net |
OLD | NEW |