OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 #include "net/spdy/hpack_huffman_aggregator.h" | 4 #include "net/spdy/hpack_huffman_aggregator.h" |
5 | 5 |
6 #include "base/metrics/bucket_ranges.h" | 6 #include "base/metrics/bucket_ranges.h" |
7 #include "base/metrics/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/metrics/sample_vector.h" | 9 #include "base/metrics/sample_vector.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 // static | 88 // static |
89 void HpackHuffmanAggregator::CreateSpdyHeadersFromHttpResponse( | 89 void HpackHuffmanAggregator::CreateSpdyHeadersFromHttpResponse( |
90 const HttpResponseHeaders& headers, | 90 const HttpResponseHeaders& headers, |
91 SpdyHeaderBlock* headers_out) { | 91 SpdyHeaderBlock* headers_out) { |
92 // Lower-case header names, and coalesce multiple values delimited by \0. | 92 // Lower-case header names, and coalesce multiple values delimited by \0. |
93 // Also add the fixed status header. | 93 // Also add the fixed status header. |
94 std::string name, value; | 94 std::string name, value; |
95 void* it = NULL; | 95 void* it = NULL; |
96 while (headers.EnumerateHeaderLines(&it, &name, &value)) { | 96 while (headers.EnumerateHeaderLines(&it, &name, &value)) { |
97 StringToLowerASCII(&name); | 97 base::StringToLowerASCII(&name); |
98 if (headers_out->find(name) == headers_out->end()) { | 98 if (headers_out->find(name) == headers_out->end()) { |
99 (*headers_out)[name] = value; | 99 (*headers_out)[name] = value; |
100 } else { | 100 } else { |
101 (*headers_out)[name] += std::string(1, '\0') + value; | 101 (*headers_out)[name] += std::string(1, '\0') + value; |
102 } | 102 } |
103 } | 103 } |
104 (*headers_out)[":status"] = base::IntToString(headers.response_code()); | 104 (*headers_out)[":status"] = base::IntToString(headers.response_code()); |
105 } | 105 } |
106 | 106 |
107 // static | 107 // static |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 base::LinearHistogram::FactoryGet( | 174 base::LinearHistogram::FactoryGet( |
175 kHistogramName, kRangeMin, kRangeMax, kBucketCount, | 175 kHistogramName, kRangeMin, kRangeMax, kBucketCount, |
176 base::HistogramBase::kUmaTargetedHistogramFlag)); | 176 base::HistogramBase::kUmaTargetedHistogramFlag)); |
177 | 177 |
178 // Clear counts. | 178 // Clear counts. |
179 counts_.assign(counts_.size(), 0); | 179 counts_.assign(counts_.size(), 0); |
180 total_counts_ = 0; | 180 total_counts_ = 0; |
181 } | 181 } |
182 | 182 |
183 } // namespace net | 183 } // namespace net |
OLD | NEW |