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 |
33 namespace blink { | 35 namespace blink { |
34 | 36 |
35 void StyleResolverStats::reset() | 37 void StyleResolverStats::reset() |
36 { | 38 { |
37 sharedStyleLookups = 0; | 39 sharedStyleLookups = 0; |
38 sharedStyleCandidates = 0; | 40 sharedStyleCandidates = 0; |
39 sharedStyleFound = 0; | 41 sharedStyleFound = 0; |
40 sharedStyleMissed = 0; | 42 sharedStyleMissed = 0; |
41 sharedStyleRejectedByUncommonAttributeRules = 0; | 43 sharedStyleRejectedByUncommonAttributeRules = 0; |
42 sharedStyleRejectedBySiblingRules = 0; | 44 sharedStyleRejectedBySiblingRules = 0; |
(...skipping 13 matching lines...) Expand all Loading... |
56 baseStylesUsed = 0; | 58 baseStylesUsed = 0; |
57 } | 59 } |
58 | 60 |
59 bool StyleResolverStats::allCountersEnabled() const | 61 bool StyleResolverStats::allCountersEnabled() const |
60 { | 62 { |
61 bool allCountersEnabled; | 63 bool allCountersEnabled; |
62 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("blink.style"),
&allCountersEnabled); | 64 TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT("blink.style"),
&allCountersEnabled); |
63 return allCountersEnabled; | 65 return allCountersEnabled; |
64 } | 66 } |
65 | 67 |
66 PassOwnPtr<TracedValue> StyleResolverStats::toTracedValue() const | 68 std::unique_ptr<TracedValue> StyleResolverStats::toTracedValue() const |
67 { | 69 { |
68 OwnPtr<TracedValue> tracedValue = TracedValue::create(); | 70 std::unique_ptr<TracedValue> tracedValue = TracedValue::create(); |
69 tracedValue->setInteger("sharedStyleLookups", sharedStyleLookups); | 71 tracedValue->setInteger("sharedStyleLookups", sharedStyleLookups); |
70 tracedValue->setInteger("sharedStyleCandidates", sharedStyleCandidates); | 72 tracedValue->setInteger("sharedStyleCandidates", sharedStyleCandidates); |
71 tracedValue->setInteger("sharedStyleFound", sharedStyleFound); | 73 tracedValue->setInteger("sharedStyleFound", sharedStyleFound); |
72 if (allCountersEnabled()) | 74 if (allCountersEnabled()) |
73 tracedValue->setInteger("sharedStyleMissed", sharedStyleMissed); | 75 tracedValue->setInteger("sharedStyleMissed", sharedStyleMissed); |
74 tracedValue->setInteger("sharedStyleRejectedByUncommonAttributeRules", share
dStyleRejectedByUncommonAttributeRules); | 76 tracedValue->setInteger("sharedStyleRejectedByUncommonAttributeRules", share
dStyleRejectedByUncommonAttributeRules); |
75 tracedValue->setInteger("sharedStyleRejectedBySiblingRules", sharedStyleReje
ctedBySiblingRules); | 77 tracedValue->setInteger("sharedStyleRejectedBySiblingRules", sharedStyleReje
ctedBySiblingRules); |
76 tracedValue->setInteger("sharedStyleRejectedByParent", sharedStyleRejectedBy
Parent); | 78 tracedValue->setInteger("sharedStyleRejectedByParent", sharedStyleRejectedBy
Parent); |
77 tracedValue->setInteger("matchedPropertyApply", matchedPropertyApply); | 79 tracedValue->setInteger("matchedPropertyApply", matchedPropertyApply); |
78 tracedValue->setInteger("matchedPropertyCacheHit", matchedPropertyCacheHit); | 80 tracedValue->setInteger("matchedPropertyCacheHit", matchedPropertyCacheHit); |
79 tracedValue->setInteger("matchedPropertyCacheInheritedHit", matchedPropertyC
acheInheritedHit); | 81 tracedValue->setInteger("matchedPropertyCacheInheritedHit", matchedPropertyC
acheInheritedHit); |
80 tracedValue->setInteger("matchedPropertyCacheAdded", matchedPropertyCacheAdd
ed); | 82 tracedValue->setInteger("matchedPropertyCacheAdded", matchedPropertyCacheAdd
ed); |
81 tracedValue->setInteger("rulesRejected", rulesRejected); | 83 tracedValue->setInteger("rulesRejected", rulesRejected); |
82 tracedValue->setInteger("rulesFastRejected", rulesFastRejected); | 84 tracedValue->setInteger("rulesFastRejected", rulesFastRejected); |
83 tracedValue->setInteger("rulesMatched", rulesMatched); | 85 tracedValue->setInteger("rulesMatched", rulesMatched); |
84 tracedValue->setInteger("stylesChanged", stylesChanged); | 86 tracedValue->setInteger("stylesChanged", stylesChanged); |
85 tracedValue->setInteger("stylesUnchanged", stylesUnchanged); | 87 tracedValue->setInteger("stylesUnchanged", stylesUnchanged); |
86 tracedValue->setInteger("stylesAnimated", stylesAnimated); | 88 tracedValue->setInteger("stylesAnimated", stylesAnimated); |
87 tracedValue->setInteger("elementsStyled", elementsStyled); | 89 tracedValue->setInteger("elementsStyled", elementsStyled); |
88 tracedValue->setInteger("pseudoElementsStyled", pseudoElementsStyled); | 90 tracedValue->setInteger("pseudoElementsStyled", pseudoElementsStyled); |
89 tracedValue->setInteger("baseStylesUsed", baseStylesUsed); | 91 tracedValue->setInteger("baseStylesUsed", baseStylesUsed); |
90 return tracedValue; | 92 return tracedValue; |
91 } | 93 } |
92 | 94 |
93 | 95 |
94 } // namespace blink | 96 } // namespace blink |
OLD | NEW |