chromium/components/performance_manager/resource_attribution/cpu_measurement_delegate.cc

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/performance_manager/public/resource_attribution/cpu_measurement_delegate.h"

#include "base/check.h"
#include "base/no_destructor.h"
#include "base/process/process.h"
#include "base/process/process_handle.h"
#include "base/process/process_metrics.h"
#include "base/types/expected.h"
#include "build/build_config.h"
#include "components/performance_manager/public/graph/process_node.h"
#include "components/performance_manager/resource_attribution/cpu_measurement_monitor.h"
#include "components/performance_manager/resource_attribution/performance_manager_aliases.h"
#include "components/performance_manager/resource_attribution/query_scheduler.h"
#include "content/public/browser/browser_child_process_host.h"
#include "content/public/common/process_type.h"

namespace resource_attribution {

namespace {

// A production CPUMeasurementDelegate that measures processes with
// base::ProcessMetrics.
class CPUMeasurementDelegateImpl final : public CPUMeasurementDelegate {};

CPUMeasurementDelegateImpl::CPUMeasurementDelegateImpl(
    const ProcessNode* process_node) {}

base::expected<base::TimeDelta, CPUMeasurementDelegate::ProcessCPUUsageError>
CPUMeasurementDelegateImpl::GetCumulativeCPUUsage() {}

// The default production factory for CPUMeasurementDelegateImpl objects.
class CPUMeasurementDelegateFactoryImpl final
    : public CPUMeasurementDelegate::Factory {};

bool CPUMeasurementDelegateFactoryImpl::ShouldMeasureProcess(
    const ProcessNode* process_node) {}

std::unique_ptr<CPUMeasurementDelegate>
CPUMeasurementDelegateFactoryImpl::CreateDelegateForProcess(
    const ProcessNode* process_node) {}

}  // namespace

// static
void CPUMeasurementDelegate::SetDelegateFactoryForTesting(Graph* graph,
                                                          Factory* factory) {}

// static
CPUMeasurementDelegate::Factory* CPUMeasurementDelegate::GetDefaultFactory() {}

}  // namespace resource_attribution