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

Unified Diff: net/spdy/hpack_huffman_aggregator.h

Issue 243153003: HPACK optimal Huffman code instrumentation and UMA collection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disable experiment by default; raise publish threshold to 50K characters. Created 6 years, 8 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
Index: net/spdy/hpack_huffman_aggregator.h
diff --git a/net/spdy/hpack_huffman_aggregator.h b/net/spdy/hpack_huffman_aggregator.h
new file mode 100644
index 0000000000000000000000000000000000000000..1b6ab2f4c04c6faad007daa1d6185a2eb984fa7c
--- /dev/null
+++ b/net/spdy/hpack_huffman_aggregator.h
@@ -0,0 +1,71 @@
+// Copyright 2014 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.
+
+#include <list>
+#include <vector>
+
+#include "net/base/net_export.h"
+#include "net/spdy/spdy_header_block.h"
+#include "net/spdy/spdy_protocol.h"
+#include "net/spdy/spdy_session_key.h"
+
+namespace net {
+
+class HpackEncoder;
+class HttpRequestHeaders;
+struct HttpRequestInfo;
+class HttpResponseHeaders;
+class ProxyServer;
+
+namespace test {
+class HpackHuffmanAggregatorPeer;
+} // namespace test
+
+class NET_EXPORT_PRIVATE HpackHuffmanAggregator {
+ public:
+ friend class test::HpackHuffmanAggregatorPeer;
+
+ HpackHuffmanAggregator();
+ ~HpackHuffmanAggregator();
+
+ // Encodes the request and response headers of the transaction with an
+ // HpackEncoder keyed on the transaction's SpdySessionKey. Literal headers
+ // emitted by that encoder are aggregated into internal character counts,
+ // which are periodically published to a UMA histogram.
+ void AggregateTransactionCharacterCounts(
+ const HttpRequestInfo& request,
+ const HttpRequestHeaders& request_headers,
+ const ProxyServer& proxy,
+ const HttpResponseHeaders& response_headers);
+
+ // Returns whether the aggregator is enabled for the session by a field trial.
+ static bool UseAggregator();
+
+ private:
+ // Returns true if the request is considered cross-origin,
+ // and should not be aggregated.
+ static bool IsCrossOrigin(const HttpRequestInfo& request);
+
+ // Converts |headers| into SPDY headers block |headers_out|.
+ static void CreateSpdyHeadersFromHttpResponse(
+ const HttpResponseHeaders& headers,
+ SpdyHeaderBlock* headers_out);
+
+ // Creates or returns an encoder for the origin key.
+ HpackEncoder* ObtainEncoder(const SpdySessionKey& key);
+
+ // Publishes aggregated counts to a UMA histogram.
+ void PublishCounts();
+
+ typedef std::pair<SpdySessionKey, HpackEncoder*> OriginEncoder;
+ typedef std::list<OriginEncoder> OriginEncoders;
jar (doing other things) 2014/04/29 18:40:19 nit: move typedefs at the start of the private sec
Johnny 2014/04/29 20:53:16 Done.
+
+ std::vector<size_t> counts_;
+ size_t total_counts_;
+
+ OriginEncoders encoders_;
+ size_t max_encoders_;
+};
jar (doing other things) 2014/04/29 18:40:19 nit: DISALLOW_COPY_AND_ASSIGN (unless you have a
Johnny 2014/04/29 20:53:16 Done.
+
+} // namespace net

Powered by Google App Engine
This is Rietveld 408576698