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

Unified Diff: net/spdy/hpack_output_stream.cc

Issue 246073007: SPDY & HPACK: Land recent internal changes (through 65328503) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase on upstream change: Expanded FRAME_TOO_LARGE/FRAME_SIZE_ERROR comment. Created 6 years, 8 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/spdy/hpack_output_stream.h ('k') | net/spdy/hpack_output_stream_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/hpack_output_stream.cc
diff --git a/net/spdy/hpack_output_stream.cc b/net/spdy/hpack_output_stream.cc
index 529089222b5ea9e96bd543fb4c3593e8bea1f5cf..20f901d3b398c7f3f7df071daa101eb6f62410bb 100644
--- a/net/spdy/hpack_output_stream.cc
+++ b/net/spdy/hpack_output_stream.cc
@@ -6,43 +6,17 @@
#include "base/logging.h"
-using base::StringPiece;
namespace net {
+using base::StringPiece;
using std::string;
-HpackOutputStream::HpackOutputStream(uint32 max_string_literal_size)
- : max_string_literal_size_(max_string_literal_size),
- bit_offset_(0) {}
+HpackOutputStream::HpackOutputStream()
+ : bit_offset_(0) {}
HpackOutputStream::~HpackOutputStream() {}
-void HpackOutputStream::AppendIndexedHeader(uint32 index_or_zero) {
- AppendPrefix(kIndexedOpcode);
- AppendUint32(index_or_zero);
-}
-
-bool HpackOutputStream::AppendLiteralHeaderNoIndexingWithName(
- StringPiece name, StringPiece value) {
- AppendPrefix(kLiteralNoIndexOpcode);
- AppendBits(0x0, 8 - kLiteralNoIndexOpcode.bit_size);
- if (!AppendStringLiteral(name))
- return false;
- if (!AppendStringLiteral(value))
- return false;
- return true;
-}
-
-void HpackOutputStream::TakeString(string* output) {
- // This must hold, since all public functions cause the buffer to
- // end on a byte boundary.
- DCHECK_EQ(bit_offset_, 0u);
- buffer_.swap(*output);
- buffer_.clear();
- bit_offset_ = 0;
-}
-
void HpackOutputStream::AppendBits(uint8 bits, size_t bit_size) {
DCHECK_GT(bit_size, 0u);
DCHECK_LE(bit_size, 8u);
@@ -69,6 +43,11 @@ void HpackOutputStream::AppendPrefix(HpackPrefix prefix) {
AppendBits(prefix.bits, prefix.bit_size);
}
+void HpackOutputStream::AppendBytes(StringPiece buffer) {
+ DCHECK_EQ(bit_offset_, 0u);
+ buffer_.append(buffer.data(), buffer.size());
+}
+
void HpackOutputStream::AppendUint32(uint32 I) {
// The algorithm below is adapted from the pseudocode in 4.1.1.
size_t N = 8 - bit_offset_;
@@ -86,15 +65,13 @@ void HpackOutputStream::AppendUint32(uint32 I) {
}
}
-bool HpackOutputStream::AppendStringLiteral(base::StringPiece str) {
+void HpackOutputStream::TakeString(string* output) {
+ // This must hold, since all public functions cause the buffer to
+ // end on a byte boundary.
DCHECK_EQ(bit_offset_, 0u);
- // TODO(akalin): Implement Huffman encoding.
- AppendPrefix(kStringLiteralIdentityEncoded);
- if (str.size() > max_string_literal_size_)
- return false;
- AppendUint32(static_cast<uint32>(str.size()));
- buffer_.append(str.data(), str.size());
- return true;
+ buffer_.swap(*output);
+ buffer_.clear();
+ bit_offset_ = 0;
}
} // namespace net
« no previous file with comments | « net/spdy/hpack_output_stream.h ('k') | net/spdy/hpack_output_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698