Chromium Code Reviews| Index: net/spdy/hpack_decoder.cc |
| diff --git a/net/spdy/hpack_decoder.cc b/net/spdy/hpack_decoder.cc |
| index abd579ad007049be6730eccd728e881109da6fa2..0108dde1950ab0ab93a25b50eb58af8230d886f7 100644 |
| --- a/net/spdy/hpack_decoder.cc |
| +++ b/net/spdy/hpack_decoder.cc |
| @@ -4,6 +4,8 @@ |
| #include "net/spdy/hpack_decoder.h" |
| +#include <utility> |
|
Johnny
2014/08/06 15:04:49
I don't see a use of this below?
Bence
2014/08/06 20:20:22
It's for std::pair. git cl lint complains if this
Johnny
2014/08/07 17:02:22
Oh, great. SGTM then.
Bence
2014/08/08 13:57:55
Acknowledged.
|
| + |
| #include "base/basictypes.h" |
| #include "base/logging.h" |
| #include "net/spdy/hpack_constants.h" |
| @@ -16,10 +18,6 @@ using std::string; |
| namespace { |
| -const uint8 kNoState = 0; |
| -// Set on entries added to the reference set during this decoding. |
| -const uint8 kReferencedThisEncoding = 1; |
| - |
| const char kCookieKey[] = "cookie"; |
| } // namespace |
| @@ -56,21 +54,6 @@ bool HpackDecoder::HandleControlFrameHeadersComplete(SpdyStreamId id) { |
| } |
| headers_block_buffer_.clear(); |
| - // Emit everything in the reference set that hasn't already been emitted. |
| - // Also clear entry state for the next decoded headers block. |
| - // TODO(jgraettinger): We may need to revisit the order in which headers |
| - // are emitted (b/14051713). |
| - for (HpackHeaderTable::OrderedEntrySet::const_iterator it = |
| - header_table_.reference_set().begin(); |
| - it != header_table_.reference_set().end(); ++it) { |
| - HpackEntry* entry = *it; |
| - |
| - if (entry->state() == kNoState) { |
| - HandleHeaderRepresentation(entry->name(), entry->value()); |
| - } else { |
| - entry->set_state(kNoState); |
| - } |
| - } |
| // Emit the Cookie header, if any crumbles were encountered. |
| if (!cookie_value_.empty()) { |
| decoded_block_[kCookieKey] = cookie_value_; |
| @@ -121,31 +104,24 @@ bool HpackDecoder::DecodeNextOpcode(HpackInputStream* input_stream) { |
| return DecodeNextLiteralHeader(input_stream, false); |
| } |
| // Implements 4.4: Encoding context update. |
| - if (input_stream->MatchPrefixAndConsume(kEncodingContextOpcode)) { |
| - return DecodeNextContextUpdate(input_stream); |
| + if (input_stream->MatchPrefixAndConsume(kHeaderTableSizeUpdateOpcode)) { |
| + return DecodeNextHeaderTableSizeUpdate(input_stream); |
| } |
| // Unrecognized opcode. |
| return false; |
| } |
| -bool HpackDecoder::DecodeNextContextUpdate(HpackInputStream* input_stream) { |
| - if (input_stream->MatchPrefixAndConsume(kEncodingContextEmptyReferenceSet)) { |
| - header_table_.ClearReferenceSet(); |
| - return true; |
| +bool HpackDecoder::DecodeNextHeaderTableSizeUpdate( |
| + HpackInputStream* input_stream) { |
| + uint32 size = 0; |
| + if (!input_stream->DecodeNextUint32(&size)) { |
| + return false; |
| } |
| - if (input_stream->MatchPrefixAndConsume(kEncodingContextNewMaximumSize)) { |
| - uint32 size = 0; |
| - if (!input_stream->DecodeNextUint32(&size)) { |
| - return false; |
| - } |
| - if (size > header_table_.settings_size_bound()) { |
| - return false; |
| - } |
| - header_table_.SetMaxSize(size); |
| - return true; |
| + if (size > header_table_.settings_size_bound()) { |
| + return false; |
| } |
| - // Unrecognized encoding context update. |
| - return false; |
| + header_table_.SetMaxSize(size); |
| + return true; |
| } |
| bool HpackDecoder::DecodeNextIndexedHeader(HpackInputStream* input_stream) { |
| @@ -157,22 +133,7 @@ bool HpackDecoder::DecodeNextIndexedHeader(HpackInputStream* input_stream) { |
| if (entry == NULL) |
| return false; |
| - if (entry->IsStatic()) { |
| - HandleHeaderRepresentation(entry->name(), entry->value()); |
| - |
| - HpackEntry* new_entry = header_table_.TryAddEntry( |
| - entry->name(), entry->value()); |
| - if (new_entry) { |
| - header_table_.Toggle(new_entry); |
| - new_entry->set_state(kReferencedThisEncoding); |
| - } |
| - } else { |
| - entry->set_state(kNoState); |
| - if (header_table_.Toggle(entry)) { |
| - HandleHeaderRepresentation(entry->name(), entry->value()); |
| - entry->set_state(kReferencedThisEncoding); |
| - } |
| - } |
| + HandleHeaderRepresentation(entry->name(), entry->value()); |
| return true; |
| } |
| @@ -191,11 +152,7 @@ bool HpackDecoder::DecodeNextLiteralHeader(HpackInputStream* input_stream, |
| if (!should_index) |
| return true; |
| - HpackEntry* new_entry = header_table_.TryAddEntry(name, value); |
| - if (new_entry) { |
| - header_table_.Toggle(new_entry); |
| - new_entry->set_state(kReferencedThisEncoding); |
| - } |
| + header_table_.TryAddEntry(name, value); |
|
Johnny
2014/08/06 15:04:49
ignore_result
Bence
2014/08/06 20:20:22
Done.
|
| return true; |
| } |