OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 "config.h" | 5 #include "config.h" |
6 #include "core/layout/HitTestCache.h" | 6 #include "core/layout/HitTestCache.h" |
7 | 7 |
8 #include "public/platform/Platform.h" | 8 #include "public/platform/Platform.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
(...skipping 15 matching lines...) Expand all Loading... |
26 break; | 26 break; |
27 } | 27 } |
28 metric = HitHistogramMetric::MISS_VALIDITY_RECT_MATCHES; | 28 metric = HitHistogramMetric::MISS_VALIDITY_RECT_MATCHES; |
29 } | 29 } |
30 } | 30 } |
31 } | 31 } |
32 Platform::current()->histogramEnumeration("Event.HitTest", static_cast<int>(
metric), static_cast<int>(HitHistogramMetric::MAX_HIT_METRIC)); | 32 Platform::current()->histogramEnumeration("Event.HitTest", static_cast<int>(
metric), static_cast<int>(HitHistogramMetric::MAX_HIT_METRIC)); |
33 return result; | 33 return result; |
34 } | 34 } |
35 | 35 |
36 void HitTestCache::verifyCachedResult(const HitTestResult& expected, const HitTe
stResult& actual) | |
37 { | |
38 ValidityHistogramMetric metric; | |
39 if (!actual.equalForCacheability(expected)) { | |
40 metric = expected.hitTestLocation().isRectBasedTest() ? ValidityHistogra
mMetric::INCORRECT_RECT_BASED_EXACT_MATCH : ValidityHistogramMetric::INCORRECT_P
OINT_EXACT_MATCH; | |
41 Platform::current()->histogramSparse("Event.HitTestValidityScore", stati
c_cast<int>(actual.equalityScore(expected))); | |
42 | |
43 // ASSERT that the cache hit is the same as the actual result. | |
44 ASSERT_NOT_REACHED(); | |
45 } else { | |
46 metric = ValidityHistogramMetric::VALID_EXACT_MATCH; | |
47 } | |
48 Platform::current()->histogramEnumeration("Event.HitTestValidity", static_ca
st<int>(metric), static_cast<int>(ValidityHistogramMetric::MAX_VALIDITY_METRIC))
; | |
49 } | |
50 | |
51 void HitTestCache::addCachedResult(const HitTestResult& result, uint64_t domTree
Version) | 36 void HitTestCache::addCachedResult(const HitTestResult& result, uint64_t domTree
Version) |
52 { | 37 { |
53 if (!result.isCacheable()) | 38 if (!result.isCacheable()) |
54 return; | 39 return; |
55 | 40 |
56 // If the result was a hit test on an LayoutPart and the request allowed | 41 // If the result was a hit test on an LayoutPart and the request allowed |
57 // querying of the layout part; then the part hasn't been loaded yet. | 42 // querying of the layout part; then the part hasn't been loaded yet. |
58 if (result.isOverWidget() && result.hitTestRequest().allowsChildFrameContent
()) | 43 if (result.isOverWidget() && result.hitTestRequest().allowsChildFrameContent
()) |
59 return; | 44 return; |
60 | 45 |
(...skipping 18 matching lines...) Expand all Loading... |
79 m_updateIndex = 0; | 64 m_updateIndex = 0; |
80 m_items.clear(); | 65 m_items.clear(); |
81 } | 66 } |
82 | 67 |
83 DEFINE_TRACE(HitTestCache) | 68 DEFINE_TRACE(HitTestCache) |
84 { | 69 { |
85 visitor->trace(m_items); | 70 visitor->trace(m_items); |
86 } | 71 } |
87 | 72 |
88 } // namespace blink | 73 } // namespace blink |
OLD | NEW |