#include "content/browser/devtools/protocol/system_info_handler.h"
#include <stdint.h>
#include <utility>
#include "base/command_line.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ref.h"
#include "base/process/process_metrics.h"
#include "base/strings/utf_string_conversions.h"
#include "base/types/expected.h"
#include "build/build_config.h"
#include "content/browser/gpu/compositor_util.h"
#include "content/browser/gpu/gpu_data_manager_impl.h"
#include "content/browser/gpu/gpu_process_host.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_thread.h"
#include "content/public/browser/child_process_data.h"
#include "content/public/browser/render_process_host.h"
#include "gpu/config/gpu_feature_type.h"
#include "gpu/config/gpu_info.h"
#include "gpu/config/gpu_switches.h"
#include "media/base/video_codecs.h"
namespace content {
namespace protocol {
namespace {
GPUDevice;
GPUInfo;
GetInfoCallback;
std::unique_ptr<SystemInfo::Size> GfxSizeToSystemInfoSize(
const gfx::Size& size) { … }
#if ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && !defined(NDEBUG)) || \
BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_OZONE)
static constexpr int kGPUInfoWatchdogTimeoutMultiplierOS = …;
#else
static constexpr int kGPUInfoWatchdogTimeoutMultiplierOS = 1;
#endif
#ifdef ADDRESS_SANITIZER
static constexpr int kGPUInfoWatchdogTimeoutMultiplierASAN = 3;
#else
static constexpr int kGPUInfoWatchdogTimeoutMultiplierASAN = …;
#endif
static constexpr int kGPUInfoWatchdogTimeoutMs = …;
class AuxGPUInfoEnumerator : public gpu::GPUInfo::Enumerator { … };
std::unique_ptr<GPUDevice> GPUDeviceToProtocol(
const gpu::GPUInfo::GPUDevice& device) { … }
std::unique_ptr<SystemInfo::VideoDecodeAcceleratorCapability>
VideoDecodeAcceleratorSupportedProfileToProtocol(
const gpu::VideoDecodeAcceleratorSupportedProfile& profile) { … }
std::unique_ptr<SystemInfo::VideoEncodeAcceleratorCapability>
VideoEncodeAcceleratorSupportedProfileToProtocol(
const gpu::VideoEncodeAcceleratorSupportedProfile& profile) { … }
std::unique_ptr<SystemInfo::ImageDecodeAcceleratorCapability>
ImageDecodeAcceleratorSupportedProfileToProtocol(
const gpu::ImageDecodeAcceleratorSupportedProfile& profile) { … }
void SendGetInfoResponse(std::unique_ptr<GetInfoCallback> callback) { … }
}
class SystemInfoHandlerGpuObserver : public content::GpuDataManagerObserver { … };
SystemInfoHandler::SystemInfoHandler(bool is_browser_session)
: … { … }
SystemInfoHandler::~SystemInfoHandler() = default;
void SystemInfoHandler::Wire(UberDispatcher* dispatcher) { … }
void SystemInfoHandler::GetInfo(std::unique_ptr<GetInfoCallback> callback) { … }
namespace {
std::unique_ptr<base::ProcessMetrics> CreateProcessMetrics(
base::ProcessHandle handle) { … }
std::unique_ptr<protocol::SystemInfo::ProcessInfo> MakeProcessInfo(
const base::Process& process,
const String& process_type) { … }
void AddBrowserProcessInfo(
protocol::Array<protocol::SystemInfo::ProcessInfo>* process_info) { … }
void AddRendererProcessInfo(
protocol::Array<protocol::SystemInfo::ProcessInfo>* process_info) { … }
void AddChildProcessInfo(
protocol::Array<protocol::SystemInfo::ProcessInfo>* process_info) { … }
}
void SystemInfoHandler::GetProcessInfo(
std::unique_ptr<GetProcessInfoCallback> callback) { … }
Response SystemInfoHandler::GetFeatureState(const String& in_featureState,
bool* featureEnabled) { … }
}
}