OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google, Inc. All rights reserved. | 2 * Copyright (C) 2012 Google, Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 25 matching lines...) Expand all Loading... |
36 #include "core/inspector/ConsoleMessage.h" | 36 #include "core/inspector/ConsoleMessage.h" |
37 #include "core/workers/WorkerGlobalScope.h" | 37 #include "core/workers/WorkerGlobalScope.h" |
38 #include "platform/Histogram.h" | 38 #include "platform/Histogram.h" |
39 | 39 |
40 namespace blink { | 40 namespace blink { |
41 | 41 |
42 static int totalPagesMeasuredCSSSampleId() { return 1; } | 42 static int totalPagesMeasuredCSSSampleId() { return 1; } |
43 | 43 |
44 int UseCounter::m_muteCount = 0; | 44 int UseCounter::m_muteCount = 0; |
45 | 45 |
46 // FIXME : This mapping should be autogenerated. This function should | |
47 // be moved to a separate file and a script run at build time | |
48 // to detect new values in CSSPropertyID and add them to the | |
49 // end of this function. This file would be checked in. | |
50 // https://code.google.com/p/chromium/issues/detail?id=234940 | |
51 int UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(int id) | 46 int UseCounter::mapCSSPropertyIdToCSSSampleIdForHistogram(int id) |
52 { | 47 { |
53 CSSPropertyID cssPropertyID = static_cast<CSSPropertyID>(id); | 48 CSSPropertyID cssPropertyID = static_cast<CSSPropertyID>(id); |
54 | 49 |
55 switch (cssPropertyID) { | 50 switch (cssPropertyID) { |
56 // Begin at 2, because 1 is reserved for totalPagesMeasuredCSSSampleId. | 51 // Begin at 2, because 1 is reserved for totalPagesMeasuredCSSSampleId. |
57 case CSSPropertyColor: return 2; | 52 case CSSPropertyColor: return 2; |
58 case CSSPropertyDirection: return 3; | 53 case CSSPropertyDirection: return 3; |
59 case CSSPropertyDisplay: return 4; | 54 case CSSPropertyDisplay: return 4; |
60 case CSSPropertyFont: return 5; | 55 case CSSPropertyFont: return 5; |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
778 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents) | 773 UseCounter* UseCounter::getFrom(const StyleSheetContents* sheetContents) |
779 { | 774 { |
780 // FIXME: We may want to handle stylesheets that have multiple owners | 775 // FIXME: We may want to handle stylesheets that have multiple owners |
781 // https://crbug.com/242125 | 776 // https://crbug.com/242125 |
782 if (sheetContents && sheetContents->hasSingleOwnerNode()) | 777 if (sheetContents && sheetContents->hasSingleOwnerNode()) |
783 return getFrom(sheetContents->singleOwnerDocument()); | 778 return getFrom(sheetContents->singleOwnerDocument()); |
784 return 0; | 779 return 0; |
785 } | 780 } |
786 | 781 |
787 } // namespace blink | 782 } // namespace blink |
OLD | NEW |