Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(434)

Unified Diff: Source/core/layout/HitTestCache.cpp

Issue 1177123003: Revert "Implement a Hit Test Cache for same point hits." (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/layout/HitTestCache.h ('k') | Source/core/layout/HitTestRequest.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/layout/HitTestCache.cpp
diff --git a/Source/core/layout/HitTestCache.cpp b/Source/core/layout/HitTestCache.cpp
deleted file mode 100644
index 25f6957a1d4e19c92d3da74fcd00326d78795315..0000000000000000000000000000000000000000
--- a/Source/core/layout/HitTestCache.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "config.h"
-#include "core/layout/HitTestCache.h"
-
-#include "public/platform/Platform.h"
-
-namespace blink {
-
-bool HitTestCache::lookupCachedResult(HitTestResult& hitResult, uint64_t domTreeVersion)
-{
- bool result = false;
- HitHistogramMetric metric = HitHistogramMetric::MISS;
- if (hitResult.hitTestRequest().avoidCache()) {
- metric = HitHistogramMetric::MISS_EXPLICIT_AVOID;
- // For now we don't support rect based hit results.
- } else if (domTreeVersion == m_domTreeVersion && !hitResult.hitTestLocation().isRectBasedTest()) {
- for (const auto& cachedItem : m_items) {
- if (cachedItem.validityRect().contains(hitResult.hitTestLocation().point())) {
- if (hitResult.hitTestRequest().equalForCacheability(cachedItem.hitTestRequest())) {
- metric = hitResult.hitTestLocation().point() == cachedItem.hitTestLocation().point() ? HitHistogramMetric::HIT_EXACT_MATCH : HitHistogramMetric::HIT_REGION_MATCH;
- result = true;
- hitResult = cachedItem;
- break;
- }
- metric = HitHistogramMetric::MISS_VALIDITY_RECT_MATCHES;
- }
- }
- }
- Platform::current()->histogramEnumeration("Event.HitTest", static_cast<int>(metric), static_cast<int>(HitHistogramMetric::MAX_HIT_METRIC));
- return result;
-}
-
-void HitTestCache::verifyCachedResult(const HitTestResult& expected, const HitTestResult& actual)
-{
- bool pointMatch = actual.hitTestLocation().point() == expected.hitTestLocation().point();
-
- ValidityHistogramMetric metric;
- if (!actual.equalForCacheability(expected)) {
- if (pointMatch) {
- metric = expected.hitTestLocation().isRectBasedTest() ? ValidityHistogramMetric::INCORRECT_RECT_BASED_EXACT_MATCH : ValidityHistogramMetric::INCORRECT_POINT_EXACT_MATCH;
- } else {
- metric = expected.hitTestLocation().isRectBasedTest() ? ValidityHistogramMetric::INCORRECT_RECT_BASED_REGION : ValidityHistogramMetric::INCORRECT_POINT_REGION;
- }
-
- // ASSERT that the cache hit is the same as the actual result.
- ASSERT_NOT_REACHED();
- } else {
- metric = pointMatch ? ValidityHistogramMetric::VALID_EXACT_MATCH : ValidityHistogramMetric::VALID_REGION;
- }
- Platform::current()->histogramEnumeration("Event.HitTestValidity", static_cast<int>(metric), static_cast<int>(ValidityHistogramMetric::MAX_VALIDITY_METRIC));
-}
-
-void HitTestCache::addCachedResult(const HitTestResult& result, uint64_t domTreeVersion)
-{
- // For now we don't support rect based hit results.
- if (result.hitTestLocation().isRectBasedTest())
- return;
- if (domTreeVersion != m_domTreeVersion)
- clear();
- if (m_items.size() < HIT_TEST_CACHE_SIZE)
- m_items.resize(m_updateIndex + 1);
-
- m_items.at(m_updateIndex).cacheValues(result);
- m_domTreeVersion = domTreeVersion;
-
- m_updateIndex++;
- if (m_updateIndex >= HIT_TEST_CACHE_SIZE)
- m_updateIndex = 0;
-}
-
-void HitTestCache::clear()
-{
- m_updateIndex = 0;
- m_items.clear();
-}
-
-} // namespace blink
« no previous file with comments | « Source/core/layout/HitTestCache.h ('k') | Source/core/layout/HitTestRequest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698