Commit 9bf80a67 authored by Chris Hamilton's avatar Chris Hamilton Committed by Commit Bot

[PM] Create BoostingVoteAggregator.

Creates another VoteAggregator class that allows expressing "priority
boosting" votes, which can be used to resolve priority inversions.

BUG=971272

Change-Id: If84f0a7a22598de5f7a8897eb12066fbc5a00ccb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1853867Reviewed-by: default avatarEtienne Pierre-Doray <etiennep@chromium.org>
Commit-Queue: Chris Hamilton <chrisha@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713958}
parent 5de67c46
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
static_library("performance_manager") { static_library("performance_manager") {
sources = [ sources = [
"frame_priority/boosting_vote_aggregator.cc",
"frame_priority/frame_priority.cc", "frame_priority/frame_priority.cc",
"frame_priority/max_vote_aggregator.cc", "frame_priority/max_vote_aggregator.cc",
"frame_priority/override_vote_aggregator.cc", "frame_priority/override_vote_aggregator.cc",
...@@ -47,6 +48,7 @@ static_library("performance_manager") { ...@@ -47,6 +48,7 @@ static_library("performance_manager") {
"performance_manager_tab_helper.h", "performance_manager_tab_helper.h",
"process_node_source.cc", "process_node_source.cc",
"process_node_source.h", "process_node_source.h",
"public/frame_priority/boosting_vote_aggregator.h",
"public/frame_priority/frame_priority.h", "public/frame_priority/frame_priority.h",
"public/frame_priority/max_vote_aggregator.h", "public/frame_priority/max_vote_aggregator.h",
"public/frame_priority/override_vote_aggregator.h", "public/frame_priority/override_vote_aggregator.h",
...@@ -87,6 +89,7 @@ source_set("unit_tests") { ...@@ -87,6 +89,7 @@ source_set("unit_tests") {
testonly = true testonly = true
sources = [ sources = [
"frame_priority/boosting_vote_aggregator_unittest.cc",
"frame_priority/frame_priority_unittest.cc", "frame_priority/frame_priority_unittest.cc",
"frame_priority/max_vote_aggregator_unittest.cc", "frame_priority/max_vote_aggregator_unittest.cc",
"frame_priority/override_vote_aggregator_unittest.cc", "frame_priority/override_vote_aggregator_unittest.cc",
......
...@@ -53,6 +53,13 @@ void DummyVoteConsumer::VoteInvalidated(AcceptedVote* vote) { ...@@ -53,6 +53,13 @@ void DummyVoteConsumer::VoteInvalidated(AcceptedVote* vote) {
--valid_vote_count_; --valid_vote_count_;
} }
void DummyVoteConsumer::ExpectInvalidVote(size_t index) {
EXPECT_LT(index, votes_.size());
const AcceptedVote& accepted_vote = votes_[index];
EXPECT_EQ(this, accepted_vote.consumer());
EXPECT_FALSE(accepted_vote.IsValid());
}
void DummyVoteConsumer::ExpectValidVote(size_t index, void DummyVoteConsumer::ExpectValidVote(size_t index,
VoterId voter_id, VoterId voter_id,
const FrameNode* frame_node, const FrameNode* frame_node,
......
...@@ -28,6 +28,8 @@ class DummyVoteConsumer : public VoteConsumer { ...@@ -28,6 +28,8 @@ class DummyVoteConsumer : public VoteConsumer {
const Vote& new_vote) override; const Vote& new_vote) override;
void VoteInvalidated(AcceptedVote* vote) override; void VoteInvalidated(AcceptedVote* vote) override;
void ExpectInvalidVote(size_t index);
// Checks that the vote at position |index| is valid, and has the // Checks that the vote at position |index| is valid, and has the
// corresponding |voter|, |frame_node| and |priority|. If |reason| is non-null // corresponding |voter|, |frame_node| and |priority|. If |reason| is non-null
// then it will be validated as well. // then it will be validated as well.
......
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