OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "webkit/browser/appcache/appcache_histograms.h" | 5 #include "webkit/browser/appcache/appcache_histograms.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 | 8 |
9 namespace appcache { | 9 namespace appcache { |
10 | 10 |
| 11 static std::string OriginToCustomHistogramSuffix(const GURL& origin_url) { |
| 12 if (origin_url.host() == "docs.google.com") |
| 13 return ".Docs"; |
| 14 return std::string(); |
| 15 } |
| 16 |
11 void AppCacheHistograms::CountInitResult(InitResultType init_result) { | 17 void AppCacheHistograms::CountInitResult(InitResultType init_result) { |
12 UMA_HISTOGRAM_ENUMERATION( | 18 UMA_HISTOGRAM_ENUMERATION( |
13 "appcache.InitResult", | 19 "appcache.InitResult", |
14 init_result, NUM_INIT_RESULT_TYPES); | 20 init_result, NUM_INIT_RESULT_TYPES); |
15 } | 21 } |
16 | 22 |
17 void AppCacheHistograms::CountReinitAttempt(bool repeated_attempt) { | 23 void AppCacheHistograms::CountReinitAttempt(bool repeated_attempt) { |
18 UMA_HISTOGRAM_BOOLEAN("appcache.ReinitAttempt", repeated_attempt); | 24 UMA_HISTOGRAM_BOOLEAN("appcache.ReinitAttempt", repeated_attempt); |
19 } | 25 } |
20 | 26 |
21 void AppCacheHistograms::CountCorruptionDetected() { | 27 void AppCacheHistograms::CountCorruptionDetected() { |
22 UMA_HISTOGRAM_BOOLEAN("appcache.CorruptionDetected", true); | 28 UMA_HISTOGRAM_BOOLEAN("appcache.CorruptionDetected", true); |
23 } | 29 } |
24 | 30 |
| 31 void AppCacheHistograms::CountUpdateJobResult( |
| 32 AppCacheUpdateJob::ResultType result, |
| 33 const GURL& origin_url) { |
| 34 UMA_HISTOGRAM_ENUMERATION( |
| 35 "appcache.UpdateJobResult", |
| 36 result, AppCacheUpdateJob::NUM_UPDATE_JOB_RESULT_TYPES); |
| 37 |
| 38 const std::string suffix = OriginToCustomHistogramSuffix(origin_url); |
| 39 if (!suffix.empty()) { |
| 40 base::LinearHistogram::FactoryGet( |
| 41 "appcache.UpdateJobResult" + suffix, |
| 42 1, |
| 43 AppCacheUpdateJob::NUM_UPDATE_JOB_RESULT_TYPES, |
| 44 AppCacheUpdateJob::NUM_UPDATE_JOB_RESULT_TYPES + 1, |
| 45 base::HistogramBase::kUmaTargetedHistogramFlag)->Add(result); |
| 46 } |
| 47 } |
| 48 |
25 void AppCacheHistograms::CountCheckResponseResult( | 49 void AppCacheHistograms::CountCheckResponseResult( |
26 CheckResponseResultType result) { | 50 CheckResponseResultType result) { |
27 UMA_HISTOGRAM_ENUMERATION( | 51 UMA_HISTOGRAM_ENUMERATION( |
28 "appcache.CheckResponseResult", | 52 "appcache.CheckResponseResult", |
29 result, NUM_CHECK_RESPONSE_RESULT_TYPES); | 53 result, NUM_CHECK_RESPONSE_RESULT_TYPES); |
30 } | 54 } |
31 | 55 |
32 void AppCacheHistograms::AddTaskQueueTimeSample( | 56 void AppCacheHistograms::AddTaskQueueTimeSample( |
33 const base::TimeDelta& duration) { | 57 const base::TimeDelta& duration) { |
34 UMA_HISTOGRAM_TIMES("appcache.TaskQueueTime", duration); | 58 UMA_HISTOGRAM_TIMES("appcache.TaskQueueTime", duration); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 } | 93 } |
70 | 94 |
71 void AppCacheHistograms::AddMissingManifestDetectedAtCallsite( | 95 void AppCacheHistograms::AddMissingManifestDetectedAtCallsite( |
72 MissingManifestCallsiteType callsite) { | 96 MissingManifestCallsiteType callsite) { |
73 UMA_HISTOGRAM_ENUMERATION( | 97 UMA_HISTOGRAM_ENUMERATION( |
74 "appcache.MissingManifestDetectedAtCallsite", | 98 "appcache.MissingManifestDetectedAtCallsite", |
75 callsite, NUM_MISSING_MANIFEST_CALLSITE_TYPES); | 99 callsite, NUM_MISSING_MANIFEST_CALLSITE_TYPES); |
76 } | 100 } |
77 | 101 |
78 } // namespace appcache | 102 } // namespace appcache |
OLD | NEW |