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

Unified Diff: net/http2/tools/http2_frame_builder.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
« no previous file with comments | « net/http2/tools/http2_bug_tracker.h ('k') | net/http2/tools/http2_frame_builder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http2/tools/http2_frame_builder.h
diff --git a/net/http2/tools/http2_frame_builder.h b/net/http2/tools/http2_frame_builder.h
deleted file mode 100644
index c665c759e1d3b8e27ebf2dcbd0ff5931da10bedf..0000000000000000000000000000000000000000
--- a/net/http2/tools/http2_frame_builder.h
+++ /dev/null
@@ -1,100 +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_TOOLS_HTTP2_FRAME_BUILDER_H_
-#define NET_HTTP2_TOOLS_HTTP2_FRAME_BUILDER_H_
-
-// Http2FrameBuilder builds wire-format HTTP/2 frames (or fragments thereof)
-// from components.
-//
-// For now, this is only intended for use in tests, and thus has EXPECT* in the
-// code. If desired to use it in an encoder, it will need optimization work,
-// especially w.r.t memory mgmt, and the EXPECT* will need to be removed or
-// replaced with DCHECKs.
-
-#include <stddef.h> // for size_t
-
-#include <string>
-
-#include "base/strings/string_piece.h"
-#include "net/http2/http2_constants.h"
-#include "net/http2/http2_structures.h"
-
-namespace net {
-namespace test {
-
-class Http2FrameBuilder {
- public:
- Http2FrameBuilder(Http2FrameType type, uint8_t flags, uint32_t stream_id);
- explicit Http2FrameBuilder(const Http2FrameHeader& v);
- Http2FrameBuilder() {}
- ~Http2FrameBuilder() {}
-
- size_t size() const { return buffer_.size(); }
- const std::string& buffer() const { return buffer_; }
-
- //----------------------------------------------------------------------------
- // Methods for appending to the end of the buffer.
-
- // Append a sequence of bytes from various sources.
- void Append(base::StringPiece s);
- void AppendBytes(const void* data, uint32_t num_bytes);
-
- // Append an array of type T[N] to the string. Intended for tests with arrays
- // initialized from literals, such as:
- // const char kData[] = {0x12, 0x23, ...};
- // builder.AppendBytes(kData);
- template <typename T, size_t N>
- void AppendBytes(T (&buf)[N]) {
- AppendBytes(buf, N * sizeof(buf[0]));
- }
-
- // Support for appending padding. Does not read or write the Pad Length field.
- void AppendZeroes(size_t num_zero_bytes);
-
- // Append various sizes of unsigned integers.
- void AppendUInt8(uint8_t value);
- void AppendUInt16(uint16_t value);
- void AppendUInt24(uint32_t value);
- void AppendUInt31(uint32_t value);
- void AppendUInt32(uint32_t value);
-
- // Append various enums.
- void Append(Http2ErrorCode error_code);
- void Append(Http2FrameType type);
- void Append(Http2SettingsParameter parameter);
-
- // Append various structures.
- void Append(const Http2FrameHeader& v);
- void Append(const Http2PriorityFields& v);
- void Append(const Http2RstStreamFields& v);
- void Append(const Http2SettingFields& v);
- void Append(const Http2PushPromiseFields& v);
- void Append(const Http2PingFields& v);
- void Append(const Http2GoAwayFields& v);
- void Append(const Http2WindowUpdateFields& v);
- void Append(const Http2AltSvcFields& v);
-
- // Methods for changing existing buffer contents (mostly focused on updating
- // the payload length).
-
- void WriteAt(base::StringPiece s, size_t offset);
- void WriteBytesAt(const void* data, uint32_t num_bytes, size_t offset);
- void WriteUInt24At(uint32_t value, size_t offset);
-
- // Set the payload length to the specified size.
- void SetPayloadLength(uint32_t payload_length);
-
- // Sets the payload length to the size of the buffer minus the size of
- // the frame header.
- size_t SetPayloadLength();
-
- private:
- std::string buffer_;
-};
-
-} // namespace test
-} // namespace net
-
-#endif // NET_HTTP2_TOOLS_HTTP2_FRAME_BUILDER_H_
« no previous file with comments | « net/http2/tools/http2_bug_tracker.h ('k') | net/http2/tools/http2_frame_builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698