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

Unified Diff: net/spdy/hpack/hpack_encoder.h

Issue 2237113005: Adds a listener interface to HpackEncoder. Not used in production. Not protected. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | net/spdy/hpack/hpack_encoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/hpack/hpack_encoder.h
diff --git a/net/spdy/hpack/hpack_encoder.h b/net/spdy/hpack/hpack_encoder.h
index ce5c9df51ca6653585b09f934f0d2fe01f7efc67..a2085f084f523d97dd0a0f47217ab46bb41ca1d8 100644
--- a/net/spdy/hpack/hpack_encoder.h
+++ b/net/spdy/hpack/hpack_encoder.h
@@ -20,6 +20,8 @@
#include "net/spdy/hpack/hpack_output_stream.h"
#include "net/spdy/spdy_protocol.h"
+using base::StringPiece;
Bence 2016/08/15 13:58:31 Please remove this using directive. Unfortunately
+
// An HpackEncoder encodes header sets as outlined in
// http://tools.ietf.org/html/rfc7541.
@@ -36,6 +38,10 @@ class NET_EXPORT_PRIVATE HpackEncoder {
using Representation = std::pair<base::StringPiece, base::StringPiece>;
using Representations = std::vector<Representation>;
+ // Callers may provide a HeaderListener to be informed of header name-value
+ // pairs processed by this encoder.
+ typedef std::function<void(StringPiece, StringPiece)> HeaderListener;
+
// An indexing policy should return true if the provided header name-value
// pair should be inserted into the HPACK dynamic table.
using IndexingPolicy =
@@ -73,6 +79,10 @@ class NET_EXPORT_PRIVATE HpackEncoder {
// name-value pairs into the dynamic table.
void SetIndexingPolicy(IndexingPolicy policy) { should_index_ = policy; }
+ // |listener| will be invoked for each header name-value pair processed by
+ // this encoder.
+ void SetHeaderListener(HeaderListener listener) { listener_ = listener; }
+
void SetHeaderTableDebugVisitor(
std::unique_ptr<HpackHeaderTable::DebugVisitorInterface> visitor) {
header_table_.set_debug_visitor(std::move(visitor));
@@ -114,6 +124,7 @@ class NET_EXPORT_PRIVATE HpackEncoder {
const HpackHuffmanTable& huffman_table_;
size_t min_table_size_setting_received_;
+ HeaderListener listener_;
IndexingPolicy should_index_;
bool allow_huffman_compression_;
bool should_emit_table_size_;
« no previous file with comments | « no previous file | net/spdy/hpack/hpack_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698