Commit 4b44d108 authored by Ryan Powell's avatar Ryan Powell Committed by Commit Bot

Zero initialize MemoryPressureVoteAggregator's vote list.

Add zero-initialization of the MemoryPressureVoteAggregator's list of
votes. Also moves initialization of it's |current_pressure_level_| to
the header file.

Bug: 980965
Change-Id: I75ed6f7ff50d0b680f55e8df93c981761fe5a843
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1773705Reviewed-by: default avatarSébastien Marchand <sebmarchand@chromium.org>
Commit-Queue: Ryan Powell <ryanpow@google.com>
Cr-Commit-Position: refs/heads/master@{#691638}
parent a3004ad5
......@@ -11,10 +11,7 @@
namespace util {
MemoryPressureVoteAggregator::MemoryPressureVoteAggregator(Delegate* delegate)
: current_pressure_level_(
base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE),
delegate_(delegate),
votes_() {}
: delegate_(delegate) {}
MemoryPressureVoteAggregator::~MemoryPressureVoteAggregator() {
DCHECK_EQ(std::accumulate(votes_.begin(), votes_.end(), 0), 0);
......
......@@ -59,7 +59,8 @@ class MemoryPressureVoteAggregator {
// MemoryPressureLevel.
MemoryPressureLevel EvaluateVotes() const;
MemoryPressureLevel current_pressure_level_;
MemoryPressureLevel current_pressure_level_ =
base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_NONE;
Delegate* const delegate_;
......@@ -72,7 +73,7 @@ class MemoryPressureVoteAggregator {
// MemoryPressureLevel system will be changing soon regardless.
std::array<size_t,
base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL + 1>
votes_;
votes_ = {};
SEQUENCE_CHECKER(sequence_checker_);
......
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