Commit 77a25c0f authored by Steve Kobes's avatar Steve Kobes Committed by Commit Bot

JankTracker: Use full precision when sweep line algorithm is enabled.

Also use std::unordered_map instead of std::map in BasicIntervals, which
is much faster.

Bug: 581518
Change-Id: If36a6a70bdf5a4d02d87c66a2ee8264441602388
Reviewed-on: https://chromium-review.googlesource.com/c/1394402Reviewed-by: default avatarTimothy Dresser <tdresser@chromium.org>
Commit-Queue: Steve Kobes <skobes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#619979}
parent 28c0f33d
...@@ -43,7 +43,8 @@ class BasicIntervals { ...@@ -43,7 +43,8 @@ class BasicIntervals {
private: private:
Vector<int> endpoints_; Vector<int> endpoints_;
std::map<int, unsigned> endpoint_to_index_; // Avoid WTF::HashMap as key may be 0 or -1.
std::unordered_map<int, unsigned> endpoint_to_index_;
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
bool has_index_ = false; bool has_index_ = false;
......
...@@ -42,6 +42,9 @@ static float GetMoveDistance(const FloatRect& old_rect, ...@@ -42,6 +42,9 @@ static float GetMoveDistance(const FloatRect& old_rect,
} }
static float RegionGranularityScale(const IntRect& viewport) { static float RegionGranularityScale(const IntRect& viewport) {
if (RuntimeEnabledFeatures::JankTrackingSweepLineEnabled())
return 1;
return kRegionGranularitySteps / return kRegionGranularitySteps /
std::min(viewport.Height(), viewport.Width()); std::min(viewport.Height(), viewport.Width());
} }
......
...@@ -51,6 +51,9 @@ TEST_F(JankTrackerTest, SimpleBlockMovement) { ...@@ -51,6 +51,9 @@ TEST_F(JankTrackerTest, SimpleBlockMovement) {
} }
TEST_F(JankTrackerTest, GranularitySnapping) { TEST_F(JankTrackerTest, GranularitySnapping) {
if (RuntimeEnabledFeatures::JankTrackingSweepLineEnabled())
return;
SetBodyInnerHTML(R"HTML( SetBodyInnerHTML(R"HTML(
<style> <style>
#j { position: relative; width: 304px; height: 104px; } #j { position: relative; width: 304px; height: 104px; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment