M110 stage 2
This commit is contained in:
parent
32a6dd5cd6
commit
2063b436a5
11 changed files with 313 additions and 257 deletions
|
@ -1,4 +1,4 @@
|
|||
# Copyright 2022 The Chromium Authors and Alex313031. All rights reserved.
|
||||
# Copyright 2023 The Chromium Authors and Alex313031
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
|
@ -161,7 +161,10 @@ if (!is_android && !is_mac) {
|
|||
|
||||
if (is_chromeos_ash) {
|
||||
data_deps += [ "//sandbox/linux:chrome_sandbox" ]
|
||||
deps += [ "//components/exo/wayland:weston_test_stub" ]
|
||||
deps += [
|
||||
"//components/exo/wayland:ui_controls_protocol_stub",
|
||||
"//components/exo/wayland:weston_test_stub",
|
||||
]
|
||||
}
|
||||
|
||||
if (also_build_lacros_chrome_for_architecture != "") {
|
||||
|
@ -337,7 +340,7 @@ if (!is_android && !is_mac) {
|
|||
"//ui/base",
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
configs += [ "//build/config/gcc:rpath_for_built_shared_libraries" ]
|
||||
}
|
||||
|
||||
|
@ -1298,6 +1301,7 @@ if (is_win) {
|
|||
rebase_path(get_label_info(dump_syms, "root_out_dir") + "/" +
|
||||
get_label_info(dump_syms, "name"),
|
||||
root_build_dir),
|
||||
"-m",
|
||||
"-g",
|
||||
rebase_path(
|
||||
"$root_out_dir/{{source_file_part}}.dSYM/Contents/Resources/DWARF/{{source_file_part}}",
|
||||
|
@ -1391,7 +1395,6 @@ group("dependencies") {
|
|||
"//components/about_ui",
|
||||
"//components/gwp_asan/buildflags",
|
||||
"//components/heap_profiling/in_process",
|
||||
"//components/power_scheduler",
|
||||
"//components/services/heap_profiling",
|
||||
"//components/startup_metric_utils/browser",
|
||||
"//components/sync",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2022 The Chromium Authors and Alex313031
|
||||
// Copyright 2023 The Chromium Authors and Alex313031
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
|
@ -264,6 +264,22 @@ const char kHardwareVideoDecodeFrameRate[] = "hardware-video-decode-framerate";
|
|||
// Out-of-Process video decoding.
|
||||
const char kMaxChromeOSDecoderThreads[] = "max-chromeos-decoder-threads";
|
||||
#endif
|
||||
|
||||
const char kCastStreamingForceDisableHardwareH264[] =
|
||||
"cast-streaming-force-disable-hardware-h264";
|
||||
const char kCastStreamingForceDisableHardwareVp8[] =
|
||||
"cast-streaming-force-disable-hardware-vp8";
|
||||
const char kCastStreamingForceEnableHardwareH264[] =
|
||||
"cast-streaming-force-enable-hardware-h264";
|
||||
const char kCastStreamingForceEnableHardwareVp8[] =
|
||||
"cast-streaming-force-enable-hardware-vp8";
|
||||
|
||||
// Disables the code path that makes Pepper use the MojoVideoDecoder for
|
||||
// hardware accelerated video decoding. It overrides the value of the
|
||||
// kUseMojoVideoDecoderForPepper feature flag.
|
||||
const char kDisableUseMojoVideoDecoderForPepper[] =
|
||||
"disable-use-mojo-video-decoder-for-pepper";
|
||||
|
||||
} // namespace switches
|
||||
|
||||
namespace media {
|
||||
|
@ -288,11 +304,6 @@ BASE_FEATURE(kEnableTabMuting,
|
|||
"EnableTabMuting",
|
||||
base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
|
||||
// Enable Picture-in-Picture.
|
||||
BASE_FEATURE(kPictureInPicture,
|
||||
"PictureInPicture",
|
||||
base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
|
||||
#if BUILDFLAG(ENABLE_PLATFORM_HEVC)
|
||||
// Enables HEVC hardware accelerated decoding.
|
||||
BASE_FEATURE(kPlatformHEVCDecoderSupport,
|
||||
|
@ -396,14 +407,24 @@ BASE_FEATURE(kCdmProcessSiteIsolation,
|
|||
// playback going to a specific output device in the audio service.
|
||||
BASE_FEATURE(kChromeWideEchoCancellation,
|
||||
"ChromeWideEchoCancellation",
|
||||
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
|
||||
base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
#else
|
||||
base::FEATURE_DISABLED_BY_DEFAULT);
|
||||
#endif
|
||||
|
||||
// If non-zero, audio processing is done on a dedicated processing thread which
|
||||
// receives audio from the audio capture thread via a fifo of a specified size.
|
||||
// Zero fifo size means the usage of such processing thread is disabled and
|
||||
// processing is done on the audio capture thread itself.
|
||||
const base::FeatureParam<int> kChromeWideEchoCancellationProcessingFifoSize{
|
||||
&kChromeWideEchoCancellation, "processing_fifo_size", 0};
|
||||
&kChromeWideEchoCancellation, "processing_fifo_size",
|
||||
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_WIN)
|
||||
110 // Default value for the enabled feature.
|
||||
#else
|
||||
0
|
||||
#endif
|
||||
};
|
||||
|
||||
// When audio processing is done in the audio process, at the renderer side IPC
|
||||
// is set up to receive audio at the processing sample rate. This is a
|
||||
|
@ -486,11 +507,6 @@ BASE_FEATURE(kFallbackAfterDecodeError,
|
|||
"FallbackAfterDecodeError",
|
||||
base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
|
||||
// Use Gav1VideoDecoder to decode AV1 streams.
|
||||
BASE_FEATURE(kGav1VideoDecoder,
|
||||
"Gav1VideoDecoder",
|
||||
base::FEATURE_DISABLED_BY_DEFAULT);
|
||||
|
||||
// Show toolbar button that opens dialog for controlling media sessions.
|
||||
BASE_FEATURE(kGlobalMediaControls,
|
||||
"GlobalMediaControls",
|
||||
|
@ -513,6 +529,13 @@ BASE_FEATURE(kGlobalMediaControlsForCast,
|
|||
base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
#endif
|
||||
|
||||
#if !BUILDFLAG(IS_ANDROID)
|
||||
// If enabled, users can request Media Remoting without fullscreen-in-tab.
|
||||
BASE_FEATURE(kMediaRemotingWithoutFullscreen,
|
||||
"MediaRemotingWithoutFullscreen",
|
||||
base::FEATURE_DISABLED_BY_DEFAULT);
|
||||
#endif
|
||||
|
||||
// Allow Global Media Controls in system tray of CrOS.
|
||||
BASE_FEATURE(kGlobalMediaControlsForChromeOS,
|
||||
"GlobalMediaControlsForChromeOS",
|
||||
|
@ -757,7 +780,7 @@ const base::FeatureParam<bool> kHardwareSecureDecryptionForceSupportClearLead{
|
|||
// sub key systems. Which sub key system is experimental is key system specific.
|
||||
BASE_FEATURE(kHardwareSecureDecryptionExperiment,
|
||||
"HardwareSecureDecryptionExperiment",
|
||||
base::FEATURE_DISABLED_BY_DEFAULT);
|
||||
base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
|
||||
// Allows automatically disabling hardware secure Content Decryption Module
|
||||
// (CDM) after failures or crashes to fallback to software secure CDMs. If this
|
||||
|
@ -866,11 +889,6 @@ BASE_FEATURE(kMediaDrmPreprovisioningAtStartup,
|
|||
"MediaDrmPreprovisioningAtStartup",
|
||||
base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
|
||||
// Enable picture in picture web api for android.
|
||||
BASE_FEATURE(kPictureInPictureAPI,
|
||||
"PictureInPictureAPI",
|
||||
base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
|
||||
// Enables CanPlayType() (and other queries) for HLS MIME types. Note that
|
||||
// disabling this also causes navigation to .m3u8 files to trigger downloading
|
||||
// instead of playback.
|
||||
|
@ -977,19 +995,9 @@ BASE_FEATURE(kIncludeIRCamerasInDeviceEnumeration,
|
|||
"IncludeIRCamerasInDeviceEnumeration",
|
||||
base::FEATURE_DISABLED_BY_DEFAULT);
|
||||
|
||||
// Enables AV1 encode acceleration for Windows.
|
||||
const base::Feature MEDIA_EXPORT kMediaFoundationAV1Encoding{
|
||||
"MediaFoundationAV1Encoding", base::FEATURE_DISABLED_BY_DEFAULT};
|
||||
|
||||
// Enables H.264 CBP encode acceleration for Windows.
|
||||
// For feature check of kMediaFoundationH264CbpEncoding at runtime,
|
||||
// please use IsMediaFoundationH264CbpEncodingEnabled() instead.
|
||||
const base::Feature MEDIA_EXPORT kMediaFoundationH264CbpEncoding{
|
||||
"MediaFoundationH264CbpEncoding", base::FEATURE_DISABLED_BY_DEFAULT};
|
||||
|
||||
// Enables VP9 encode acceleration for Windows.
|
||||
const base::Feature MEDIA_EXPORT kMediaFoundationVP9Encoding{
|
||||
"MediaFoundationVP9Encoding", base::FEATURE_DISABLED_BY_DEFAULT};
|
||||
// Enables software rate controller encoding acceleration for Windows.
|
||||
const base::Feature MEDIA_EXPORT kMediaFoundationUseSoftwareRateCtrl{
|
||||
"MediaFoundationUseSoftwareRateCtrl", base::FEATURE_DISABLED_BY_DEFAULT};
|
||||
|
||||
// Enables MediaFoundation based video capture
|
||||
BASE_FEATURE(kMediaFoundationVideoCapture,
|
||||
|
@ -1070,20 +1078,25 @@ const base::FeatureParam<MediaFoundationClearRenderingStrategy>
|
|||
#endif // BUILDFLAG(IS_WIN)
|
||||
|
||||
#if BUILDFLAG(ENABLE_PLATFORM_ENCRYPTED_DOLBY_VISION)
|
||||
// When ENABLE_PLATFORM_ENCRYPTED_DOLBY_VISION is true, encrypted Dolby Vision
|
||||
// is allowed in Media Source while clear Dolby Vision is not allowed. This
|
||||
// feature allows the support of clear Dolby Vision in Media Source, which is
|
||||
// useful to work around some JavaScript player limitations.
|
||||
// When ENABLE_PLATFORM_ENCRYPTED_DOLBY_VISION is enabled at build time, allow
|
||||
// the support of encrypted Dolby Vision. Have no effect when
|
||||
// ENABLE_PLATFORM_ENCRYPTED_DOLBY_VISION is disabled.
|
||||
BASE_FEATURE(kPlatformEncryptedDolbyVision,
|
||||
"PlatformEncryptedDolbyVision",
|
||||
base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
|
||||
// When ENABLE_PLATFORM_ENCRYPTED_DOLBY_VISION is enabled at build time and
|
||||
// `kPlatformEncryptedDolbyVision` is enabled at run time, encrypted Dolby
|
||||
// Vision is allowed in Media Source while clear Dolby Vision is not allowed.
|
||||
// In this case, this feature allows the support of clear Dolby Vision in Media
|
||||
// Source, which is useful to work around some JavaScript player limitations.
|
||||
// Otherwise, this feature has no effect and neither encrypted nor clear Dolby
|
||||
// Vision is allowed.
|
||||
BASE_FEATURE(kAllowClearDolbyVisionInMseWhenPlatformEncryptedDvEnabled,
|
||||
"AllowClearDolbyVisionInMseWhenPlatformEncryptedDvEnabled",
|
||||
base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_CHROMEOS)
|
||||
const base::Feature MEDIA_EXPORT kDeprecateLowUsageCodecs{
|
||||
"DeprecateLowUsageCodecs", base::FEATURE_DISABLED_BY_DEFAULT};
|
||||
#endif // BUILDFLAG(IS_CHROMEOS)
|
||||
|
||||
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
||||
// Spawn utility processes to perform hardware decode acceleration instead of
|
||||
// using the GPU process.
|
||||
|
@ -1191,11 +1204,6 @@ BASE_FEATURE(kMediaPowerExperiment,
|
|||
"MediaPowerExperiment",
|
||||
base::FEATURE_DISABLED_BY_DEFAULT);
|
||||
|
||||
// Enable WebRTC actions for the Media Session API.
|
||||
BASE_FEATURE(kMediaSessionWebRTC,
|
||||
"MediaSessionWebRTC",
|
||||
base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
|
||||
// Enables flash to be ducked by audio focus. This is enabled on Chrome OS which
|
||||
// has audio focus enabled.
|
||||
BASE_FEATURE(kAudioFocusDuckFlash,
|
||||
|
@ -1243,6 +1251,31 @@ BASE_FEATURE(kBresenhamCadence,
|
|||
"BresenhamCadence",
|
||||
base::FEATURE_DISABLED_BY_DEFAULT);
|
||||
|
||||
// Controls whether mirroring negotiations will include the AV1 codec for video
|
||||
// encoding.
|
||||
//
|
||||
// NOTE: currently only software AV1 encoding is supported.
|
||||
// TODO(https://crbug.com/1383333): hardware AV1 encoding should be added.
|
||||
BASE_FEATURE(kCastStreamingAv1,
|
||||
"CastStreamingAv1",
|
||||
base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
|
||||
// Controls whether mirroring negotiations will include the VP9 codec for video
|
||||
// encoding.
|
||||
//
|
||||
// NOTE: currently only software VP9 encoding is supported.
|
||||
// TODO(https://crbug.com/1311770): hardware VP9 encoding should be added.
|
||||
BASE_FEATURE(kCastStreamingVp9,
|
||||
"CastStreamingVp9",
|
||||
base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
|
||||
#if BUILDFLAG(IS_FUCHSIA)
|
||||
// Enables use of Fuchsia's Mediacodec service for encoding.
|
||||
BASE_FEATURE(kFuchsiaMediacodecVideoEncoder,
|
||||
"FuchsiaMediacodecVideoEncoder",
|
||||
base::FEATURE_ENABLED_BY_DEFAULT);
|
||||
#endif // BUILDFLAG(IS_FUCHSIA)
|
||||
|
||||
bool IsChromeWideEchoCancellationEnabled() {
|
||||
#if BUILDFLAG(CHROME_WIDE_ECHO_CANCELLATION)
|
||||
return base::FeatureList::IsEnabled(kChromeWideEchoCancellation);
|
||||
|
@ -1273,15 +1306,24 @@ bool IsVideoCaptureAcceleratedJpegDecodingEnabled() {
|
|||
}
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
bool IsMediaFoundationH264CbpEncodingEnabled() {
|
||||
return base::FeatureList::IsEnabled(kMediaFoundationH264CbpEncoding);
|
||||
}
|
||||
|
||||
bool IsMediaFoundationD3D11VideoCaptureEnabled() {
|
||||
return base::FeatureList::IsEnabled(kMediaFoundationD3D11VideoCapture);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool IsUseMojoVideoDecoderForPepperEnabled() {
|
||||
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
|
||||
switches::kDisableUseMojoVideoDecoderForPepper)) {
|
||||
LOG(WARNING) << "UseMojoVideoDecoderForPepper: Disabled by policy";
|
||||
return false;
|
||||
}
|
||||
|
||||
auto enabled = base::FeatureList::IsEnabled(kUseMojoVideoDecoderForPepper);
|
||||
LOG(WARNING) << "UseMojoVideoDecoderForPepper: feature controlled: "
|
||||
<< enabled;
|
||||
return enabled;
|
||||
}
|
||||
|
||||
// Return bitmask of audio formats supported by EDID.
|
||||
uint32_t GetPassthroughAudioFormats() {
|
||||
#if BUILDFLAG(ENABLE_PASSTHROUGH_AUDIO_CODECS)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2022 The Chromium Authors. All rights reserved.
|
||||
// Copyright 2023 The Chromium Authors and Alex313031
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
|
@ -15,7 +15,6 @@
|
|||
#include "base/synchronization/waitable_event.h"
|
||||
#include "base/task/bind_post_task.h"
|
||||
#include "base/task/single_thread_task_runner.h"
|
||||
#include "base/threading/thread_task_runner_handle.h"
|
||||
#include "build/build_config.h"
|
||||
#include "gpu/command_buffer/common/command_buffer.h"
|
||||
#include "gpu/config/gpu_preferences.h"
|
||||
|
@ -60,21 +59,40 @@ static bool MakeDecoderContextCurrent(
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool BindImage(const base::WeakPtr<gpu::CommandBufferStub>& stub,
|
||||
uint32_t client_texture_id,
|
||||
uint32_t texture_target,
|
||||
const scoped_refptr<gl::GLImage>& image,
|
||||
bool can_bind_to_sampler) {
|
||||
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
|
||||
static bool BindDecoderManagedImage(
|
||||
const base::WeakPtr<gpu::CommandBufferStub>& stub,
|
||||
uint32_t client_texture_id,
|
||||
uint32_t texture_target,
|
||||
const scoped_refptr<gl::GLImage>& image) {
|
||||
if (!stub) {
|
||||
DLOG(ERROR) << "Stub is gone; won't BindImage().";
|
||||
return false;
|
||||
}
|
||||
|
||||
gpu::DecoderContext* command_decoder = stub->decoder_context();
|
||||
command_decoder->BindImage(client_texture_id, texture_target, image.get(),
|
||||
can_bind_to_sampler);
|
||||
command_decoder->AttachImageToTextureWithDecoderBinding(
|
||||
client_texture_id, texture_target, image.get());
|
||||
return true;
|
||||
}
|
||||
#else
|
||||
static bool BindClientManagedImage(
|
||||
const base::WeakPtr<gpu::CommandBufferStub>& stub,
|
||||
uint32_t client_texture_id,
|
||||
uint32_t texture_target,
|
||||
const scoped_refptr<gl::GLImage>& image) {
|
||||
if (!stub) {
|
||||
DLOG(ERROR) << "Stub is gone; won't BindImage().";
|
||||
return false;
|
||||
}
|
||||
|
||||
gpu::DecoderContext* command_decoder = stub->decoder_context();
|
||||
command_decoder->AttachImageToTextureWithClientBinding(
|
||||
client_texture_id, texture_target, image.get());
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
static gpu::gles2::ContextGroup* GetContextGroup(
|
||||
const base::WeakPtr<gpu::CommandBufferStub>& stub) {
|
||||
|
@ -271,7 +289,7 @@ GpuVideoDecodeAccelerator::GpuVideoDecodeAccelerator(
|
|||
texture_target_(0),
|
||||
pixel_format_(PIXEL_FORMAT_UNKNOWN),
|
||||
textures_per_buffer_(0),
|
||||
child_task_runner_(base::ThreadTaskRunnerHandle::Get()),
|
||||
child_task_runner_(base::SingleThreadTaskRunner::GetCurrentDefault()),
|
||||
io_task_runner_(io_task_runner),
|
||||
overlay_factory_cb_(overlay_factory_cb) {
|
||||
DCHECK(stub_);
|
||||
|
@ -280,7 +298,16 @@ GpuVideoDecodeAccelerator::GpuVideoDecodeAccelerator(
|
|||
base::BindRepeating(&GetGLContext, stub_->AsWeakPtr());
|
||||
gl_client_.make_context_current =
|
||||
base::BindRepeating(&MakeDecoderContextCurrent, stub_->AsWeakPtr());
|
||||
gl_client_.bind_image = base::BindRepeating(&BindImage, stub_->AsWeakPtr());
|
||||
// The semantics of |bind_image| vary per-platform: On Windows and Mac it must
|
||||
// mark the image as needing binding by the decoder, while on other platforms
|
||||
// it must mark the image as *not* needing binding by the decoder.
|
||||
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
|
||||
gl_client_.bind_image =
|
||||
base::BindRepeating(&BindDecoderManagedImage, stub_->AsWeakPtr());
|
||||
#else
|
||||
gl_client_.bind_image =
|
||||
base::BindRepeating(&BindClientManagedImage, stub_->AsWeakPtr());
|
||||
#endif
|
||||
gl_client_.get_context_group =
|
||||
base::BindRepeating(&GetContextGroup, stub_->AsWeakPtr());
|
||||
gl_client_.create_abstract_texture =
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
// Copyright 2023 The Chromium Authors and Alex313031
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
|||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/synchronization/waitable_event.h"
|
||||
#include "base/threading/thread_task_runner_handle.h"
|
||||
#include "base/task/single_thread_task_runner.h"
|
||||
#include "base/trace_event/memory_dump_manager.h"
|
||||
#include "base/trace_event/process_memory_dump.h"
|
||||
#include "base/trace_event/trace_event.h"
|
||||
|
@ -153,7 +153,7 @@ VaapiVideoDecodeAccelerator::VaapiVideoDecodeAccelerator(
|
|||
buffer_allocation_mode_(BufferAllocationMode::kNormal),
|
||||
surfaces_available_(&lock_),
|
||||
va_surface_format_(VA_INVALID_ID),
|
||||
task_runner_(base::ThreadTaskRunnerHandle::Get()),
|
||||
task_runner_(base::SingleThreadTaskRunner::GetCurrentDefault()),
|
||||
decoder_thread_("VaapiDecoderThread"),
|
||||
finish_flush_pending_(false),
|
||||
awaiting_va_surfaces_recycle_(false),
|
||||
|
@ -169,7 +169,7 @@ VaapiVideoDecodeAccelerator::VaapiVideoDecodeAccelerator(
|
|||
&VaapiVideoDecodeAccelerator::RecycleVASurface, weak_this_));
|
||||
base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
|
||||
this, "media::VaapiVideoDecodeAccelerator",
|
||||
base::ThreadTaskRunnerHandle::Get());
|
||||
base::SingleThreadTaskRunner::GetCurrentDefault());
|
||||
}
|
||||
|
||||
VaapiVideoDecodeAccelerator::~VaapiVideoDecodeAccelerator() {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2022 The Chromium Authors and Alex313031. All rights reserved.
|
||||
// Copyright 2023 The Chromium Authors and Alex313031
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
|
@ -629,24 +629,35 @@ bool IsVAProfileSupported(VAProfile va_profile) {
|
|||
&ProfileCodecMap::value_type::second);
|
||||
}
|
||||
|
||||
bool IsBlockedDriver(VaapiWrapper::CodecMode mode, VAProfile va_profile) {
|
||||
bool IsBlockedDriver(VaapiWrapper::CodecMode mode,
|
||||
VAProfile va_profile,
|
||||
const std::string& va_vendor_string) {
|
||||
if (!IsModeEncoding(mode)) {
|
||||
return va_profile == VAProfileAV1Profile0 &&
|
||||
!base::FeatureList::IsEnabled(kChromeOSHWAV1Decoder);
|
||||
}
|
||||
|
||||
// TODO(posciak): Remove once VP8 encoding is to be enabled by default.
|
||||
if (va_profile == VAProfileVP8Version0_3 &&
|
||||
!base::FeatureList::IsEnabled(kVaapiVP8Encoder)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO(crbug.com/811912): Remove once VP9 encoding is enabled by default.
|
||||
if (va_profile == VAProfileVP9Profile0 &&
|
||||
!base::FeatureList::IsEnabled(kVaapiVP9Encoder)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mode == VaapiWrapper::CodecMode::kEncodeVariableBitrate) {
|
||||
// The rate controller on grunt is not good enough to support VBR encoding,
|
||||
// b/253988139.
|
||||
const bool is_amd_stoney_ridge_driver =
|
||||
va_vendor_string.find("STONEY") != std::string::npos;
|
||||
if (!base::FeatureList::IsEnabled(kChromeOSHWVBREncoding) ||
|
||||
is_amd_stoney_ridge_driver) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -668,6 +679,7 @@ class VADisplayState {
|
|||
base::Lock* va_lock() { return &va_lock_; }
|
||||
VADisplay va_display() const { return va_display_; }
|
||||
VAImplementation implementation_type() const { return implementation_type_; }
|
||||
const std::string& vendor_string() const { return va_vendor_string_; }
|
||||
|
||||
void SetDrmFd(base::PlatformFile fd) { drm_fd_.reset(HANDLE_EINTR(dup(fd))); }
|
||||
|
||||
|
@ -701,6 +713,9 @@ class VADisplayState {
|
|||
|
||||
// Enumerated version of vaQueryVendorString(). Valid after Initialize().
|
||||
VAImplementation implementation_type_ = VAImplementation::kInvalid;
|
||||
|
||||
// String representing a driver acquired by vaQueryVendorString().
|
||||
std::string va_vendor_string_;
|
||||
};
|
||||
|
||||
// static
|
||||
|
@ -712,13 +727,6 @@ VADisplayState* VADisplayState::Get() {
|
|||
// static
|
||||
void VADisplayState::PreSandboxInitialization() {
|
||||
constexpr char kRenderNodeFilePattern[] = "/dev/dri/renderD%d";
|
||||
const char kNvidiaPath[] = "/dev/dri/nvidiactl";
|
||||
|
||||
// TODO: Is this still needed?
|
||||
base::File nvidia_file = base::File(
|
||||
base::FilePath::FromUTF8Unsafe(kNvidiaPath),
|
||||
base::File::FLAG_OPEN | base::File::FLAG_READ | base::File::FLAG_WRITE);
|
||||
|
||||
// This loop ends on either the first card that does not exist or the first
|
||||
// render node that is not vgem.
|
||||
for (int i = 128;; i++) {
|
||||
|
@ -785,9 +793,7 @@ absl::optional<VADisplay> GetVADisplayStateX11(const base::ScopedFD& drm_fd) {
|
|||
case gl::kGLImplementationEGLGLES2:
|
||||
return vaGetDisplayDRM(drm_fd.get());
|
||||
|
||||
case gl::kGLImplementationNone:
|
||||
|
||||
case gl::kGLImplementationDesktopGL: {
|
||||
case gl::kGLImplementationNone: {
|
||||
VADisplay display =
|
||||
vaGetDisplay(x11::Connection::Get()->GetXlibDisplay());
|
||||
if (vaDisplayIsValid(display))
|
||||
|
@ -852,12 +858,12 @@ bool VADisplayState::InitializeVaDriver_Locked() {
|
|||
VLOGF(1) << "vaInitialize failed: " << vaErrorStr(va_res);
|
||||
return false;
|
||||
}
|
||||
const std::string va_vendor_string = vaQueryVendorString(va_display_);
|
||||
DLOG_IF(WARNING, va_vendor_string.empty())
|
||||
va_vendor_string_ = vaQueryVendorString(va_display_);
|
||||
DLOG_IF(WARNING, va_vendor_string_.empty())
|
||||
<< "Vendor string empty or error reading.";
|
||||
DVLOG(1) << "VAAPI version: " << major_version << "." << minor_version << " "
|
||||
<< va_vendor_string;
|
||||
implementation_type_ = VendorStringToImplementationType(va_vendor_string);
|
||||
<< va_vendor_string_;
|
||||
implementation_type_ = VendorStringToImplementationType(va_vendor_string_);
|
||||
|
||||
va_initialized_ = true;
|
||||
|
||||
|
@ -878,6 +884,10 @@ bool VADisplayState::InitializeVaDriver_Locked() {
|
|||
}
|
||||
|
||||
bool VADisplayState::InitializeOnce() {
|
||||
static_assert(
|
||||
VA_MAJOR_VERSION >= 2 || (VA_MAJOR_VERSION == 1 && VA_MINOR_VERSION >= 1),
|
||||
"Requires VA-API >= 1.1.0");
|
||||
|
||||
// Set VA logging level, unless already set.
|
||||
constexpr char libva_log_level_env[] = "LIBVA_MESSAGING_LEVEL";
|
||||
std::unique_ptr<base::Environment> env(base::Environment::Create());
|
||||
|
@ -1089,7 +1099,7 @@ bool AreAttribsSupported(const base::Lock* va_lock,
|
|||
if (attribs[i].type != required_attribs[i].type ||
|
||||
(attribs[i].value & required_attribs[i].value) !=
|
||||
required_attribs[i].value) {
|
||||
VLOG(1) << "Unsupported value " << required_attribs[i].value << " for "
|
||||
DVLOG(1) << "Unsupported value " << required_attribs[i].value << " for "
|
||||
<< vaConfigAttribTypeStr(required_attribs[i].type);
|
||||
return false;
|
||||
}
|
||||
|
@ -1137,7 +1147,9 @@ class VASupportedProfiles {
|
|||
~VASupportedProfiles() = default;
|
||||
|
||||
// Fills in |supported_profiles_|.
|
||||
void FillSupportedProfileInfos(base::Lock* va_lock, VADisplay va_display);
|
||||
void FillSupportedProfileInfos(base::Lock* va_lock,
|
||||
VADisplay va_display,
|
||||
const std::string& va_vendor_string);
|
||||
|
||||
// Fills |profile_info| for |va_profile| and |entrypoint| with
|
||||
// |required_attribs|. If the return value is true, the operation was
|
||||
|
@ -1194,14 +1206,17 @@ VASupportedProfiles::VASupportedProfiles()
|
|||
va_lock = nullptr;
|
||||
}
|
||||
|
||||
FillSupportedProfileInfos(va_lock, va_display);
|
||||
FillSupportedProfileInfos(va_lock, va_display,
|
||||
display_state->vendor_string());
|
||||
|
||||
const VAStatus va_res = display_state->Deinitialize();
|
||||
VA_LOG_ON_ERROR(va_res, VaapiFunctions::kVATerminate);
|
||||
}
|
||||
|
||||
void VASupportedProfiles::FillSupportedProfileInfos(base::Lock* va_lock,
|
||||
VADisplay va_display) {
|
||||
void VASupportedProfiles::FillSupportedProfileInfos(
|
||||
base::Lock* va_lock,
|
||||
VADisplay va_display,
|
||||
const std::string& va_vendor_string) {
|
||||
base::AutoLockMaybe auto_lock(va_lock);
|
||||
|
||||
const std::vector<VAProfile> va_profiles =
|
||||
|
@ -1223,7 +1238,7 @@ void VASupportedProfiles::FillSupportedProfileInfos(base::Lock* va_lock,
|
|||
std::vector<ProfileInfo> supported_profile_infos;
|
||||
|
||||
for (const auto& va_profile : va_profiles) {
|
||||
if (IsBlockedDriver(mode, va_profile))
|
||||
if (IsBlockedDriver(mode, va_profile, va_vendor_string))
|
||||
continue;
|
||||
|
||||
if ((mode != VaapiWrapper::kVideoProcess) &&
|
||||
|
@ -1553,10 +1568,9 @@ bool VASupportedImageFormats::InitSupportedImageFormats_Locked(
|
|||
// assume that IYUV/I420 is supported. However, it's not currently being
|
||||
// reported. See https://gitlab.freedesktop.org/mesa/mesa/commit/b0a44f10.
|
||||
// Remove this workaround once b/128340287 is resolved.
|
||||
if (std::find_if(supported_formats_.cbegin(), supported_formats_.cend(),
|
||||
[](const VAImageFormat& format) {
|
||||
return format.fourcc == VA_FOURCC_I420;
|
||||
}) == supported_formats_.cend()) {
|
||||
if (!base::Contains(supported_formats_,
|
||||
static_cast<unsigned int>(VA_FOURCC_I420),
|
||||
&VAImageFormat::fourcc)) {
|
||||
VAImageFormat i420_format{};
|
||||
i420_format.fourcc = VA_FOURCC_I420;
|
||||
supported_formats_.push_back(i420_format);
|
||||
|
@ -1589,9 +1603,6 @@ bool IsLowPowerEncSupported(VAProfile va_profile) {
|
|||
}
|
||||
|
||||
bool IsVBREncodingSupported(VAProfile va_profile) {
|
||||
if (!base::FeatureList::IsEnabled(kChromeOSHWVBREncoding))
|
||||
return false;
|
||||
|
||||
auto mode = VaapiWrapper::CodecMode::kCodecModeMax;
|
||||
switch (va_profile) {
|
||||
case VAProfileH264ConstrainedBaseline:
|
||||
|
@ -1876,12 +1887,6 @@ bool VaapiWrapper::GetJpegDecodeSuitableImageFourCC(unsigned int rt_format,
|
|||
return true;
|
||||
}
|
||||
|
||||
// static
|
||||
bool VaapiWrapper::IsVppProfileSupported() {
|
||||
return VASupportedProfiles::Get().IsProfileSupported(kVideoProcess,
|
||||
VAProfileNone);
|
||||
}
|
||||
|
||||
// static
|
||||
bool VaapiWrapper::IsVppResolutionAllowed(const gfx::Size& size) {
|
||||
const VASupportedProfiles::ProfileInfo* profile_info =
|
||||
|
@ -3119,7 +3124,13 @@ void VaapiWrapper::PreSandboxInitialization() {
|
|||
static bool result = InitializeStubs(paths);
|
||||
if (!result) {
|
||||
static const char kErrorMsg[] = "Failed to initialize VAAPI libs";
|
||||
LOG(ERROR) << kErrorMsg;
|
||||
#if BUILDFLAG(IS_CHROMEOS)
|
||||
// When Chrome runs on Linux with target_os="chromeos", do not log error
|
||||
// message without VAAPI libraries.
|
||||
LOG_IF(ERROR, base::SysInfo::IsRunningOnChromeOS()) << kErrorMsg;
|
||||
#else
|
||||
DVLOG(1) << kErrorMsg;
|
||||
#endif
|
||||
}
|
||||
|
||||
// VASupportedProfiles::Get creates VADisplayState and in so doing
|
||||
|
@ -3292,7 +3303,6 @@ bool VaapiWrapper::CreateSurfaces(
|
|||
DCHECK(va_surfaces->empty());
|
||||
|
||||
va_surfaces->resize(num_surfaces);
|
||||
VASurfaceAttrib attribute;
|
||||
|
||||
if (GetImplementationType() != VAImplementation::kNVIDIAVDPAU) {
|
||||
// Nvidia's VAAPI-VDPAU driver doesn't support this attribute
|
||||
|
@ -3485,7 +3495,7 @@ bool VaapiWrapper::SubmitBuffer_Locked(const VABufferDescriptor& va_buffer) {
|
|||
// mismatch. https://github.com/intel/libva/issues/597
|
||||
const VAStatus va_res = vaCreateBuffer(
|
||||
va_display_, va_context_id_, va_buffer.type, va_buffer_size, 1,
|
||||
const_cast<void*>(va_buffer.data), &buffer_id);
|
||||
const_cast<void*>(va_buffer.data.get()), &buffer_id);
|
||||
VA_SUCCESS_OR_RETURN(va_res, VaapiFunctions::kVACreateBuffer, false);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2022 The Chromium Authors and Alex313031. All rights reserved.
|
||||
// Copyright 2023 The Chromium Authors and Alex313031
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
//
|
||||
|
@ -429,7 +429,7 @@ class MEDIA_GPU_EXPORT VaapiWrapper
|
|||
struct VABufferDescriptor {
|
||||
VABufferType type;
|
||||
size_t size;
|
||||
const void* data;
|
||||
raw_ptr<const void> data;
|
||||
};
|
||||
[[nodiscard]] bool SubmitBuffers(
|
||||
const std::vector<VABufferDescriptor>& va_buffers);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) 2022 The Chromium Authors and Alex313031. All rights reserved.
|
||||
// Copyright (c) 2023 The Chromium Authors and Alex313031
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
|
@ -108,4 +108,4 @@ LOAD_FLAG(CAN_USE_RESTRICTED_PREFETCH, 1 << 16)
|
|||
// advertise brotli encoding.
|
||||
// Used to comply with IETF (draft) DNS-over-HTTPS:
|
||||
// "Implementors SHOULD NOT set non-essential HTTP headers in DoH client requests."
|
||||
LOAD_FLAG(MINIMAL_HEADERS, 1 << 17)
|
||||
LOAD_FLAG(MINIMAL_HEADERS, 1 << 19)
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
// Copyright (c) 2022 The Chromium Authors and Alex313031. All rights reserved.
|
||||
// Copyright 2023 The Chromium Authors and Alex313031
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "net/dns/dns_transaction.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
@ -16,6 +17,7 @@
|
|||
#include "base/bind.h"
|
||||
#include "base/callback_helpers.h"
|
||||
#include "base/containers/circular_deque.h"
|
||||
#include "base/containers/span.h"
|
||||
#include "base/location.h"
|
||||
#include "base/memory/ptr_util.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
|
@ -28,9 +30,9 @@
|
|||
#include "base/ranges/algorithm.h"
|
||||
#include "base/strings/string_piece.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/task/sequenced_task_runner.h"
|
||||
#include "base/task/single_thread_task_runner.h"
|
||||
#include "base/threading/thread_checker.h"
|
||||
#include "base/threading/thread_task_runner_handle.h"
|
||||
#include "base/timer/elapsed_timer.h"
|
||||
#include "base/timer/timer.h"
|
||||
#include "base/values.h"
|
||||
|
@ -46,6 +48,7 @@
|
|||
#include "net/base/net_errors.h"
|
||||
#include "net/base/upload_bytes_element_reader.h"
|
||||
#include "net/dns/dns_config.h"
|
||||
#include "net/dns/dns_names_util.h"
|
||||
#include "net/dns/dns_query.h"
|
||||
#include "net/dns/dns_response.h"
|
||||
#include "net/dns/dns_response_result_extractor.h"
|
||||
|
@ -110,7 +113,7 @@ constexpr net::NetworkTrafficAnnotationTag kTrafficAnnotation =
|
|||
const char kDnsOverHttpResponseContentType[] = "application/dns-message";
|
||||
|
||||
// Count labels in the fully-qualified name in DNS format.
|
||||
int CountLabels(const std::string& name) {
|
||||
int CountLabels(base::span<const uint8_t> name) {
|
||||
size_t count = 0;
|
||||
for (size_t i = 0; i < name.size() && name[i]; i += name[i] + 1)
|
||||
++count;
|
||||
|
@ -214,20 +217,15 @@ class DnsUDPAttempt : public DnsAttempt {
|
|||
DCHECK_EQ(STATE_NONE, next_state_);
|
||||
callback_ = std::move(callback);
|
||||
start_time_ = base::TimeTicks::Now();
|
||||
next_state_ = STATE_SEND_QUERY;
|
||||
next_state_ = STATE_CONNECT_COMPLETE;
|
||||
|
||||
int rv = socket_->Connect(server_);
|
||||
if (rv != OK) {
|
||||
DVLOG(1) << "Failed to connect socket: " << rv;
|
||||
udp_tracker_->RecordConnectionError(rv);
|
||||
return ERR_CONNECTION_REFUSED;
|
||||
int rv = socket_->ConnectAsync(
|
||||
server_,
|
||||
base::BindOnce(&DnsUDPAttempt::OnIOComplete, base::Unretained(this)));
|
||||
if (rv == ERR_IO_PENDING) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
IPEndPoint local_address;
|
||||
if (socket_->GetLocalAddress(&local_address) == OK)
|
||||
udp_tracker_->RecordQuery(local_address.port(), query_->id());
|
||||
|
||||
return DoLoop(OK);
|
||||
return DoLoop(rv);
|
||||
}
|
||||
|
||||
const DnsQuery* GetQuery() const override { return query_.get(); }
|
||||
|
@ -251,6 +249,7 @@ class DnsUDPAttempt : public DnsAttempt {
|
|||
|
||||
private:
|
||||
enum State {
|
||||
STATE_CONNECT_COMPLETE,
|
||||
STATE_SEND_QUERY,
|
||||
STATE_SEND_QUERY_COMPLETE,
|
||||
STATE_READ_RESPONSE,
|
||||
|
@ -265,8 +264,11 @@ class DnsUDPAttempt : public DnsAttempt {
|
|||
State state = next_state_;
|
||||
next_state_ = STATE_NONE;
|
||||
switch (state) {
|
||||
case STATE_CONNECT_COMPLETE:
|
||||
rv = DoConnectComplete(rv);
|
||||
break;
|
||||
case STATE_SEND_QUERY:
|
||||
rv = DoSendQuery();
|
||||
rv = DoSendQuery(rv);
|
||||
break;
|
||||
case STATE_SEND_QUERY_COMPLETE:
|
||||
rv = DoSendQueryComplete(rv);
|
||||
|
@ -289,7 +291,23 @@ class DnsUDPAttempt : public DnsAttempt {
|
|||
return rv;
|
||||
}
|
||||
|
||||
int DoSendQuery() {
|
||||
int DoConnectComplete(int rv) {
|
||||
if (rv != OK) {
|
||||
DVLOG(1) << "Failed to connect socket: " << rv;
|
||||
udp_tracker_->RecordConnectionError(rv);
|
||||
return ERR_CONNECTION_REFUSED;
|
||||
}
|
||||
next_state_ = STATE_SEND_QUERY;
|
||||
IPEndPoint local_address;
|
||||
if (socket_->GetLocalAddress(&local_address) == OK)
|
||||
udp_tracker_->RecordQuery(local_address.port(), query_->id());
|
||||
return OK;
|
||||
}
|
||||
|
||||
int DoSendQuery(int rv) {
|
||||
DCHECK_NE(ERR_IO_PENDING, rv);
|
||||
if (rv < 0)
|
||||
return rv;
|
||||
next_state_ = STATE_SEND_QUERY_COMPLETE;
|
||||
return socket_->Write(
|
||||
query_->io_buffer(), query_->io_buffer()->size(),
|
||||
|
@ -459,7 +477,7 @@ class DnsHTTPAttempt : public DnsAttempt, public URLRequest::Delegate {
|
|||
callback_ = std::move(callback);
|
||||
// Start the request asynchronously to avoid reentrancy in
|
||||
// the network stack.
|
||||
base::SequencedTaskRunnerHandle::Get()->PostTask(
|
||||
base::SequencedTaskRunner::GetCurrentDefault()->PostTask(
|
||||
FROM_HERE, base::BindOnce(&DnsHTTPAttempt::StartAsync,
|
||||
weak_factory_.GetWeakPtr()));
|
||||
return ERR_IO_PENDING;
|
||||
|
@ -554,7 +572,7 @@ class DnsHTTPAttempt : public DnsAttempt, public URLRequest::Delegate {
|
|||
} else {
|
||||
// Else, trigger OnReadCompleted asynchronously to avoid starving the IO
|
||||
// thread in case the URLRequest can provide data synchronously.
|
||||
base::SequencedTaskRunnerHandle::Get()->PostTask(
|
||||
base::SequencedTaskRunner::GetCurrentDefault()->PostTask(
|
||||
FROM_HERE, base::BindOnce(&DnsHTTPAttempt::OnReadCompleted,
|
||||
weak_factory_.GetWeakPtr(),
|
||||
request_.get(), read_result));
|
||||
|
@ -613,7 +631,7 @@ class DnsHTTPAttempt : public DnsAttempt, public URLRequest::Delegate {
|
|||
|
||||
void ConstructDnsHTTPAttempt(DnsSession* session,
|
||||
size_t doh_server_index,
|
||||
std::string hostname,
|
||||
base::span<const uint8_t> qname,
|
||||
uint16_t qtype,
|
||||
const OptRecordRdata* opt_rdata,
|
||||
std::vector<std::unique_ptr<DnsAttempt>>* attempts,
|
||||
|
@ -625,7 +643,7 @@ void ConstructDnsHTTPAttempt(DnsSession* session,
|
|||
std::unique_ptr<DnsQuery> query;
|
||||
if (attempts->empty()) {
|
||||
query =
|
||||
std::make_unique<DnsQuery>(0 /* id */, hostname, qtype, opt_rdata,
|
||||
std::make_unique<DnsQuery>(/*id=*/0, qname, qtype, opt_rdata,
|
||||
DnsQuery::PaddingStrategy::BLOCK_LENGTH_128);
|
||||
} else {
|
||||
query = std::make_unique<DnsQuery>(*attempts->at(0)->GetQuery());
|
||||
|
@ -924,7 +942,10 @@ class DnsOverHttpsProbeRunner : public DnsProbeRunner {
|
|||
DCHECK(!session_->config().doh_config.servers().empty());
|
||||
DCHECK(context_);
|
||||
|
||||
DNSDomainFromDot(kDohProbeHostname, &formatted_probe_hostname_);
|
||||
absl::optional<std::vector<uint8_t>> qname =
|
||||
dns_names_util::DottedNameToNetwork(kDohProbeHostname);
|
||||
DCHECK(qname.has_value());
|
||||
formatted_probe_qname_ = std::move(qname).value();
|
||||
|
||||
for (size_t i = 0; i < session_->config().doh_config.servers().size();
|
||||
i++) {
|
||||
|
@ -1001,7 +1022,7 @@ class DnsOverHttpsProbeRunner : public DnsProbeRunner {
|
|||
DCHECK(probe_stats);
|
||||
DCHECK(probe_stats->backoff_entry);
|
||||
probe_stats->backoff_entry->InformOfRequest(false /* success */);
|
||||
base::SequencedTaskRunnerHandle::Get()->PostDelayedTask(
|
||||
base::SequencedTaskRunner::GetCurrentDefault()->PostDelayedTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(&DnsOverHttpsProbeRunner::ContinueProbe,
|
||||
weak_ptr_factory_.GetWeakPtr(), doh_server_index,
|
||||
|
@ -1010,8 +1031,8 @@ class DnsOverHttpsProbeRunner : public DnsProbeRunner {
|
|||
|
||||
unsigned attempt_number = probe_stats->probe_attempts.size();
|
||||
ConstructDnsHTTPAttempt(
|
||||
session_.get(), doh_server_index, formatted_probe_hostname_,
|
||||
dns_protocol::kTypeA, nullptr /* opt_rdata */,
|
||||
session_.get(), doh_server_index, formatted_probe_qname_,
|
||||
dns_protocol::kTypeA, /*opt_rdata=*/nullptr,
|
||||
&probe_stats->probe_attempts, context_->url_request_context(),
|
||||
context_->isolation_info(), RequestPriority::DEFAULT_PRIORITY);
|
||||
|
||||
|
@ -1077,7 +1098,7 @@ class DnsOverHttpsProbeRunner : public DnsProbeRunner {
|
|||
|
||||
base::WeakPtr<DnsSession> session_;
|
||||
base::WeakPtr<ResolveContext> context_;
|
||||
std::string formatted_probe_hostname_;
|
||||
std::vector<uint8_t> formatted_probe_qname_;
|
||||
|
||||
// List of ProbeStats, one for each DoH server, indexed by the DoH server
|
||||
// config index.
|
||||
|
@ -1162,7 +1183,7 @@ class DnsTransactionImpl : public DnsTransaction,
|
|||
// Clear all other non-completed attempts. They are no longer needed and
|
||||
// they may interfere with this posted result.
|
||||
ClearAttempts(result.attempt);
|
||||
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||
base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
|
||||
FROM_HERE,
|
||||
base::BindOnce(&DnsTransactionImpl::DoCallback, AsWeakPtr(), result));
|
||||
}
|
||||
|
@ -1180,7 +1201,7 @@ class DnsTransactionImpl : public DnsTransaction,
|
|||
: rv(rv), attempt(attempt) {}
|
||||
|
||||
int rv;
|
||||
const DnsAttempt* attempt;
|
||||
raw_ptr<const DnsAttempt, DanglingUntriaged> attempt;
|
||||
};
|
||||
|
||||
// Used in UMA (DNS.AttemptType). Do not renumber or remove values.
|
||||
|
@ -1196,46 +1217,52 @@ class DnsTransactionImpl : public DnsTransaction,
|
|||
int PrepareSearch() {
|
||||
const DnsConfig& config = session_->config();
|
||||
|
||||
std::string labeled_hostname;
|
||||
if (!DNSDomainFromDot(hostname_, &labeled_hostname))
|
||||
absl::optional<std::vector<uint8_t>> labeled_qname =
|
||||
dns_names_util::DottedNameToNetwork(
|
||||
hostname_,
|
||||
/*require_valid_internet_hostname=*/true);
|
||||
if (!labeled_qname.has_value())
|
||||
return ERR_INVALID_ARGUMENT;
|
||||
|
||||
if (hostname_.back() == '.') {
|
||||
// It's a fully-qualified name, no suffix search.
|
||||
qnames_.push_back(labeled_hostname);
|
||||
qnames_.push_back(std::move(labeled_qname).value());
|
||||
return OK;
|
||||
}
|
||||
|
||||
int ndots = CountLabels(labeled_hostname) - 1;
|
||||
int ndots = CountLabels(labeled_qname.value()) - 1;
|
||||
|
||||
if (ndots > 0 && !config.append_to_multi_label_name) {
|
||||
qnames_.push_back(labeled_hostname);
|
||||
qnames_.push_back(std::move(labeled_qname).value());
|
||||
return OK;
|
||||
}
|
||||
|
||||
// Set true when |labeled_hostname| is put on the list.
|
||||
bool had_hostname = false;
|
||||
// Set true when `labeled_qname` is put on the list.
|
||||
bool had_qname = false;
|
||||
|
||||
if (ndots >= config.ndots) {
|
||||
qnames_.push_back(labeled_hostname);
|
||||
had_hostname = true;
|
||||
qnames_.push_back(labeled_qname.value());
|
||||
had_qname = true;
|
||||
}
|
||||
|
||||
std::string qname;
|
||||
for (const auto& suffix : config.search) {
|
||||
absl::optional<std::vector<uint8_t>> qname =
|
||||
dns_names_util::DottedNameToNetwork(
|
||||
hostname_ + "." + suffix,
|
||||
/*require_valid_internet_hostname=*/true);
|
||||
// Ignore invalid (too long) combinations.
|
||||
if (!DNSDomainFromDot(hostname_ + "." + suffix, &qname))
|
||||
if (!qname.has_value())
|
||||
continue;
|
||||
if (qname.size() == labeled_hostname.size()) {
|
||||
if (had_hostname)
|
||||
if (qname.value().size() == labeled_qname.value().size()) {
|
||||
if (had_qname)
|
||||
continue;
|
||||
had_hostname = true;
|
||||
had_qname = true;
|
||||
}
|
||||
qnames_.push_back(qname);
|
||||
qnames_.push_back(std::move(qname).value());
|
||||
}
|
||||
|
||||
if (ndots > 0 && !had_hostname)
|
||||
qnames_.push_back(labeled_hostname);
|
||||
if (ndots > 0 && !had_qname)
|
||||
qnames_.push_back(std::move(labeled_qname).value());
|
||||
|
||||
return qnames_.empty() ? ERR_DNS_SEARCH_EMPTY : OK;
|
||||
}
|
||||
|
@ -1436,7 +1463,7 @@ class DnsTransactionImpl : public DnsTransaction,
|
|||
// Begins query for the current name. Makes the first attempt.
|
||||
AttemptResult StartQuery() {
|
||||
absl::optional<std::string> dotted_qname =
|
||||
DnsDomainToString(qnames_.front());
|
||||
dns_names_util::NetworkToDottedName(qnames_.front());
|
||||
net_log_.BeginEventWithStringParams(
|
||||
NetLogEventType::DNS_TRANSACTION_QUERY, "qname",
|
||||
dotted_qname.value_or("???MALFORMED_NAME???"));
|
||||
|
@ -1496,8 +1523,6 @@ class DnsTransactionImpl : public DnsTransaction,
|
|||
// Resolves the result of a DnsAttempt until a terminal result is reached
|
||||
// or it will complete asynchronously (ERR_IO_PENDING).
|
||||
AttemptResult ProcessAttemptResult(AttemptResult result) {
|
||||
DCHECK(!callback_.is_null());
|
||||
|
||||
while (result.rv != ERR_IO_PENDING) {
|
||||
LogResponse(result.attempt);
|
||||
|
||||
|
@ -1653,7 +1678,7 @@ class DnsTransactionImpl : public DnsTransaction,
|
|||
scoped_refptr<DnsSession> session_;
|
||||
std::string hostname_;
|
||||
uint16_t qtype_;
|
||||
raw_ptr<const OptRecordRdata> opt_rdata_;
|
||||
raw_ptr<const OptRecordRdata, DanglingUntriaged> opt_rdata_;
|
||||
const bool secure_;
|
||||
const SecureDnsMode secure_dns_mode_;
|
||||
// Cleared in DoCallback.
|
||||
|
@ -1667,7 +1692,7 @@ class DnsTransactionImpl : public DnsTransaction,
|
|||
NetLogWithSource net_log_;
|
||||
|
||||
// Search list of fully-qualified DNS names to query next (in DNS format).
|
||||
base::circular_deque<std::string> qnames_;
|
||||
base::circular_deque<std::vector<uint8_t>> qnames_;
|
||||
size_t qnames_initial_size_ = 0;
|
||||
|
||||
// List of attempts for the current name.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright 2022 The Chromium Authors and Alex313031
|
||||
// Copyright 2023 The Chromium Authors and Alex313031
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
|
@ -28,7 +28,6 @@
|
|||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "base/task/single_thread_task_runner.h"
|
||||
#include "base/threading/thread_task_runner_handle.h"
|
||||
#include "base/time/time.h"
|
||||
#include "base/trace_event/trace_event.h"
|
||||
#include "base/types/optional_util.h"
|
||||
|
@ -449,9 +448,7 @@ void URLRequestHttpJob::NotifyHeadersComplete() {
|
|||
if (!response_info_->was_cached && throttling_entry_.get())
|
||||
throttling_entry_->UpdateWithResponse(GetResponseCode());
|
||||
|
||||
// The ordering of these calls is not important.
|
||||
ProcessStrictTransportSecurityHeader();
|
||||
ProcessExpectCTHeader();
|
||||
|
||||
// Clear |set_cookie_access_result_list_| after any processing in case
|
||||
// SaveCookiesAndNotifyHeadersComplete is called again.
|
||||
|
@ -527,7 +524,7 @@ void URLRequestHttpJob::MaybeStartTransactionInternal(int result) {
|
|||
request_->net_log().AddEventWithStringParams(NetLogEventType::CANCELLED,
|
||||
"source", "delegate");
|
||||
// Don't call back synchronously to the delegate.
|
||||
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||
base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
|
||||
FROM_HERE, base::BindOnce(&URLRequestHttpJob::NotifyStartError,
|
||||
weak_factory_.GetWeakPtr(), result));
|
||||
}
|
||||
|
@ -605,7 +602,7 @@ void URLRequestHttpJob::StartTransactionInternal() {
|
|||
|
||||
// The transaction started synchronously, but we need to notify the
|
||||
// URLRequest delegate via the message loop.
|
||||
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||
base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
|
||||
FROM_HERE, base::BindOnce(&URLRequestHttpJob::OnStartCompleted,
|
||||
weak_factory_.GetWeakPtr(), rv));
|
||||
}
|
||||
|
@ -707,6 +704,11 @@ void URLRequestHttpJob::SetCookieHeaderAndStart(
|
|||
for (auto it = partition_it; it < maybe_included_cookies.end(); ++it) {
|
||||
it->access_result.status.AddExclusionReason(
|
||||
CookieInclusionStatus::EXCLUDE_USER_PREFERENCES);
|
||||
if (first_party_set_metadata_.AreSitesInSameFirstPartySet()) {
|
||||
it->access_result.status.AddExclusionReason(
|
||||
CookieInclusionStatus::
|
||||
EXCLUDE_THIRD_PARTY_BLOCKED_WITHIN_FIRST_PARTY_SET);
|
||||
}
|
||||
}
|
||||
excluded_cookies.insert(
|
||||
excluded_cookies.end(), std::make_move_iterator(partition_it),
|
||||
|
@ -719,7 +721,6 @@ void URLRequestHttpJob::SetCookieHeaderAndStart(
|
|||
if (!maybe_included_cookies.empty()) {
|
||||
std::string cookie_line =
|
||||
CanonicalCookie::BuildCookieLine(maybe_included_cookies);
|
||||
UMA_HISTOGRAM_COUNTS_10000("Cookie.HeaderLength", cookie_line.length());
|
||||
request_info_.extra_headers.SetHeader(HttpRequestHeaders::kCookie,
|
||||
cookie_line);
|
||||
|
||||
|
@ -982,31 +983,6 @@ void URLRequestHttpJob::ProcessStrictTransportSecurityHeader() {
|
|||
security_state->AddHSTSHeader(request_info_.url.host(), value);
|
||||
}
|
||||
|
||||
void URLRequestHttpJob::ProcessExpectCTHeader() {
|
||||
DCHECK(response_info_);
|
||||
TransportSecurityState* security_state =
|
||||
request_->context()->transport_security_state();
|
||||
const SSLInfo& ssl_info = response_info_->ssl_info;
|
||||
|
||||
// Only accept Expect CT headers on HTTPS connections that have no
|
||||
// certificate errors.
|
||||
if (!ssl_info.is_valid() || IsCertStatusError(ssl_info.cert_status) ||
|
||||
!security_state) {
|
||||
return;
|
||||
}
|
||||
|
||||
HttpResponseHeaders* headers = GetResponseHeaders();
|
||||
std::string value;
|
||||
bool has_expect_ct_header = headers->GetNormalizedHeader("Expect-CT", &value);
|
||||
base::UmaHistogramBoolean("Net.ExpectCT.HeaderPresentOnResponse",
|
||||
has_expect_ct_header);
|
||||
if (has_expect_ct_header) {
|
||||
security_state->ProcessExpectCTHeader(
|
||||
value, HostPortPair::FromURL(request_info_.url), ssl_info,
|
||||
request_->isolation_info().network_anonymization_key());
|
||||
}
|
||||
}
|
||||
|
||||
void URLRequestHttpJob::OnStartCompleted(int result) {
|
||||
TRACE_EVENT0(NetTracingCategory(), "URLRequestHttpJob::OnStartCompleted");
|
||||
RecordTimer();
|
||||
|
@ -1407,7 +1383,7 @@ void URLRequestHttpJob::CancelAuth() {
|
|||
//
|
||||
// Have to do this via PostTask to avoid re-entrantly calling into the
|
||||
// consumer.
|
||||
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||
base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
|
||||
FROM_HERE, base::BindOnce(&URLRequestHttpJob::NotifyFinalHeadersReceived,
|
||||
weak_factory_.GetWeakPtr()));
|
||||
}
|
||||
|
@ -1432,7 +1408,7 @@ void URLRequestHttpJob::ContinueWithCertificate(
|
|||
|
||||
// The transaction started synchronously, but we need to notify the
|
||||
// URLRequest delegate via the message loop.
|
||||
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||
base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
|
||||
FROM_HERE, base::BindOnce(&URLRequestHttpJob::OnStartCompleted,
|
||||
weak_factory_.GetWeakPtr(), rv));
|
||||
}
|
||||
|
@ -1455,7 +1431,7 @@ void URLRequestHttpJob::ContinueDespiteLastError() {
|
|||
|
||||
// The transaction started synchronously, but we need to notify the
|
||||
// URLRequest delegate via the message loop.
|
||||
base::ThreadTaskRunnerHandle::Get()->PostTask(
|
||||
base::SingleThreadTaskRunner::GetCurrentDefault()->PostTask(
|
||||
FROM_HERE, base::BindOnce(&URLRequestHttpJob::OnStartCompleted,
|
||||
weak_factory_.GetWeakPtr(), rv));
|
||||
}
|
||||
|
|
92
src/third_party/libgav1/BUILD.gn
vendored
92
src/third_party/libgav1/BUILD.gn
vendored
|
@ -1,9 +1,8 @@
|
|||
# Copyright 2019 The Chromium Authors. All rights reserved.
|
||||
# Copyright 2023 The Chromium Authors and Alex313031
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
import("//build/config/arm.gni")
|
||||
import("//third_party/libgav1/libgav1_srcs.gni")
|
||||
import("//third_party/libgav1/options.gni")
|
||||
|
||||
config("public_libgav1_config") {
|
||||
|
@ -30,7 +29,7 @@ config("private_libgav1_config") {
|
|||
# dsp intrinsics will generate much better code when optimized for speed
|
||||
# rather than size.
|
||||
if (!is_debug) {
|
||||
# configs += [ "//build/config/compiler:optimize_max" ]
|
||||
#configs += [ "//build/config/compiler:optimize_max" ]
|
||||
}
|
||||
if (current_cpu == "arm64" ||
|
||||
(current_cpu == "arm" && arm_version >= 7 && arm_use_neon)) {
|
||||
|
@ -39,68 +38,43 @@ config("private_libgav1_config") {
|
|||
}
|
||||
}
|
||||
|
||||
if (enable_libgav1_decoder || use_libgav1_parser) {
|
||||
# Separate from libgav1 because utils/constants.cc and dsp/constants.cc
|
||||
# generate the same object file, constants.o.
|
||||
source_set("libgav1_utils") {
|
||||
if (use_libgav1_parser) {
|
||||
static_library("libgav1_parser") {
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
configs += [ "//build/config/compiler:no_chromium_code" ]
|
||||
configs += [ ":private_libgav1_config" ]
|
||||
|
||||
public_configs = [ ":public_libgav1_config" ]
|
||||
|
||||
sources = gav1_utils_sources
|
||||
}
|
||||
|
||||
# Separate from libgav1 because film_grain.cc and dsp/film_grain.cc
|
||||
# generate the same object file, film_grain.o.
|
||||
source_set("libgav1_dsp") {
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
configs += [ "//build/config/compiler:no_chromium_code" ]
|
||||
configs += [ ":private_libgav1_config" ]
|
||||
|
||||
deps = [
|
||||
":libgav1_dsp_sse4",
|
||||
":libgav1_utils",
|
||||
sources = [
|
||||
"//third_party/libgav1/src/src/buffer_pool.cc",
|
||||
"//third_party/libgav1/src/src/buffer_pool.h",
|
||||
"//third_party/libgav1/src/src/frame_buffer.cc",
|
||||
"//third_party/libgav1/src/src/internal_frame_buffer_list.cc",
|
||||
"//third_party/libgav1/src/src/internal_frame_buffer_list.h",
|
||||
"//third_party/libgav1/src/src/obu_parser.cc",
|
||||
"//third_party/libgav1/src/src/obu_parser.h",
|
||||
"//third_party/libgav1/src/src/quantizer.cc",
|
||||
"//third_party/libgav1/src/src/quantizer.h",
|
||||
"//third_party/libgav1/src/src/status_code.cc",
|
||||
"//third_party/libgav1/src/src/symbol_decoder_context.cc",
|
||||
"//third_party/libgav1/src/src/symbol_decoder_context.h",
|
||||
"//third_party/libgav1/src/src/utils/bit_reader.cc",
|
||||
"//third_party/libgav1/src/src/utils/bit_reader.h",
|
||||
"//third_party/libgav1/src/src/utils/constants.cc",
|
||||
"//third_party/libgav1/src/src/utils/constants.h",
|
||||
"//third_party/libgav1/src/src/utils/logging.cc",
|
||||
"//third_party/libgav1/src/src/utils/logging.h",
|
||||
"//third_party/libgav1/src/src/utils/raw_bit_reader.cc",
|
||||
"//third_party/libgav1/src/src/utils/raw_bit_reader.h",
|
||||
"//third_party/libgav1/src/src/utils/segmentation.cc",
|
||||
"//third_party/libgav1/src/src/utils/segmentation.h",
|
||||
"//third_party/libgav1/src/src/utils/segmentation_map.cc",
|
||||
"//third_party/libgav1/src/src/utils/segmentation_map.h",
|
||||
"//third_party/libgav1/src/src/warp_prediction.cc",
|
||||
"//third_party/libgav1/src/src/warp_prediction.h",
|
||||
"//third_party/libgav1/src/src/yuv_buffer.cc",
|
||||
"//third_party/libgav1/src/src/yuv_buffer.h",
|
||||
]
|
||||
public_configs = [ ":public_libgav1_config" ]
|
||||
|
||||
sources = gav1_dsp_sources + gav1_dsp_headers_sources
|
||||
sources += gav1_dsp_avx2_sources + gav1_dsp_avx2_headers_sources
|
||||
}
|
||||
|
||||
# SSE4 sources are split to their own target as Chrome is currently built
|
||||
# with -msse3.
|
||||
source_set("libgav1_dsp_sse4") {
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
configs += [ "//build/config/compiler:no_chromium_code" ]
|
||||
configs += [ ":private_libgav1_config" ]
|
||||
|
||||
deps = [ ":libgav1_utils" ]
|
||||
public_configs = [ ":public_libgav1_config" ]
|
||||
|
||||
if (current_cpu == "x86" || current_cpu == "x64") {
|
||||
cflags = [ "-msse4.1" ]
|
||||
}
|
||||
|
||||
sources = gav1_dsp_sse4_sources + gav1_dsp_sse4_headers_sources +
|
||||
gav1_dsp_headers_sources + gav1_dsp_avx2_headers_sources
|
||||
}
|
||||
|
||||
static_library("libgav1") {
|
||||
configs -= [ "//build/config/compiler:chromium_code" ]
|
||||
configs += [ "//build/config/compiler:no_chromium_code" ]
|
||||
configs += [ ":private_libgav1_config" ]
|
||||
|
||||
public_configs = [ ":public_libgav1_config" ]
|
||||
public_deps = [
|
||||
":libgav1_dsp",
|
||||
":libgav1_utils",
|
||||
]
|
||||
|
||||
sources = gav1_common_sources
|
||||
sources += gav1_gav1_sources
|
||||
sources += gav1_post_filter_sources
|
||||
sources += gav1_tile_sources
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1286,7 +1286,6 @@ class ParserBase {
|
|||
// a scope where the name has also been let bound or the var declaration is
|
||||
// hoisted over such a scope.
|
||||
void CheckConflictingVarDeclarations(DeclarationScope* scope) {
|
||||
if (has_error()) return;
|
||||
bool allowed_catch_binding_var_redeclaration = false;
|
||||
Declaration* decl = scope->CheckConflictingVarDeclarations(
|
||||
&allowed_catch_binding_var_redeclaration);
|
||||
|
|
Loading…
Reference in a new issue