OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/prerender/prerender_final_status.h" | 5 #include "chrome/browser/prerender/prerender_final_status.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "chrome/browser/prerender/prerender_manager.h" | 8 #include "chrome/browser/prerender/prerender_manager.h" |
9 | 9 |
10 namespace prerender { | 10 namespace prerender { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 "Fragment Mismatch", | 44 "Fragment Mismatch", |
45 "SSL Client Certificate Requested", | 45 "SSL Client Certificate Requested", |
46 "Cache or History Cleared", | 46 "Cache or History Cleared", |
47 "Max", | 47 "Max", |
48 }; | 48 }; |
49 COMPILE_ASSERT(arraysize(kFinalStatusNames) == FINAL_STATUS_MAX + 1, | 49 COMPILE_ASSERT(arraysize(kFinalStatusNames) == FINAL_STATUS_MAX + 1, |
50 PrerenderFinalStatus_name_count_mismatch); | 50 PrerenderFinalStatus_name_count_mismatch); |
51 | 51 |
52 } | 52 } |
53 | 53 |
54 void RecordFinalStatus(FinalStatus final_status) { | 54 void RecordFinalStatus(Origin origin, FinalStatus final_status) { |
55 DCHECK(final_status != FINAL_STATUS_MAX); | 55 DCHECK(final_status != FINAL_STATUS_MAX); |
56 // FINAL_STATUS_CONTROL_GROUP indicates that the PrerenderContents | 56 // FINAL_STATUS_CONTROL_GROUP indicates that the PrerenderContents |
57 // was created only to measure "would-have-been-prerendered" for | 57 // was created only to measure "would-have-been-prerendered" for |
58 // control group measurements. Don't pollute data with it. | 58 // control group measurements. Don't pollute data with it. |
59 if (PrerenderManager::IsControlGroup() || | 59 if (PrerenderManager::IsControlGroup() || |
60 final_status == FINAL_STATUS_CONTROL_GROUP) | 60 final_status == FINAL_STATUS_CONTROL_GROUP) |
61 return; | 61 return; |
62 UMA_HISTOGRAM_ENUMERATION("Prerender.FinalStatus", | 62 UMA_HISTOGRAM_ENUMERATION("Prerender.FinalStatus", |
63 final_status, | 63 final_status, |
64 FINAL_STATUS_MAX); | 64 FINAL_STATUS_MAX); |
| 65 switch (origin) { |
| 66 case ORIGIN_LINK_REL_PRERENDER: |
| 67 UMA_HISTOGRAM_ENUMERATION("Prerender.FinalStatus_LinkRelPrerender", |
| 68 final_status, |
| 69 FINAL_STATUS_MAX); |
| 70 break; |
| 71 case ORIGIN_OMNIBOX: |
| 72 UMA_HISTOGRAM_ENUMERATION("Prerender.FinalStatus_Omnibox", |
| 73 final_status, |
| 74 FINAL_STATUS_MAX); |
| 75 break; |
| 76 default: |
| 77 NOTREACHED(); |
| 78 break; |
| 79 }; |
65 } | 80 } |
66 | 81 |
67 const char* NameFromFinalStatus(FinalStatus final_status) { | 82 const char* NameFromFinalStatus(FinalStatus final_status) { |
68 DCHECK(static_cast<int>(final_status) >= 0 && | 83 DCHECK(static_cast<int>(final_status) >= 0 && |
69 static_cast<int>(final_status) <= FINAL_STATUS_MAX); | 84 static_cast<int>(final_status) <= FINAL_STATUS_MAX); |
70 return kFinalStatusNames[final_status]; | 85 return kFinalStatusNames[final_status]; |
71 } | 86 } |
72 | 87 |
73 } // namespace prerender | 88 } // namespace prerender |
OLD | NEW |