| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_WEBSOCKETS_WEBSOCKET_INFLATER_H_ | 5 #ifndef NET_WEBSOCKETS_WEBSOCKET_INFLATER_H_ |
| 6 #define NET_WEBSOCKETS_WEBSOCKET_INFLATER_H_ | 6 #define NET_WEBSOCKETS_WEBSOCKET_INFLATER_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 scoped_refptr<IOBufferWithSize> GetOutput(size_t size); | 59 scoped_refptr<IOBufferWithSize> GetOutput(size_t size); |
| 60 | 60 |
| 61 // Returns the size of the current inflated output. | 61 // Returns the size of the current inflated output. |
| 62 size_t CurrentOutputSize() const { return output_buffer_.Size(); } | 62 size_t CurrentOutputSize() const { return output_buffer_.Size(); } |
| 63 | 63 |
| 64 static const size_t kDefaultBufferCapacity = 512; | 64 static const size_t kDefaultBufferCapacity = 512; |
| 65 static const size_t kDefaultInputIOBufferCapacity = 512; | 65 static const size_t kDefaultInputIOBufferCapacity = 512; |
| 66 | 66 |
| 67 private: | 67 private: |
| 68 // Ring buffer with fixed capacity. | 68 // Ring buffer with fixed capacity. |
| 69 class OutputBuffer { | 69 class NET_EXPORT_PRIVATE OutputBuffer { |
| 70 public: | 70 public: |
| 71 explicit OutputBuffer(size_t capacity); | 71 explicit OutputBuffer(size_t capacity); |
| 72 ~OutputBuffer(); | 72 ~OutputBuffer(); |
| 73 | 73 |
| 74 size_t Size() const; | 74 size_t Size() const; |
| 75 // Returns (tail pointer, availabe size). | 75 // Returns (tail pointer, availabe size). |
| 76 // A user can push data to the queue by writing the data to | 76 // A user can push data to the queue by writing the data to |
| 77 // the area returned by this function and calling AdvanceTail. | 77 // the area returned by this function and calling AdvanceTail. |
| 78 std::pair<char*, size_t> GetTail(); | 78 std::pair<char*, size_t> GetTail(); |
| 79 void Read(char* dest, size_t size); | 79 void Read(char* dest, size_t size); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 scoped_ptr<z_stream_s> stream_; | 121 scoped_ptr<z_stream_s> stream_; |
| 122 InputQueue input_queue_; | 122 InputQueue input_queue_; |
| 123 OutputBuffer output_buffer_; | 123 OutputBuffer output_buffer_; |
| 124 | 124 |
| 125 DISALLOW_COPY_AND_ASSIGN(WebSocketInflater); | 125 DISALLOW_COPY_AND_ASSIGN(WebSocketInflater); |
| 126 }; | 126 }; |
| 127 | 127 |
| 128 } // namespace net | 128 } // namespace net |
| 129 | 129 |
| 130 #endif // NET_WEBSOCKETS_WEBSOCKET_INFLATER_H_ | 130 #endif // NET_WEBSOCKETS_WEBSOCKET_INFLATER_H_ |
| OLD | NEW |