#include "chrome/browser/performance_manager/public/user_tuning/performance_detection_manager.h"
#include <memory>
#include <optional>
#include <utility>
#include <vector>
#include "base/check_op.h"
#include "base/containers/to_vector.h"
#include "base/functional/bind.h"
#include "base/functional/callback_forward.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/task/bind_post_task.h"
#include "base/time/time.h"
#include "chrome/browser/performance_manager/policies/page_discarding_helper.h"
#include "chrome/browser/performance_manager/user_tuning/cpu_health_tracker.h"
#include "chrome/browser/resource_coordinator/lifecycle_unit_state.mojom-shared.h"
#include "chrome/browser/ui/performance_controls/performance_controls_metrics.h"
#include "components/performance_manager/public/graph/graph.h"
#include "components/performance_manager/public/graph/page_node.h"
#include "components/performance_manager/public/performance_manager.h"
#include "components/performance_manager/public/resource_attribution/page_context.h"
#include "content/public/browser/browser_thread.h"
namespace performance_manager::user_tuning {
namespace {
PerformanceDetectionManager* g_performance_detection_manager = …;
}
void PerformanceDetectionManager::AddStatusObserver(
ResourceTypeSet resource_types,
StatusObserver* observer) { … }
void PerformanceDetectionManager::RemoveStatusObserver(StatusObserver* o) { … }
void PerformanceDetectionManager::AddActionableTabsObserver(
ResourceTypeSet resource_types,
ActionableTabsObserver* new_observer) { … }
void PerformanceDetectionManager::RemoveActionableTabsObserver(
ActionableTabsObserver* o) { … }
void PerformanceDetectionManager::DiscardTabs(
std::vector<resource_attribution::PageContext> tabs,
base::OnceCallback<void(bool)> post_discard_cb) { … }
void PerformanceDetectionManager::ForceTabCpuDataRefresh() { … }
void PerformanceDetectionManager::OnDiscardComplete() { … }
void PerformanceDetectionManager::RecordCpuHealthStatus(
base::TimeDelta time_after_discard) { … }
void PerformanceDetectionManager::NotifyActionableTabObserversForTesting(
ResourceType resource_type,
const ActionableTabsResult& tabs) { … }
bool PerformanceDetectionManager::HasInstance() { … }
PerformanceDetectionManager* PerformanceDetectionManager::GetInstance() { … }
PerformanceDetectionManager::~PerformanceDetectionManager() { … }
PerformanceDetectionManager::PerformanceDetectionManager() { … }
void PerformanceDetectionManager::NotifyStatusObservers(
ResourceType resource_type,
HealthLevel new_level,
bool is_actionable) { … }
void PerformanceDetectionManager::NotifyActionableTabObservers(
ResourceType resource_type,
ActionableTabsResult tabs) { … }
}