OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_QUIC_QUIC_SPDY_DECOMPRESSOR_H_ | 5 #ifndef NET_QUIC_QUIC_SPDY_DECOMPRESSOR_H_ |
6 #define NET_QUIC_QUIC_SPDY_DECOMPRESSOR_H_ | 6 #define NET_QUIC_QUIC_SPDY_DECOMPRESSOR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/strings/string_piece.h" | 12 #include "base/strings/string_piece.h" |
13 #include "net/base/net_export.h" | 13 #include "net/base/net_export.h" |
14 #include "net/quic/quic_protocol.h" | 14 #include "net/quic/quic_protocol.h" |
15 #include "net/spdy/spdy_framer.h" | 15 #include "net/spdy/spdy_framer.h" |
16 | 16 |
17 namespace net { | 17 namespace net { |
18 | 18 |
19 class SpdyFramerVisitor; | 19 class SpdyFramerVisitor; |
20 | 20 |
21 // Handles the compression of request/response headers blocks. | 21 // Handles the compression of request/response headers blocks. |
22 class NET_EXPORT_PRIVATE QuicSpdyDecompressor { | 22 class NET_EXPORT_PRIVATE QuicSpdyDecompressor { |
23 public: | 23 public: |
24 // Interface that receives callbacks with decompressed data as it | 24 // Interface that receives callbacks with decompressed data as it |
25 // becomes available. | 25 // becomes available. |
26 class NET_EXPORT_PRIVATE Visitor { | 26 class NET_EXPORT_PRIVATE Visitor { |
27 public: | 27 public: |
28 virtual ~Visitor() {} | 28 virtual ~Visitor() {} |
29 virtual bool OnDecompressedData(base::StringPiece data) = 0; | 29 virtual bool OnDecompressedData(base::StringPiece data) = 0; |
| 30 virtual void OnDecompressionError() = 0; |
30 }; | 31 }; |
31 | 32 |
32 QuicSpdyDecompressor(); | 33 QuicSpdyDecompressor(); |
33 ~QuicSpdyDecompressor(); | 34 ~QuicSpdyDecompressor(); |
34 | 35 |
35 // Decompresses the data in |data| and invokes |OnDecompressedData|, | 36 // Decompresses the data in |data| and invokes |OnDecompressedData|, |
36 // possibly multiple times, on |visitor|. Returns number of bytes | 37 // possibly multiple times, on |visitor|. Returns number of bytes |
37 // consumed from |data|. | 38 // consumed from |data|. |
38 size_t DecompressData(base::StringPiece data, Visitor* visitor); | 39 size_t DecompressData(base::StringPiece data, Visitor* visitor); |
39 | 40 |
(...skipping 15 matching lines...) Expand all Loading... |
55 std::string compressed_size_buffer_; | 56 std::string compressed_size_buffer_; |
56 // Number of compressed bytes consumed, out of the total in | 57 // Number of compressed bytes consumed, out of the total in |
57 // |current_compressed_size_|. | 58 // |current_compressed_size_|. |
58 uint32 compressed_bytes_consumed_; | 59 uint32 compressed_bytes_consumed_; |
59 DISALLOW_COPY_AND_ASSIGN(QuicSpdyDecompressor); | 60 DISALLOW_COPY_AND_ASSIGN(QuicSpdyDecompressor); |
60 }; | 61 }; |
61 | 62 |
62 } // namespace net | 63 } // namespace net |
63 | 64 |
64 #endif // NET_QUIC_QUIC_SPDY_DECOMPRESSOR_H_ | 65 #endif // NET_QUIC_QUIC_SPDY_DECOMPRESSOR_H_ |
OLD | NEW |