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

Side by Side 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, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <list>
6 #include <vector>
7
8 #include "net/base/net_export.h"
9 #include "net/spdy/spdy_header_block.h"
10 #include "net/spdy/spdy_protocol.h"
11 #include "net/spdy/spdy_session_key.h"
12
13 namespace net {
14
15 class HpackEncoder;
16 class HttpRequestHeaders;
17 struct HttpRequestInfo;
18 class HttpResponseHeaders;
19 class ProxyServer;
20
21 namespace test {
22 class HpackHuffmanAggregatorPeer;
23 } // namespace test
24
25 class NET_EXPORT_PRIVATE HpackHuffmanAggregator {
26 public:
27 friend class test::HpackHuffmanAggregatorPeer;
28
29 HpackHuffmanAggregator();
30 ~HpackHuffmanAggregator();
31
32 // Encodes the request and response headers of the transaction with an
33 // HpackEncoder keyed on the transaction's SpdySessionKey. Literal headers
34 // emitted by that encoder are aggregated into internal character counts,
35 // which are periodically published to a UMA histogram.
36 void AggregateTransactionCharacterCounts(
37 const HttpRequestInfo& request,
38 const HttpRequestHeaders& request_headers,
39 const ProxyServer& proxy,
40 const HttpResponseHeaders& response_headers);
41
42 // Returns whether the aggregator is enabled for the session by a field trial.
43 static bool UseAggregator();
44
45 private:
46 // Returns true if the request is considered cross-origin,
47 // and should not be aggregated.
48 static bool IsCrossOrigin(const HttpRequestInfo& request);
49
50 // Converts |headers| into SPDY headers block |headers_out|.
51 static void CreateSpdyHeadersFromHttpResponse(
52 const HttpResponseHeaders& headers,
53 SpdyHeaderBlock* headers_out);
54
55 // Creates or returns an encoder for the origin key.
56 HpackEncoder* ObtainEncoder(const SpdySessionKey& key);
57
58 // Publishes aggregated counts to a UMA histogram.
59 void PublishCounts();
60
61 typedef std::pair<SpdySessionKey, HpackEncoder*> OriginEncoder;
62 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.
63
64 std::vector<size_t> counts_;
65 size_t total_counts_;
66
67 OriginEncoders encoders_;
68 size_t max_encoders_;
69 };
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.
70
71 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698