Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/prerender/prerender_origin.h" | |
| 6 | |
| 7 #include "base/metrics/histogram.h" | |
| 8 #include "chrome/browser/prerender/prerender_manager.h" | |
| 9 | |
| 10 namespace prerender { | |
| 11 | |
| 12 namespace { | |
| 13 | |
| 14 const char* kOriginNames[] = { | |
| 15 "Link Rel Prerender", | |
| 16 "Pending Link Rel Prerender", | |
| 17 "Omnibox", | |
| 18 "Max" | |
| 19 }; | |
| 20 COMPILE_ASSERT(arraysize(kOriginNames) == ORIGIN_MAX + 1, | |
| 21 PrerenderOrigin_name_count_mismatch); | |
| 22 | |
| 23 } | |
| 24 | |
| 25 void RecordOrigin(Origin origin) { | |
|
cbentzel
2011/06/22 17:27:32
Why do we need to record this? We have all the dat
dominich
2011/06/22 19:00:51
It is calculable from FinalStatus but this is a qu
cbentzel
2011/06/22 19:08:40
It's pretty easy to calculate from FinalStauts. I'
| |
| 26 CHECK(origin < ORIGIN_MAX); | |
| 27 // FINAL_STATUS_CONTROL_GROUP indicates that the PrerenderContents | |
| 28 // was created only to measure "would-have-been-prerendered" for | |
| 29 // control group measurements. Don't pollute data with it. | |
| 30 if (PrerenderManager::IsControlGroup()) | |
| 31 return; | |
| 32 UMA_HISTOGRAM_ENUMERATION("Prerender.Origin", | |
| 33 origin, | |
| 34 ORIGIN_MAX); | |
| 35 } | |
| 36 | |
| 37 const char* NameFromOrigin(Origin origin) { | |
|
cbentzel
2011/06/22 17:27:32
Is this being used?
dominich
2011/06/22 19:00:51
Not currently, but I was going to add the info to
cbentzel
2011/06/22 19:08:40
OK, I'm fine with it if there is a plan for it's u
| |
| 38 DCHECK(static_cast<int>(origin) >= 0 && | |
| 39 origin <= ORIGIN_MAX); | |
| 40 return kOriginNames[origin]; | |
| 41 } | |
| 42 | |
| 43 } // namespace prerender | |
| OLD | NEW |