// Copyright 2019 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_MEMORY_PRESSURE_MEMORY_PRESSURE_VOTER_H_ #define COMPONENTS_MEMORY_PRESSURE_MEMORY_PRESSURE_VOTER_H_ #include <array> #include <optional> #include "base/functional/callback.h" #include "base/memory/memory_pressure_listener.h" #include "base/memory/raw_ptr.h" #include "base/sequence_checker.h" namespace memory_pressure { // Interface used by code which actually monitors memory pressure, to inform // a MemoryPressureAggregator when the pressure they observe changes, or they // want to trigger a (re-)notification of clients of the current level. // Voters must be used only from the same sequence as the Aggregator to which // they are attached. class MemoryPressureVoter { … }; // Collects votes from MemoryPressureVoters and evaluates them to determine the // pressure level for the MultiSourceMemoryPressureMonitor, which will own // and outlive the aggregator. The pressure level is calculated as the most // critical of all votes collected. This class is not thread safe and should be // used from a single sequence. class MemoryPressureVoteAggregator { … }; // Interface used to notify MemoryPressureVoteAggregator's owner of changes to // vote aggregation. class MemoryPressureVoteAggregator::Delegate { … }; } // namespace memory_pressure #endif // COMPONENTS_MEMORY_PRESSURE_MEMORY_PRESSURE_VOTER_H_