OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 | 4 |
5 #include "chrome/browser/mod_pagespeed/mod_pagespeed_metrics.h" | 5 #include "chrome/browser/mod_pagespeed/mod_pagespeed_metrics.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 return; | 79 return; |
80 } | 80 } |
81 | 81 |
82 // Bucket 0 counts every response seen. | 82 // Bucket 0 counts every response seen. |
83 UMA_HISTOGRAM_ENUMERATION(kPagespeedServerHistogram, | 83 UMA_HISTOGRAM_ENUMERATION(kPagespeedServerHistogram, |
84 PAGESPEED_TOTAL_RESPONSES, | 84 PAGESPEED_TOTAL_RESPONSES, |
85 PAGESPEED_SERVER_MAXIMUM); | 85 PAGESPEED_SERVER_MAXIMUM); |
86 if (!response_headers) | 86 if (!response_headers) |
87 return; | 87 return; |
88 | 88 |
89 void* iter = nullptr; | 89 size_t iter = 0; |
90 std::string name; | 90 std::string name; |
91 std::string value; | 91 std::string value; |
92 while (response_headers->EnumerateHeaderLines(&iter, &name, &value)) { | 92 while (response_headers->EnumerateHeaderLines(&iter, &name, &value)) { |
93 if (name == kModPagespeedHeader) { | 93 if (name == kModPagespeedHeader) { |
94 // Bucket 1 counts occurrences of the X-Mod-Pagespeed header. | 94 // Bucket 1 counts occurrences of the X-Mod-Pagespeed header. |
95 UMA_HISTOGRAM_ENUMERATION(kPagespeedServerHistogram, | 95 UMA_HISTOGRAM_ENUMERATION(kPagespeedServerHistogram, |
96 PAGESPEED_MOD_PAGESPEED_SERVER, | 96 PAGESPEED_MOD_PAGESPEED_SERVER, |
97 PAGESPEED_SERVER_MAXIMUM); | 97 PAGESPEED_SERVER_MAXIMUM); |
98 if (!value.empty()) { | 98 if (!value.empty()) { |
99 // If the header value is in the X-Mod-Pagespeed version number format | 99 // If the header value is in the X-Mod-Pagespeed version number format |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 PAGESPEED_UNKNOWN_SERVER, | 134 PAGESPEED_UNKNOWN_SERVER, |
135 PAGESPEED_SERVER_MAXIMUM); | 135 PAGESPEED_SERVER_MAXIMUM); |
136 } | 136 } |
137 } | 137 } |
138 break; | 138 break; |
139 } | 139 } |
140 } | 140 } |
141 } | 141 } |
142 | 142 |
143 } // namespace mod_pagespeed | 143 } // namespace mod_pagespeed |
OLD | NEW |