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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_spdy_decompressor.h
diff --git a/net/quic/quic_spdy_decompressor.h b/net/quic/quic_spdy_decompressor.h
new file mode 100644
index 0000000000000000000000000000000000000000..3fd50783055c3c295cbfea8e0c579ca2f6a254e7
--- /dev/null
+++ b/net/quic/quic_spdy_decompressor.h
@@ -0,0 +1,64 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef NET_QUIC_QUIC_SPDY_DECOMPRESSOR_H_
+#define NET_QUIC_QUIC_SPDY_DECOMPRESSOR_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/strings/string_piece.h"
+#include "net/base/net_export.h"
+#include "net/quic/quic_protocol.h"
+#include "net/spdy/spdy_framer.h"
+
+namespace net {
+
+class SpdyFramerVisitor;
+
+// Handles the compression of request/response headers blocks.
+class NET_EXPORT_PRIVATE QuicSpdyDecompressor {
+ public:
+ // Interface that receives callbacks with decompressed data as it
+ // becomes available.
+ class NET_EXPORT_PRIVATE Visitor {
+ public:
+ virtual ~Visitor() {}
+ virtual bool OnDecompressedData(base::StringPiece data) = 0;
+ };
+
+ QuicSpdyDecompressor();
+ ~QuicSpdyDecompressor();
+
+ // Decompresses the data in |data| and invokes |OnDecompressedData|,
+ // possibly multiple times, on |visitor|. Returns number of bytes
+ // consumed from |data|.
+ size_t DecompressData(base::StringPiece data, Visitor* visitor);
+
+ QuicHeaderId current_header_id() { return current_header_id_; }
+
+ private:
+ void ResetForNextHeaders();
+
+ SpdyFramer spdy_framer_;
+ scoped_ptr<SpdyFramerVisitor> spdy_visitor_;
+ // ID of the header currently being parsed.
+ QuicHeaderId current_header_id_;
+ // True when the size of the headers has been parsed.
+ bool has_current_compressed_size_;
+ // Size of the headers being parsed.
+ uint32 current_compressed_size_;
+ // Buffer into which the partial compressed size is written until
+ // it is fully parsed.
+ std::string compressed_size_buffer_;
+ // Number of compressed bytes consumed, out of the total in
+ // |current_compressed_size_|.
+ uint32 compressed_bytes_consumed_;
+ DISALLOW_COPY_AND_ASSIGN(QuicSpdyDecompressor);
+};
+
+} // namespace net
+
+#endif // NET_QUIC_QUIC_SPDY_DECOMPRESSOR_H_
« 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