Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Side by Side Diff: net/quic/quic_spdy_decompressor.h

Issue 14651009: Land Recent QUIC changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix integer constant is too large for 'unsigned long' type Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/quic/quic_spdy_compressor_test.cc ('k') | net/quic/quic_spdy_decompressor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef NET_QUIC_QUIC_SPDY_DECOMPRESSOR_H_
6 #define NET_QUIC_QUIC_SPDY_DECOMPRESSOR_H_
7
8 #include <string>
9
10 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "base/strings/string_piece.h"
13 #include "net/base/net_export.h"
14 #include "net/quic/quic_protocol.h"
15 #include "net/spdy/spdy_framer.h"
16
17 namespace net {
18
19 class SpdyFramerVisitor;
20
21 // Handles the compression of request/response headers blocks.
22 class NET_EXPORT_PRIVATE QuicSpdyDecompressor {
23 public:
24 // Interface that receives callbacks with decompressed data as it
25 // becomes available.
26 class NET_EXPORT_PRIVATE Visitor {
27 public:
28 virtual ~Visitor() {}
29 virtual bool OnDecompressedData(base::StringPiece data) = 0;
30 };
31
32 QuicSpdyDecompressor();
33 ~QuicSpdyDecompressor();
34
35 // Decompresses the data in |data| and invokes |OnDecompressedData|,
36 // possibly multiple times, on |visitor|. Returns number of bytes
37 // consumed from |data|.
38 size_t DecompressData(base::StringPiece data, Visitor* visitor);
39
40 QuicHeaderId current_header_id() { return current_header_id_; }
41
42 private:
43 void ResetForNextHeaders();
44
45 SpdyFramer spdy_framer_;
46 scoped_ptr<SpdyFramerVisitor> spdy_visitor_;
47 // ID of the header currently being parsed.
48 QuicHeaderId current_header_id_;
49 // True when the size of the headers has been parsed.
50 bool has_current_compressed_size_;
51 // Size of the headers being parsed.
52 uint32 current_compressed_size_;
53 // Buffer into which the partial compressed size is written until
54 // it is fully parsed.
55 std::string compressed_size_buffer_;
56 // Number of compressed bytes consumed, out of the total in
57 // |current_compressed_size_|.
58 uint32 compressed_bytes_consumed_;
59 DISALLOW_COPY_AND_ASSIGN(QuicSpdyDecompressor);
60 };
61
62 } // namespace net
63
64 #endif // NET_QUIC_QUIC_SPDY_DECOMPRESSOR_H_
OLDNEW
« no previous file with comments | « net/quic/quic_spdy_compressor_test.cc ('k') | net/quic/quic_spdy_decompressor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698