#include "components/performance_manager/public/resource_attribution/process_context.h"
#include <optional>
#include <utility>
#include "base/check.h"
#include "base/functional/overloaded.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "components/performance_manager/graph/process_node_impl.h"
#include "components/performance_manager/public/browser_child_process_host_id.h"
#include "components/performance_manager/public/graph/graph.h"
#include "components/performance_manager/public/performance_manager.h"
#include "components/performance_manager/public/render_process_host_id.h"
#include "components/performance_manager/resource_attribution/performance_manager_aliases.h"
#include "content/public/browser/browser_child_process_host.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 "third_party/abseil-cpp/absl/types/variant.h"
namespace resource_attribution {
ProcessContext::ProcessContext(AnyProcessHostId id,
base::WeakPtr<ProcessNode> weak_node)
: … { … }
ProcessContext::~ProcessContext() = default;
ProcessContext::ProcessContext(const ProcessContext& other) = default;
ProcessContext& ProcessContext::operator=(const ProcessContext& other) =
default;
ProcessContext::ProcessContext(ProcessContext&& other) = default;
ProcessContext& ProcessContext::operator=(ProcessContext&& other) = default;
std::optional<ProcessContext> ProcessContext::FromBrowserProcess() { … }
std::optional<ProcessContext> ProcessContext::FromRenderProcessHost(
content::RenderProcessHost* host) { … }
std::optional<ProcessContext> ProcessContext::FromBrowserChildProcessHost(
content::BrowserChildProcessHost* host) { … }
bool ProcessContext::IsBrowserProcessContext() const { … }
bool ProcessContext::IsRenderProcessContext() const { … }
bool ProcessContext::IsBrowserChildProcessContext() const { … }
content::RenderProcessHost* ProcessContext::GetRenderProcessHost() const { … }
RenderProcessHostId ProcessContext::GetRenderProcessHostId() const { … }
content::BrowserChildProcessHost* ProcessContext::GetBrowserChildProcessHost()
const { … }
BrowserChildProcessHostId ProcessContext::GetBrowserChildProcessHostId() const { … }
base::WeakPtr<ProcessNode> ProcessContext::GetWeakProcessNode() const { … }
ProcessContext ProcessContext::FromProcessNode(const ProcessNode* node) { … }
std::optional<ProcessContext> ProcessContext::FromWeakProcessNode(
base::WeakPtr<ProcessNode> node) { … }
ProcessNode* ProcessContext::GetProcessNode() const { … }
std::string ProcessContext::ToString() const { … }
}