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 "content/child/site_isolation_stats_gatherer.h" | 5 #include "content/child/site_isolation_stats_gatherer.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
| 10 #include "base/macros.h" |
7 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
8 #include "base/strings/string_piece.h" | 12 #include "base/strings/string_piece.h" |
9 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
10 #include "content/public/common/resource_response_info.h" | 14 #include "content/public/common/resource_response_info.h" |
11 #include "net/http/http_response_headers.h" | 15 #include "net/http/http_response_headers.h" |
12 | 16 |
13 namespace content { | 17 namespace content { |
14 | 18 |
15 namespace { | 19 namespace { |
16 | 20 |
(...skipping 14 matching lines...) Expand all Loading... |
31 } | 35 } |
32 | 36 |
33 void IncrementHistogramCount(const std::string& name) { | 37 void IncrementHistogramCount(const std::string& name) { |
34 // The default value of min, max, bucket_count are copied from histogram.h. | 38 // The default value of min, max, bucket_count are copied from histogram.h. |
35 base::HistogramBase* histogram_pointer = base::Histogram::FactoryGet( | 39 base::HistogramBase* histogram_pointer = base::Histogram::FactoryGet( |
36 name, 1, 100000, 50, base::HistogramBase::kUmaTargetedHistogramFlag); | 40 name, 1, 100000, 50, base::HistogramBase::kUmaTargetedHistogramFlag); |
37 histogram_pointer->Add(1); | 41 histogram_pointer->Add(1); |
38 } | 42 } |
39 | 43 |
40 void IncrementHistogramEnum(const std::string& name, | 44 void IncrementHistogramEnum(const std::string& name, |
41 uint32 sample, | 45 uint32_t sample, |
42 uint32 boundary_value) { | 46 uint32_t boundary_value) { |
43 // The default value of min, max, bucket_count are copied from histogram.h. | 47 // The default value of min, max, bucket_count are copied from histogram.h. |
44 base::HistogramBase* histogram_pointer = base::LinearHistogram::FactoryGet( | 48 base::HistogramBase* histogram_pointer = base::LinearHistogram::FactoryGet( |
45 name, 1, boundary_value, boundary_value + 1, | 49 name, 1, boundary_value, boundary_value + 1, |
46 base::HistogramBase::kUmaTargetedHistogramFlag); | 50 base::HistogramBase::kUmaTargetedHistogramFlag); |
47 histogram_pointer->Add(sample); | 51 histogram_pointer->Add(sample); |
48 } | 52 } |
49 | 53 |
50 void HistogramCountBlockedResponse( | 54 void HistogramCountBlockedResponse( |
51 const std::string& bucket_prefix, | 55 const std::string& bucket_prefix, |
52 const linked_ptr<SiteIsolationResponseMetaData>& resp_data, | 56 const linked_ptr<SiteIsolationResponseMetaData>& resp_data, |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 } | 252 } |
249 | 253 |
250 bool SiteIsolationStatsGatherer::SniffForJS(base::StringPiece data) { | 254 bool SiteIsolationStatsGatherer::SniffForJS(base::StringPiece data) { |
251 // The purpose of this function is to try to see if there's any possibility | 255 // The purpose of this function is to try to see if there's any possibility |
252 // that this data can be JavaScript (superset of JS). Search for "var " for JS | 256 // that this data can be JavaScript (superset of JS). Search for "var " for JS |
253 // detection. This is a real hack and should only be used for stats gathering. | 257 // detection. This is a real hack and should only be used for stats gathering. |
254 return data.find("var ") != base::StringPiece::npos; | 258 return data.find("var ") != base::StringPiece::npos; |
255 } | 259 } |
256 | 260 |
257 } // namespace content | 261 } // namespace content |
OLD | NEW |