| 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 20 matching lines...) Expand all Loading... |
| 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) | 36 void HitTestCache::verifyCachedResult(const HitTestResult& expected, const HitTe
stResult& actual) |
| 37 { | 37 { |
| 38 ValidityHistogramMetric metric; | 38 ValidityHistogramMetric metric; |
| 39 if (!actual.equalForCacheability(expected)) { | 39 if (!actual.equalForCacheability(expected)) { |
| 40 metric = expected.hitTestLocation().isRectBasedTest() ? ValidityHistogra
mMetric::INCORRECT_RECT_BASED_EXACT_MATCH : ValidityHistogramMetric::INCORRECT_P
OINT_EXACT_MATCH; | 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))); |
| 41 | 42 |
| 42 // ASSERT that the cache hit is the same as the actual result. | 43 // ASSERT that the cache hit is the same as the actual result. |
| 43 ASSERT_NOT_REACHED(); | 44 ASSERT_NOT_REACHED(); |
| 44 } else { | 45 } else { |
| 45 metric = ValidityHistogramMetric::VALID_EXACT_MATCH; | 46 metric = ValidityHistogramMetric::VALID_EXACT_MATCH; |
| 46 } | 47 } |
| 47 Platform::current()->histogramEnumeration("Event.HitTestValidity", static_ca
st<int>(metric), static_cast<int>(ValidityHistogramMetric::MAX_VALIDITY_METRIC))
; | 48 Platform::current()->histogramEnumeration("Event.HitTestValidity", static_ca
st<int>(metric), static_cast<int>(ValidityHistogramMetric::MAX_VALIDITY_METRIC))
; |
| 48 } | 49 } |
| 49 | 50 |
| 50 void HitTestCache::addCachedResult(const HitTestResult& result, uint64_t domTree
Version) | 51 void HitTestCache::addCachedResult(const HitTestResult& result, uint64_t domTree
Version) |
| (...skipping 27 matching lines...) Expand all Loading... |
| 78 m_updateIndex = 0; | 79 m_updateIndex = 0; |
| 79 m_items.clear(); | 80 m_items.clear(); |
| 80 } | 81 } |
| 81 | 82 |
| 82 DEFINE_TRACE(HitTestCache) | 83 DEFINE_TRACE(HitTestCache) |
| 83 { | 84 { |
| 84 visitor->trace(m_items); | 85 visitor->trace(m_items); |
| 85 } | 86 } |
| 86 | 87 |
| 87 } // namespace blink | 88 } // namespace blink |
| OLD | NEW |