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

Unified Diff: net/http2/hpack/decoder/hpack_decoder_string_buffer.h

Issue 2554683003: Revert of Add new HTTP/2 and HPACK decoder in net/http2/. (Closed)
Patch Set: Created 4 years 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
Index: net/http2/hpack/decoder/hpack_decoder_string_buffer.h
diff --git a/net/http2/hpack/decoder/hpack_decoder_string_buffer.h b/net/http2/hpack/decoder/hpack_decoder_string_buffer.h
deleted file mode 100644
index a0917a2c16bc0447b903e7106fce098be7846e37..0000000000000000000000000000000000000000
--- a/net/http2/hpack/decoder/hpack_decoder_string_buffer.h
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2016 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_HTTP2_HPACK_DECODER_HPACK_DECODER_STRING_BUFFER_H_
-#define NET_HTTP2_HPACK_DECODER_HPACK_DECODER_STRING_BUFFER_H_
-
-// HpackDecoderStringBuffer helps an HPACK decoder to avoid copies of a string
-// literal (name or value) except when necessary (e.g. when split across two
-// or more HPACK block fragments).
-
-#include <stddef.h>
-
-#include <ostream>
-#include <string>
-
-#include "base/macros.h"
-#include "base/strings/string_piece.h"
-#include "net/base/net_export.h"
-#include "net/http2/hpack/huffman/http2_hpack_huffman_decoder.h"
-
-namespace net {
-
-class NET_EXPORT_PRIVATE HpackDecoderStringBuffer {
- public:
- enum class State : uint8_t { RESET, COLLECTING, COMPLETE };
- enum class Backing : uint8_t { RESET, UNBUFFERED, BUFFERED, STATIC };
-
- HpackDecoderStringBuffer();
- ~HpackDecoderStringBuffer();
-
- void Reset();
- void Set(base::StringPiece value, bool is_static);
-
- // Note that for Huffman encoded strings the length of the string after
- // decoding may be larger (expected), the same or even smaller; the latter
- // are unlikely, but possible if the encoder makes odd choices.
- void OnStart(bool huffman_encoded, size_t len);
- bool OnData(const char* data, size_t len);
- bool OnEnd();
- void BufferStringIfUnbuffered();
- size_t BufferedLength() const;
-
- base::StringPiece str() const;
-
- State state_for_testing() const { return state_; }
- Backing backing_for_testing() const { return backing_; }
- void OutputDebugStringTo(std::ostream& out) const;
-
- private:
- // Storage for the string being buffered, if buffering is necessary
- // (e.g. if Huffman encoded, buffer_ is storage for the decoded string).
- std::string buffer_;
-
- // The StringPiece to be returned by HpackDecoderStringBuffer::str(). If a
- // string has been collected, but not buffered, value_ points to that string.
- base::StringPiece value_;
-
- // The decoder to use if the string is Huffman encoded.
- HpackHuffmanDecoder decoder_;
-
- // Count of bytes not yet passed to OnData.
- size_t remaining_len_ = 0;
-
- // Is the HPACK string Huffman encoded?
- bool is_huffman_encoded_ = false;
-
- // State of the string decoding process.
- State state_;
-
- // Where is the string stored?
- Backing backing_;
-
- DISALLOW_COPY_AND_ASSIGN(HpackDecoderStringBuffer);
-};
-
-NET_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& out,
- const HpackDecoderStringBuffer& v);
-
-} // namespace net
-
-#endif // NET_HTTP2_HPACK_DECODER_HPACK_DECODER_STRING_BUFFER_H_
« no previous file with comments | « net/http2/hpack/decoder/hpack_block_decoder_test.cc ('k') | net/http2/hpack/decoder/hpack_decoder_string_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698