| 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 #ifndef NET_SPDY_HPACK_ENCODER_H_ | 5 #ifndef NET_SPDY_HPACK_ENCODER_H_ |
| 6 #define NET_SPDY_HPACK_ENCODER_H_ | 6 #define NET_SPDY_HPACK_ENCODER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 friend class test::HpackEncoderPeer; | 28 friend class test::HpackEncoderPeer; |
| 29 | 29 |
| 30 explicit HpackEncoder(); | 30 explicit HpackEncoder(); |
| 31 ~HpackEncoder(); | 31 ~HpackEncoder(); |
| 32 | 32 |
| 33 // Encodes the given header set into the given string. Returns | 33 // Encodes the given header set into the given string. Returns |
| 34 // whether or not the encoding was successful. | 34 // whether or not the encoding was successful. |
| 35 bool EncodeHeaderSet(const std::map<std::string, std::string>& header_set, | 35 bool EncodeHeaderSet(const std::map<std::string, std::string>& header_set, |
| 36 std::string* output); | 36 std::string* output); |
| 37 | 37 |
| 38 // Sets externally-owned storage for aggregating character counts of emitted |
| 39 // literal representations. |
| 40 void SetCharCountsStorage(std::vector<size_t>* char_counts, |
| 41 size_t* total_char_counts); |
| 42 |
| 38 private: | 43 private: |
| 39 static void CookieToCrumbs(base::StringPiece cookie, | 44 static void CookieToCrumbs(base::StringPiece cookie, |
| 40 std::vector<base::StringPiece>* out); | 45 std::vector<base::StringPiece>* out); |
| 41 | 46 |
| 47 void UpdateCharacterCounts(base::StringPiece str); |
| 48 |
| 42 uint32 max_string_literal_size_; | 49 uint32 max_string_literal_size_; |
| 43 HpackEncodingContext context_; | 50 HpackEncodingContext context_; |
| 44 | 51 |
| 52 // Externally-owned, nullable storage for character counts of literals. |
| 53 std::vector<size_t>* char_counts_; |
| 54 size_t* total_char_counts_; |
| 55 |
| 45 DISALLOW_COPY_AND_ASSIGN(HpackEncoder); | 56 DISALLOW_COPY_AND_ASSIGN(HpackEncoder); |
| 46 }; | 57 }; |
| 47 | 58 |
| 48 } // namespace net | 59 } // namespace net |
| 49 | 60 |
| 50 #endif // NET_SPDY_HPACK_ENCODER_H_ | 61 #endif // NET_SPDY_HPACK_ENCODER_H_ |
| OLD | NEW |