chromium/chrome/browser/metrics/power/process_monitor.cc

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

#include "chrome/browser/metrics/power/process_monitor.h"

#include <stddef.h>

#include <utility>

#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_functions.h"
#include "base/not_fatal_until.h"
#include "base/observer_list.h"
#include "base/process/process_handle.h"
#include "base/process/process_metrics.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "base/types/expected.h"
#include "base/types/optional_util.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/chrome_content_browser_client_extensions_part.h"
#include "chrome/browser/metrics/power/power_metrics_constants.h"
#include "content/public/browser/browser_child_process_host.h"
#include "content/public/browser/browser_child_process_host_iterator.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/child_process_data.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/content_constants.h"
#include "extensions/buildflags/buildflags.h"
#include "services/network/public/mojom/network_service.mojom.h"

#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "extensions/browser/extension_host.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/process_map.h"
#include "extensions/common/manifest_handlers/background_info.h"
#endif

#if BUILDFLAG(IS_WIN)
#include "sandbox/policy/mojom/sandbox.mojom-shared.h"
#endif

BrowserThread;

namespace {

std::unique_ptr<base::ProcessMetrics> CreateProcessMetrics(
    base::ProcessHandle process_handle) {}

// Samples the process metrics the ProcessMonitor cares about.
ProcessMonitor::Metrics SampleMetrics(base::ProcessMetrics& process_metrics) {}

// Scales every metrics by |factor|.
void ScaleMetrics(ProcessMonitor::Metrics* metrics, double factor) {}

ProcessMonitor::Metrics GetLastIntervalMetrics(
    base::ProcessMetrics& process_metrics,
    base::TimeDelta cumulative_cpu_usage) {}

MonitoredProcessType GetMonitoredProcessTypeForRenderProcess(
    content::RenderProcessHost* host) {}

MonitoredProcessType GetMonitoredProcessTypeForNonRendererChildProcess(
    const content::ChildProcessData& data) {}

// Adds the values from |rhs| to |lhs|. If both parameters have nullopt for
// `cpu_usage`, the result will also have nullopt, otherwise the result will
// have the sum of all non-nullopt `cpu_usage`.
ProcessMonitor::Metrics& operator+=(ProcessMonitor::Metrics& lhs,
                                    const ProcessMonitor::Metrics& rhs) {}

}  // namespace

MonitoredProcessType
GetMonitoredProcessTypeForNonRendererChildProcessForTesting(
    const content::ChildProcessData& data) {}

ProcessInfo::ProcessInfo(MonitoredProcessType type,
                         std::unique_ptr<base::ProcessMetrics> process_metrics)
    :{}
ProcessInfo::~ProcessInfo() = default;

ProcessMonitor::Metrics::Metrics() = default;
ProcessMonitor::Metrics::Metrics(const ProcessMonitor::Metrics& other) =
    default;
ProcessMonitor::Metrics& ProcessMonitor::Metrics::operator=(
    const ProcessMonitor::Metrics& other) = default;
ProcessMonitor::Metrics::~Metrics() = default;

ProcessMonitor::ProcessMonitor()
    :{}

ProcessMonitor::~ProcessMonitor() {}

void ProcessMonitor::SampleAllProcesses(Observer* observer) {}

void ProcessMonitor::OnRenderProcessHostCreated(
    content::RenderProcessHost* render_process_host) {}

void ProcessMonitor::RenderProcessReady(
    content::RenderProcessHost* render_process_host) {}

void ProcessMonitor::RenderProcessExited(
    content::RenderProcessHost* render_process_host,
    const content::ChildProcessTerminationInfo& info) {}

void ProcessMonitor::RenderProcessHostDestroyed(
    content::RenderProcessHost* render_process_host) {}

void ProcessMonitor::BrowserChildProcessLaunchedAndConnected(
    const content::ChildProcessData& data) {}

void ProcessMonitor::BrowserChildProcessHostDisconnected(
    const content::ChildProcessData& data) {}

void ProcessMonitor::BrowserChildProcessCrashed(
    const content::ChildProcessData& data,
    const content::ChildProcessTerminationInfo& info) {}

void ProcessMonitor::BrowserChildProcessKilled(
    const content::ChildProcessData& data,
    const content::ChildProcessTerminationInfo& info) {}

void ProcessMonitor::BrowserChildProcessExitedNormally(
    const content::ChildProcessData& data,
    const content::ChildProcessTerminationInfo& info) {}

void ProcessMonitor::OnBrowserChildProcessExited(
    const content::ChildProcessData& data,
    const content::ChildProcessTerminationInfo& info) {}