OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 12 matching lines...) Expand all Loading... |
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "core/css/resolver/StyleResolverStats.h" | 31 #include "core/css/resolver/StyleResolverStats.h" |
32 | 32 |
33 #include <memory> | |
34 | |
35 namespace blink { | 33 namespace blink { |
36 | 34 |
37 void StyleResolverStats::reset() | 35 void StyleResolverStats::reset() |
38 { | 36 { |
39 sharedStyleLookups = 0; | 37 sharedStyleLookups = 0; |
40 sharedStyleCandidates = 0; | 38 sharedStyleCandidates = 0; |
41 sharedStyleFound = 0; | 39 sharedStyleFound = 0; |
42 sharedStyleMissed = 0; | 40 sharedStyleMissed = 0; |
43 sharedStyleRejectedByUncommonAttributeRules = 0; | 41 sharedStyleRejectedByUncommonAttributeRules = 0; |
44 sharedStyleRejectedBySiblingRules = 0; | 42 sharedStyleRejectedBySiblingRules = 0; |
(...skipping 13 matching lines...) Expand all Loading... |
58 baseStylesUsed = 0; | 56 baseStylesUsed = 0; |
59 } | 57 } |
60 | 58 |
61 bool StyleResolverStats::allCountersEnabled() const | 59 bool StyleResolverStats::allCountersEnabled() const |
62 { | 60 { |
63 bool allCountersEnabled; | 61 bool allCountersEnabled; |
64 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("blink.style"),
&allCountersEnabled); | 62 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("blink.style"),
&allCountersEnabled); |
65 return allCountersEnabled; | 63 return allCountersEnabled; |
66 } | 64 } |
67 | 65 |
68 std::unique_ptr<TracedValue> StyleResolverStats::toTracedValue() const | 66 PassOwnPtr<TracedValue> StyleResolverStats::toTracedValue() const |
69 { | 67 { |
70 std::unique_ptr<TracedValue> tracedValue = TracedValue::create(); | 68 OwnPtr<TracedValue> tracedValue = TracedValue::create(); |
71 tracedValue->setInteger("sharedStyleLookups", sharedStyleLookups); | 69 tracedValue->setInteger("sharedStyleLookups", sharedStyleLookups); |
72 tracedValue->setInteger("sharedStyleCandidates", sharedStyleCandidates); | 70 tracedValue->setInteger("sharedStyleCandidates", sharedStyleCandidates); |
73 tracedValue->setInteger("sharedStyleFound", sharedStyleFound); | 71 tracedValue->setInteger("sharedStyleFound", sharedStyleFound); |
74 if (allCountersEnabled()) | 72 if (allCountersEnabled()) |
75 tracedValue->setInteger("sharedStyleMissed", sharedStyleMissed); | 73 tracedValue->setInteger("sharedStyleMissed", sharedStyleMissed); |
76 tracedValue->setInteger("sharedStyleRejectedByUncommonAttributeRules", share
dStyleRejectedByUncommonAttributeRules); | 74 tracedValue->setInteger("sharedStyleRejectedByUncommonAttributeRules", share
dStyleRejectedByUncommonAttributeRules); |
77 tracedValue->setInteger("sharedStyleRejectedBySiblingRules", sharedStyleReje
ctedBySiblingRules); | 75 tracedValue->setInteger("sharedStyleRejectedBySiblingRules", sharedStyleReje
ctedBySiblingRules); |
78 tracedValue->setInteger("sharedStyleRejectedByParent", sharedStyleRejectedBy
Parent); | 76 tracedValue->setInteger("sharedStyleRejectedByParent", sharedStyleRejectedBy
Parent); |
79 tracedValue->setInteger("matchedPropertyApply", matchedPropertyApply); | 77 tracedValue->setInteger("matchedPropertyApply", matchedPropertyApply); |
80 tracedValue->setInteger("matchedPropertyCacheHit", matchedPropertyCacheHit); | 78 tracedValue->setInteger("matchedPropertyCacheHit", matchedPropertyCacheHit); |
81 tracedValue->setInteger("matchedPropertyCacheInheritedHit", matchedPropertyC
acheInheritedHit); | 79 tracedValue->setInteger("matchedPropertyCacheInheritedHit", matchedPropertyC
acheInheritedHit); |
82 tracedValue->setInteger("matchedPropertyCacheAdded", matchedPropertyCacheAdd
ed); | 80 tracedValue->setInteger("matchedPropertyCacheAdded", matchedPropertyCacheAdd
ed); |
83 tracedValue->setInteger("rulesRejected", rulesRejected); | 81 tracedValue->setInteger("rulesRejected", rulesRejected); |
84 tracedValue->setInteger("rulesFastRejected", rulesFastRejected); | 82 tracedValue->setInteger("rulesFastRejected", rulesFastRejected); |
85 tracedValue->setInteger("rulesMatched", rulesMatched); | 83 tracedValue->setInteger("rulesMatched", rulesMatched); |
86 tracedValue->setInteger("stylesChanged", stylesChanged); | 84 tracedValue->setInteger("stylesChanged", stylesChanged); |
87 tracedValue->setInteger("stylesUnchanged", stylesUnchanged); | 85 tracedValue->setInteger("stylesUnchanged", stylesUnchanged); |
88 tracedValue->setInteger("stylesAnimated", stylesAnimated); | 86 tracedValue->setInteger("stylesAnimated", stylesAnimated); |
89 tracedValue->setInteger("elementsStyled", elementsStyled); | 87 tracedValue->setInteger("elementsStyled", elementsStyled); |
90 tracedValue->setInteger("pseudoElementsStyled", pseudoElementsStyled); | 88 tracedValue->setInteger("pseudoElementsStyled", pseudoElementsStyled); |
91 tracedValue->setInteger("baseStylesUsed", baseStylesUsed); | 89 tracedValue->setInteger("baseStylesUsed", baseStylesUsed); |
92 return tracedValue; | 90 return tracedValue; |
93 } | 91 } |
94 | 92 |
95 | 93 |
96 } // namespace blink | 94 } // namespace blink |
OLD | NEW |