| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/core/hpack/hpack_input_stream.h" | 5 #include "net/spdy/core/hpack/hpack_input_stream.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "net/spdy/core/hpack/hpack_huffman_decoder.h" | 10 #include "net/spdy/core/hpack/hpack_huffman_decoder.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 need_more_data_ = true; | 147 need_more_data_ = true; |
| 148 DVLOG(1) << "HpackInputStream::DecodeNextHuffmanString " << encoded_size | 148 DVLOG(1) << "HpackInputStream::DecodeNextHuffmanString " << encoded_size |
| 149 << " > " << buffer_.size(); | 149 << " > " << buffer_.size(); |
| 150 return false; | 150 return false; |
| 151 } | 151 } |
| 152 | 152 |
| 153 HpackInputStream bounded_reader(buffer_.substr(0, encoded_size)); | 153 HpackInputStream bounded_reader(buffer_.substr(0, encoded_size)); |
| 154 buffer_.remove_prefix(encoded_size); | 154 buffer_.remove_prefix(encoded_size); |
| 155 parsed_bytes_current_ += encoded_size; | 155 parsed_bytes_current_ += encoded_size; |
| 156 | 156 |
| 157 return HpackHuffmanDecoder::DecodeString(&bounded_reader, str); | 157 return SpdyHpackHuffmanDecoder::DecodeString(&bounded_reader, str); |
| 158 } | 158 } |
| 159 | 159 |
| 160 bool HpackInputStream::PeekBits(size_t* peeked_count, uint32_t* out) const { | 160 bool HpackInputStream::PeekBits(size_t* peeked_count, uint32_t* out) const { |
| 161 size_t byte_offset = (bit_offset_ + *peeked_count) / 8; | 161 size_t byte_offset = (bit_offset_ + *peeked_count) / 8; |
| 162 size_t bit_offset = (bit_offset_ + *peeked_count) % 8; | 162 size_t bit_offset = (bit_offset_ + *peeked_count) % 8; |
| 163 | 163 |
| 164 if (*peeked_count >= 32 || byte_offset >= buffer_.size()) { | 164 if (*peeked_count >= 32 || byte_offset >= buffer_.size()) { |
| 165 return false; | 165 return false; |
| 166 } | 166 } |
| 167 // We'll read the minimum of the current byte remainder, | 167 // We'll read the minimum of the current byte remainder, |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 | 240 |
| 241 bool HpackInputStream::NeedMoreData() const { | 241 bool HpackInputStream::NeedMoreData() const { |
| 242 return need_more_data_; | 242 return need_more_data_; |
| 243 } | 243 } |
| 244 | 244 |
| 245 void HpackInputStream::MarkCurrentPosition() { | 245 void HpackInputStream::MarkCurrentPosition() { |
| 246 parsed_bytes_ = parsed_bytes_current_; | 246 parsed_bytes_ = parsed_bytes_current_; |
| 247 } | 247 } |
| 248 | 248 |
| 249 } // namespace net | 249 } // namespace net |
| OLD | NEW |