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_framer.h" | 5 #include "net/spdy/spdy_framer.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <iterator> | 10 #include <iterator> |
(...skipping 2943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2954 DCHECK_LT(SPDY3, protocol_version()); | 2954 DCHECK_LT(SPDY3, protocol_version()); |
2955 if (hpack_encoder_.get() == nullptr) { | 2955 if (hpack_encoder_.get() == nullptr) { |
2956 hpack_encoder_.reset(new HpackEncoder(ObtainHpackHuffmanTable())); | 2956 hpack_encoder_.reset(new HpackEncoder(ObtainHpackHuffmanTable())); |
2957 } | 2957 } |
2958 return hpack_encoder_.get(); | 2958 return hpack_encoder_.get(); |
2959 } | 2959 } |
2960 | 2960 |
2961 HpackDecoder* SpdyFramer::GetHpackDecoder() { | 2961 HpackDecoder* SpdyFramer::GetHpackDecoder() { |
2962 DCHECK_LT(SPDY3, protocol_version()); | 2962 DCHECK_LT(SPDY3, protocol_version()); |
2963 if (hpack_decoder_.get() == nullptr) { | 2963 if (hpack_decoder_.get() == nullptr) { |
2964 hpack_decoder_.reset(new HpackDecoder(ObtainHpackHuffmanTable())); | 2964 hpack_decoder_.reset(new HpackDecoder()); |
2965 } | 2965 } |
2966 return hpack_decoder_.get(); | 2966 return hpack_decoder_.get(); |
2967 } | 2967 } |
2968 | 2968 |
2969 uint8_t SpdyFramer::MapPriorityToWeight(SpdyPriority priority) { | 2969 uint8_t SpdyFramer::MapPriorityToWeight(SpdyPriority priority) { |
2970 const float kSteps = 255.9f / 7.f; | 2970 const float kSteps = 255.9f / 7.f; |
2971 return static_cast<uint8_t>(kSteps * (7.f - priority)); | 2971 return static_cast<uint8_t>(kSteps * (7.f - priority)); |
2972 } | 2972 } |
2973 | 2973 |
2974 SpdyPriority SpdyFramer::MapWeightToPriority(uint8_t weight) { | 2974 SpdyPriority SpdyFramer::MapWeightToPriority(uint8_t weight) { |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3143 #else | 3143 #else |
3144 WriteHeaderBlockToZ(&frame.header_block(), compressor); | 3144 WriteHeaderBlockToZ(&frame.header_block(), compressor); |
3145 #endif // defined(USE_SYSTEM_ZLIB) | 3145 #endif // defined(USE_SYSTEM_ZLIB) |
3146 | 3146 |
3147 int compressed_size = compressed_max_size - compressor->avail_out; | 3147 int compressed_size = compressed_max_size - compressor->avail_out; |
3148 builder->Seek(compressed_size); | 3148 builder->Seek(compressed_size); |
3149 builder->RewriteLength(*this); | 3149 builder->RewriteLength(*this); |
3150 } | 3150 } |
3151 | 3151 |
3152 } // namespace net | 3152 } // namespace net |
OLD | NEW |