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

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: Address Comments Created 4 years, 3 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..b66ae9248539390624edf6c991a49c7fe018fb31 100644
--- a/net/spdy/hpack/hpack_encoder.h
+++ b/net/spdy/hpack/hpack_encoder.h
@@ -36,6 +36,11 @@ 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(base::StringPiece, base::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 +78,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 +123,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