| 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_HPACK_OUTPUT_STREAM_H_ | 5 #ifndef NET_SPDY_HPACK_HPACK_OUTPUT_STREAM_H_ |
| 6 #define NET_SPDY_HPACK_HPACK_OUTPUT_STREAM_H_ | 6 #define NET_SPDY_HPACK_HPACK_OUTPUT_STREAM_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 // Swaps the internal buffer with |output|, then resets state. | 52 // Swaps the internal buffer with |output|, then resets state. |
| 53 void TakeString(std::string* output); | 53 void TakeString(std::string* output); |
| 54 | 54 |
| 55 // Gives up to |max_size| bytes of the internal buffer to |output|. Resets | 55 // Gives up to |max_size| bytes of the internal buffer to |output|. Resets |
| 56 // internal state with the overflow. | 56 // internal state with the overflow. |
| 57 void BoundedTakeString(size_t max_size, std::string* output); | 57 void BoundedTakeString(size_t max_size, std::string* output); |
| 58 | 58 |
| 59 // Size in bytes of stream's internal buffer. | 59 // Size in bytes of stream's internal buffer. |
| 60 size_t size() const { return buffer_.size(); } | 60 size_t size() const { return buffer_.size(); } |
| 61 | 61 |
| 62 // Returns the estimate of dynamically allocated memory in bytes. |
| 63 size_t EstimateMemoryUsage() const; |
| 64 |
| 62 private: | 65 private: |
| 63 // The internal bit buffer. | 66 // The internal bit buffer. |
| 64 std::string buffer_; | 67 std::string buffer_; |
| 65 | 68 |
| 66 // If 0, the buffer ends on a byte boundary. If non-zero, the buffer | 69 // If 0, the buffer ends on a byte boundary. If non-zero, the buffer |
| 67 // ends on the nth most significant bit. Guaranteed to be < 8. | 70 // ends on the nth most significant bit. Guaranteed to be < 8. |
| 68 size_t bit_offset_; | 71 size_t bit_offset_; |
| 69 | 72 |
| 70 DISALLOW_COPY_AND_ASSIGN(HpackOutputStream); | 73 DISALLOW_COPY_AND_ASSIGN(HpackOutputStream); |
| 71 }; | 74 }; |
| 72 | 75 |
| 73 } // namespace net | 76 } // namespace net |
| 74 | 77 |
| 75 #endif // NET_SPDY_HPACK_HPACK_OUTPUT_STREAM_H_ | 78 #endif // NET_SPDY_HPACK_HPACK_OUTPUT_STREAM_H_ |
| OLD | NEW |