diff options
Diffstat (limited to 'chromium')
210 files changed, 955 insertions, 405 deletions
diff --git a/chromium/BUILD.gn b/chromium/BUILD.gn index f6280666f8c..6e2f9961de4 100644 --- a/chromium/BUILD.gn +++ b/chromium/BUILD.gn @@ -671,7 +671,7 @@ group("gn_all") { ] } - if (is_win) { + if (is_win && !use_qt) { deps += [ "//base:pe_image_test", "//chrome/chrome_cleaner", @@ -703,7 +703,7 @@ group("gn_all") { host_os == "win" && !use_qt) { deps += [ "//chrome/test/mini_installer:mini_installer_tests" ] } - } else if (!is_android && !is_ios && !is_fuchsia) { + } else if (!is_android && !is_ios && !is_fuchsia && !is_win) { deps += [ "//third_party/breakpad:symupload($host_toolchain)" ] } diff --git a/chromium/base/allocator/partition_alloc_support.cc b/chromium/base/allocator/partition_alloc_support.cc index b790cce503b..80393e18ebc 100644 --- a/chromium/base/allocator/partition_alloc_support.cc +++ b/chromium/base/allocator/partition_alloc_support.cc @@ -61,7 +61,10 @@ constexpr const char* ScannerIdToTracingString( case partition_alloc::internal::StatsCollector::ScannerId::kOverall: return "PCScan.Scanner"; case partition_alloc::internal::StatsCollector::ScannerId::kNumIds: +#if defined(__GNUC__) || defined(__clang__) __builtin_unreachable(); +#endif + return nullptr; } } @@ -77,7 +80,10 @@ constexpr const char* MutatorIdToTracingString( case partition_alloc::internal::StatsCollector::MutatorId::kOverall: return "PCScan.Mutator"; case partition_alloc::internal::StatsCollector::MutatorId::kNumIds: +#if defined(__GNUC__) || defined(__clang__) __builtin_unreachable(); +#endif + return nullptr; } } #endif // BUILDFLAG(ENABLE_BASE_TRACING) diff --git a/chromium/base/allocator/partition_allocator/BUILD.gn b/chromium/base/allocator/partition_allocator/BUILD.gn index 3eb4ca11897..3c9e166b325 100644 --- a/chromium/base/allocator/partition_allocator/BUILD.gn +++ b/chromium/base/allocator/partition_allocator/BUILD.gn @@ -262,7 +262,7 @@ target(partition_alloc_target_type, "partition_alloc") { "partition_alloc_base/mac/scoped_typeref.h", ] } - if (current_cpu == "x64") { + if (current_cpu == "x64" && (!is_win || is_clang)) { defines += [ "PA_PCSCAN_STACK_SUPPORTED" ] sources += [ "starscan/stack/asm/x64/push_registers_asm.cc" ] } else if (current_cpu == "x86") { diff --git a/chromium/base/allocator/partition_allocator/partition_alloc-inl.h b/chromium/base/allocator/partition_allocator/partition_alloc-inl.h index c90fa75cc9d..e6b9e3ac7b6 100644 --- a/chromium/base/allocator/partition_allocator/partition_alloc-inl.h +++ b/chromium/base/allocator/partition_allocator/partition_alloc-inl.h @@ -30,10 +30,14 @@ namespace partition_alloc::internal { PA_ALWAYS_INLINE void SecureMemset(void* ptr, uint8_t value, size_t size) { memset(ptr, value, size); +#if defined(__clang__) || defined(COMPILER_GCC) // As best as we can tell, this is sufficient to break any optimisations that // might try to eliminate "superfluous" memsets. If there's an easy way to // detect memset_s, it would be better to use that. __asm__ __volatile__("" : : "r"(ptr) : "memory"); +#else + _ReadBarrier(); +#endif } // Used to memset() memory for debugging purposes only. diff --git a/chromium/base/allocator/partition_allocator/partition_alloc_base/bits.h b/chromium/base/allocator/partition_allocator/partition_alloc_base/bits.h index 93e1a290919..f9a8a1faa27 100644 --- a/chromium/base/allocator/partition_allocator/partition_alloc_base/bits.h +++ b/chromium/base/allocator/partition_allocator/partition_alloc_base/bits.h @@ -99,13 +99,19 @@ PA_ALWAYS_INLINE constexpr : bits; } +#undef PA_BITOPS_CONSTEXPR + // Returns the integer i such as 2^i <= n < 2^(i+1). // // There is a common `BitLength` function, which returns the number of bits // required to represent a value. Rather than implement that function, // use `Log2Floor` and add 1 to the result. constexpr int Log2Floor(uint32_t n) { +#if defined(COMPILER_MSVC) && !defined(__clang__) + return 31 - qConstexprCountLeadingZeroBits32(n); +#else return 31 - CountLeadingZeroBits(n); +#endif } // Returns the integer i such as 2^(i-1) < n <= 2^i. @@ -113,7 +119,11 @@ constexpr int Log2Ceiling(uint32_t n) { // When n == 0, we want the function to return -1. // When n == 0, (n - 1) will underflow to 0xFFFFFFFF, which is // why the statement below starts with (n ? 32 : -1). +#if defined(COMPILER_MSVC) && !defined(__clang__) + return (n ? 32 : -1) - qConstexprCountLeadingZeroBits32(n - 1); +#else return (n ? 32 : -1) - CountLeadingZeroBits(n - 1); +#endif } // Returns a value of type T with a single bit set in the left-most position. diff --git a/chromium/base/allocator/partition_allocator/partition_alloc_base/sys_byteorder.h b/chromium/base/allocator/partition_allocator/partition_alloc_base/sys_byteorder.h index 59b3ee417ff..f2cd4960481 100644 --- a/chromium/base/allocator/partition_allocator/partition_alloc_base/sys_byteorder.h +++ b/chromium/base/allocator/partition_allocator/partition_alloc_base/sys_byteorder.h @@ -39,6 +39,16 @@ inline constexpr uint32_t ByteSwap(uint32_t x) { #endif } +#if defined(COMPILER_MSVC) && !defined(__clang__) +// https://developercommunity.visualstudio.com/t/constexpr-byte-swapping-optimization/983963 +template<class T, std::size_t... N>constexpr T bswap_impl(T i, std::index_sequence<N...>){ + return((((i >>(N * CHAR_BIT))&(T)(unsigned char)(-1))<<((sizeof(T)-1- N)* CHAR_BIT))|...); +}; +template<class T,class U =typename std::make_unsigned<T>::type>constexpr U bswap(T i) { + return bswap_impl<U>(i, std::make_index_sequence<sizeof(T)>{}); +} +#endif + inline constexpr uint64_t ByteSwap(uint64_t x) { // Per build/build_config.h, clang masquerades as MSVC on Windows. If we are // actually using clang, we can rely on the builtin. @@ -48,7 +58,7 @@ inline constexpr uint64_t ByteSwap(uint64_t x) { // as of 2021, but clang as we use it in Chromium doesn't, keeping a function // call for a single instruction. #if defined(COMPILER_MSVC) && !defined(__clang__) - return _byteswap_uint64(x); + return bswap(x); #else return __builtin_bswap64(x); #endif diff --git a/chromium/base/allocator/partition_allocator/partition_bucket.cc b/chromium/base/allocator/partition_allocator/partition_bucket.cc index 8d80d4bedcf..16612cb3d60 100644 --- a/chromium/base/allocator/partition_allocator/partition_bucket.cc +++ b/chromium/base/allocator/partition_allocator/partition_bucket.cc @@ -577,10 +577,8 @@ PA_ALWAYS_INLINE SlotSpanMetadata<thread_safe>* PartitionBucket<thread_safe>::AllocNewSlotSpan(PartitionRoot<thread_safe>* root, unsigned int flags, size_t slot_span_alignment) { - PA_DCHECK(!(reinterpret_cast<uintptr_t>(root->next_partition_page) % - PartitionPageSize())); - PA_DCHECK(!(reinterpret_cast<uintptr_t>(root->next_partition_page_end) % - PartitionPageSize())); + PA_DCHECK(!(root->next_partition_page % PartitionPageSize())); + PA_DCHECK(!(root->next_partition_page_end % PartitionPageSize())); size_t num_partition_pages = get_pages_per_slot_span(); size_t slot_span_reservation_size = num_partition_pages diff --git a/chromium/base/allocator/partition_allocator/partition_bucket_lookup.h b/chromium/base/allocator/partition_allocator/partition_bucket_lookup.h index bb46aa02aac..b70b75a30d1 100644 --- a/chromium/base/allocator/partition_allocator/partition_bucket_lookup.h +++ b/chromium/base/allocator/partition_allocator/partition_bucket_lookup.h @@ -252,9 +252,14 @@ PA_ALWAYS_INLINE constexpr uint16_t BucketIndexLookup::GetIndexForDenserBuckets( // This forces the bucket table to be constant-initialized and immediately // materialized in the binary. constexpr BucketIndexLookup lookup{}; - const size_t order = +#if defined(COMPILER_MSVC) && !defined(__clang__) + const uint8_t order = + kBitsPerSizeT - base::bits::qConstexprCountLeadingZeroBits64(size); +#else + const uint8_t order = kBitsPerSizeT - static_cast<size_t>(base::bits::CountLeadingZeroBits(size)); +#endif // The order index is simply the next few bits after the most significant // bit. const size_t order_index = @@ -264,7 +269,7 @@ PA_ALWAYS_INLINE constexpr uint16_t BucketIndexLookup::GetIndexForDenserBuckets( const uint16_t index = lookup.bucket_index_lookup_[(order << kNumBucketsPerOrderBits) + order_index + !!sub_order_index]; - PA_DCHECK(index <= kNumBuckets); // Last one is the sentinel bucket. +// PA_DCHECK(index <= kNumBuckets); // Last one is the sentinel bucket. return index; } diff --git a/chromium/base/allocator/partition_allocator/partition_page.cc b/chromium/base/allocator/partition_allocator/partition_page.cc index 17860aa9659..982e516a88e 100644 --- a/chromium/base/allocator/partition_allocator/partition_page.cc +++ b/chromium/base/allocator/partition_allocator/partition_page.cc @@ -305,15 +305,15 @@ void UnmapNow(uintptr_t reservation_start, if (pool == GetBRPPool()) { // In 32-bit mode, the beginning of a reservation may be excluded from the // BRP pool, so shift the pointer. Other pools don't have this logic. - PA_DCHECK(IsManagedByPartitionAllocBRPPool( -#if defined(PA_HAS_64_BITS_POINTERS) - reservation_start -#else - reservation_start + - AddressPoolManagerBitmap::kBytesPer1BitOfBRPPoolBitmap * - AddressPoolManagerBitmap::kGuardOffsetOfBRPPoolBitmap -#endif - )); +// PA_DCHECK(IsManagedByPartitionAllocBRPPool( +// #if defined(PA_HAS_64_BITS_POINTERS) +// reservation_start +// #else +// reservation_start + +// AddressPoolManagerBitmap::kBytesPer1BitOfBRPPoolBitmap * +// AddressPoolManagerBitmap::kGuardOffsetOfBRPPoolBitmap +// #endif +// )); } else #endif // BUILDFLAG(USE_BACKUP_REF_PTR) { diff --git a/chromium/base/allocator/partition_allocator/partition_root.h b/chromium/base/allocator/partition_allocator/partition_root.h index 609a4089235..f4be80bfb06 100644 --- a/chromium/base/allocator/partition_allocator/partition_root.h +++ b/chromium/base/allocator/partition_allocator/partition_root.h @@ -1370,7 +1370,11 @@ PA_ALWAYS_INLINE void PartitionRoot<thread_safe>::RawFree(uintptr_t slot_start, // OS page. No need to write to the second one as well. // // Do not move the store above inside the locked section. +#if defined(__clang__) || defined(COMPILER_GCC) __asm__ __volatile__("" : : "r"(slot_start) : "memory"); +#else + _ReadBarrier(); +#endif ::partition_alloc::internal::ScopedGuard guard{lock_}; FreeInSlotSpan(slot_start, slot_span); diff --git a/chromium/base/allocator/partition_allocator/partition_tls.h b/chromium/base/allocator/partition_allocator/partition_tls.h index da7f0e76020..e1889a21d88 100644 --- a/chromium/base/allocator/partition_allocator/partition_tls.h +++ b/chromium/base/allocator/partition_allocator/partition_tls.h @@ -129,10 +129,12 @@ PA_ALWAYS_INLINE bool PartitionTlsCreate(PartitionTlsKey* key, void (*destructor)(void*)) { // NOTIMPLEMENTED() may allocate, crash instead. PA_IMMEDIATE_CRASH(); + return false; } PA_ALWAYS_INLINE void* PartitionTlsGet(PartitionTlsKey key) { PA_IMMEDIATE_CRASH(); + return nullptr; } PA_ALWAYS_INLINE void PartitionTlsSet(PartitionTlsKey key, void* value) { diff --git a/chromium/base/allocator/partition_allocator/reservation_offset_table.h b/chromium/base/allocator/partition_allocator/reservation_offset_table.h index c835810198e..934011e87a6 100644 --- a/chromium/base/allocator/partition_allocator/reservation_offset_table.h +++ b/chromium/base/allocator/partition_allocator/reservation_offset_table.h @@ -165,7 +165,7 @@ PA_ALWAYS_INLINE uintptr_t ComputeReservationStart(uintptr_t address, // If the given address doesn't point to direct-map allocated memory, // returns 0. PA_ALWAYS_INLINE uintptr_t GetDirectMapReservationStart(uintptr_t address) { -#if BUILDFLAG(PA_DCHECK_IS_ON) +#if BUILDFLAG(PA_DCHECK_IS_ON) && !defined(COMPILER_MSVC) bool is_in_brp_pool = IsManagedByPartitionAllocBRPPool(address); bool is_in_regular_pool = IsManagedByPartitionAllocRegularPool(address); // When USE_BACKUP_REF_PTR is off, BRP pool isn't used. @@ -178,7 +178,7 @@ PA_ALWAYS_INLINE uintptr_t GetDirectMapReservationStart(uintptr_t address) { if (*offset_ptr == kOffsetTagNormalBuckets) return 0; uintptr_t reservation_start = ComputeReservationStart(address, offset_ptr); -#if BUILDFLAG(PA_DCHECK_IS_ON) +#if BUILDFLAG(PA_DCHECK_IS_ON) && !defined(COMPILER_MSVC) // Make sure the reservation start is in the same pool as |address|. // In the 32-bit mode, the beginning of a reservation may be excluded from the // BRP pool, so shift the pointer. The other pools don't have this logic. diff --git a/chromium/base/allocator/partition_allocator/starscan/pcscan_internal.cc b/chromium/base/allocator/partition_allocator/starscan/pcscan_internal.cc index 432c2f0e414..12eea6257db 100644 --- a/chromium/base/allocator/partition_allocator/starscan/pcscan_internal.cc +++ b/chromium/base/allocator/partition_allocator/starscan/pcscan_internal.cc @@ -327,6 +327,7 @@ class SuperPageSnapshot final { // // For systems with runtime-defined page size, assume partition page size is // at least 16kiB. +#if defined(COMPILER_GCC) || defined(__clang__) static constexpr size_t kMinPartitionPageSize = __builtin_constant_p(PartitionPageSize()) ? PartitionPageSize() : 1 << 14; static constexpr size_t kStateBitmapMinReservedSize = @@ -335,6 +336,12 @@ class SuperPageSnapshot final { : partition_alloc::internal::base::bits::AlignUp( sizeof(AllocationStateMap), kMinPartitionPageSize); +#else + static constexpr size_t kMinPartitionPageSize = 1 << 14; + static constexpr size_t kQuarantineBitmapsReservedSize = + base::bits::AlignUp(2 * sizeof(QuarantineBitmap), + kMinPartitionPageSize); +#endif // Take into account guard partition page at the end of super-page. static constexpr size_t kGuardPagesSize = 2 * kMinPartitionPageSize; diff --git a/chromium/base/allocator/partition_allocator/starscan/scan_loop.h b/chromium/base/allocator/partition_allocator/starscan/scan_loop.h index 49aa9e18138..7461607c4f9 100644 --- a/chromium/base/allocator/partition_allocator/starscan/scan_loop.h +++ b/chromium/base/allocator/partition_allocator/starscan/scan_loop.h @@ -15,7 +15,8 @@ #include "base/allocator/partition_allocator/tagging.h" #include "build/build_config.h" -#if defined(ARCH_CPU_X86_64) +#if defined(ARCH_CPU_X86_64) && !defined(_MSC_VER) +#define ARCH_CPU_X86_64_WORKS // Include order is important, so we disable formatting. // clang-format off // Including these headers directly should generally be avoided. For the @@ -59,7 +60,7 @@ class ScanLoop { const Derived& derived() const { return static_cast<const Derived&>(*this); } Derived& derived() { return static_cast<Derived&>(*this); } -#if defined(ARCH_CPU_X86_64) +#if defined(ARCH_CPU_X86_64_WORKS) __attribute__((target("avx2"))) void RunAVX2(uintptr_t, uintptr_t); __attribute__((target("sse4.1"))) void RunSSE4(uintptr_t, uintptr_t); #endif @@ -76,7 +77,7 @@ template <typename Derived> void ScanLoop<Derived>::Run(uintptr_t begin, uintptr_t end) { // We allow vectorization only for 64bit since they require support of the // 64bit cage, and only for x86 because a special instruction set is required. -#if defined(ARCH_CPU_X86_64) +#if defined(ARCH_CPU_X86_64_WORKS) if (simd_type_ == SimdSupport::kAVX2) return RunAVX2(begin, end); if (simd_type_ == SimdSupport::kSSE41) @@ -116,7 +117,7 @@ void ScanLoop<Derived>::RunUnvectorized(uintptr_t begin, uintptr_t end) { } } -#if defined(ARCH_CPU_X86_64) +#if defined(ARCH_CPU_X86_64_WORKS) template <typename Derived> __attribute__((target("avx2"))) void ScanLoop<Derived>::RunAVX2(uintptr_t begin, uintptr_t end) { diff --git a/chromium/base/allocator/partition_allocator/starscan/stack/asm/x64/push_registers_asm.cc b/chromium/base/allocator/partition_allocator/starscan/stack/asm/x64/push_registers_asm.cc index 159f73638fd..adba1af5453 100644 --- a/chromium/base/allocator/partition_allocator/starscan/stack/asm/x64/push_registers_asm.cc +++ b/chromium/base/allocator/partition_allocator/starscan/stack/asm/x64/push_registers_asm.cc @@ -15,7 +15,7 @@ // _WIN64 Defined as 1 when the compilation target is 64-bit ARM or x64. // Otherwise, undefined. #ifdef _WIN64 - +#if defined(__clang__) // We maintain 16-byte alignment at calls. There is an 8-byte return address // on the stack and we push 72 bytes which maintains 16-byte stack alignment // at the call. @@ -47,7 +47,7 @@ asm(".globl PAPushAllRegistersAndIterateStack \n" // Restore rbp as it was used as frame pointer. " pop %rbp \n" " ret \n"); - +#endif #else // !_WIN64 // We maintain 16-byte alignment at calls. There is an 8-byte return address diff --git a/chromium/base/allocator/partition_allocator/starscan/stack/stack.cc b/chromium/base/allocator/partition_allocator/starscan/stack/stack.cc index b0f1894ba3c..fd180cfc170 100644 --- a/chromium/base/allocator/partition_allocator/starscan/stack/stack.cc +++ b/chromium/base/allocator/partition_allocator/starscan/stack/stack.cc @@ -88,7 +88,11 @@ Stack::Stack(void* stack_top) : stack_top_(stack_top) { } PA_NOINLINE uintptr_t* GetStackPointer() { +#if defined(COMPILER_GCC) || defined(__clang__) return reinterpret_cast<uintptr_t*>(__builtin_frame_address(0)); +#else + return nullptr; +#endif } namespace { diff --git a/chromium/base/allocator/partition_allocator/starscan/state_bitmap.h b/chromium/base/allocator/partition_allocator/starscan/state_bitmap.h index 10b0138c432..59c3f3d5648 100644 --- a/chromium/base/allocator/partition_allocator/starscan/state_bitmap.h +++ b/chromium/base/allocator/partition_allocator/starscan/state_bitmap.h @@ -68,8 +68,8 @@ class StateBitmap final { using CellType = uintptr_t; static constexpr size_t kBitsPerCell = sizeof(CellType) * CHAR_BIT; - static constexpr size_t kBitsNeededForAllocation = - base::bits::Log2Floor(static_cast<size_t>(State::kNumOfStates)); + static constexpr size_t kBitsNeededForAllocation = 2; +// base::bits::Log2Floor(static_cast<size_t>(State::kNumOfStates)); static constexpr CellType kStateMask = (1 << kBitsNeededForAllocation) - 1; static constexpr size_t kBitmapSize = @@ -235,7 +235,12 @@ StateBitmap<PageSize, PageAlignment, AllocationAlignment>::Quarantine( auto& cell = AsAtomicCell(cell_index); const CellType cell_before = cell.fetch_and(mask, std::memory_order_relaxed); // Check if the previous state was also quarantined. - return __builtin_popcount(static_cast<unsigned>((cell_before >> object_bit) & +#if defined(_MSC_VER) + return __popcnt64( +#else + return __builtin_popcount( +#endif + static_cast<unsigned>((cell_before >> object_bit) & kStateMask)) != 1; } @@ -306,7 +311,11 @@ StateBitmap<PageSize, PageAlignment, AllocationAlignment>::IsQuarantined( uintptr_t address) const { // On x86 CPI of popcnt is the same as tzcnt, so we use it instead of tzcnt + // inversion. +#if defined(_MSC_VER) + return __popcnt64(GetBits(address)) == 1; +#else return __builtin_popcount(GetBits(address)) == 1; +#endif } template <size_t PageSize, size_t PageAlignment, size_t AllocationAlignment> @@ -347,7 +356,11 @@ unsigned StateBitmap<PageSize, PageAlignment, AllocationAlignment>::GetBits( template <size_t PageSize, size_t PageAlignment, size_t AllocationAlignment> bool StateBitmap<PageSize, PageAlignment, AllocationAlignment>:: FilterQuarantine::operator()(CellType bits) const { +#if defined(_MSC_VER) + return __popcnt64(bits) == 1; +#else return __builtin_popcount(bits) == 1; +#endif } template <size_t PageSize, size_t PageAlignment, size_t AllocationAlignment> diff --git a/chromium/base/allocator/partition_allocator/starscan/stats_collector.h b/chromium/base/allocator/partition_allocator/starscan/stats_collector.h index c6f21ec84c8..4095f789ea6 100644 --- a/chromium/base/allocator/partition_allocator/starscan/stats_collector.h +++ b/chromium/base/allocator/partition_allocator/starscan/stats_collector.h @@ -217,7 +217,11 @@ inline StatsCollector::MetadataString StatsCollector::ToUMAString( case ScannerId::kOverall: return "PA.PCScan." + process_name + ".Scanner"; case ScannerId::kNumIds: +#if defined(__clang__) || defined(__GNUC__) __builtin_unreachable(); +#else + __assume(0); +#endif } } @@ -235,7 +239,11 @@ inline StatsCollector::MetadataString StatsCollector::ToUMAString( case MutatorId::kOverall: return "PA.PCScan." + process_name + ".Mutator"; case MutatorId::kNumIds: +#if defined(__clang__) || defined(__GNUC__) __builtin_unreachable(); +#else + break; +#endif } } diff --git a/chromium/base/allocator/partition_allocator/yield_processor.h b/chromium/base/allocator/partition_allocator/yield_processor.h index 0d987cbf14a..78256de0ed0 100644 --- a/chromium/base/allocator/partition_allocator/yield_processor.h +++ b/chromium/base/allocator/partition_allocator/yield_processor.h @@ -18,7 +18,14 @@ #define PA_YIELD_PROCESSOR ((void)0) #else +#if defined(COMPILER_MSVC) +#include <intrin.h> #if defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_X86) +#define PA_YIELD_PROCESSOR _mm_pause() +#else +#define PA_YIELD_PROCESSOR __yield() +#endif +#elif defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_X86) #define PA_YIELD_PROCESSOR __asm__ __volatile__("pause") #elif (defined(ARCH_CPU_ARMEL) && __ARM_ARCH >= 6) || defined(ARCH_CPU_ARM64) #define PA_YIELD_PROCESSOR __asm__ __volatile__("yield") diff --git a/chromium/base/bits.h b/chromium/base/bits.h index 512ea7bb46f..b15e90ac0e8 100644 --- a/chromium/base/bits.h +++ b/chromium/base/bits.h @@ -115,12 +115,20 @@ ALWAYS_INLINE constexpr // use `Log2Floor` and add 1 to the result. // // TODO(pkasting): When C++20 is available, replace with std::bit_xxx(). +#if defined(COMPILER_MSVC) && !defined(__clang__) +inline int Log2Floor(uint32_t n) { +#else constexpr int Log2Floor(uint32_t n) { +#endif return 31 - CountLeadingZeroBits(n); } // Returns the integer i such as 2^(i-1) < n <= 2^i. +#if defined(COMPILER_MSVC) && !defined(__clang__) +inline int Log2Ceiling(uint32_t n) { +#else constexpr int Log2Ceiling(uint32_t n) { +#endif // When n == 0, we want the function to return -1. // When n == 0, (n - 1) will underflow to 0xFFFFFFFF, which is // why the statement below starts with (n ? 32 : -1). diff --git a/chromium/base/check.h b/chromium/base/check.h index 55339b2a329..8d46ceec169 100644 --- a/chromium/base/check.h +++ b/chromium/base/check.h @@ -6,6 +6,7 @@ #define BASE_CHECK_H_ #include <iosfwd> +#include <ostream> #include "base/base_export.h" #include "base/compiler_specific.h" diff --git a/chromium/base/compiler_specific.h b/chromium/base/compiler_specific.h index 995ba1c2e19..ee0a16ea00a 100644 --- a/chromium/base/compiler_specific.h +++ b/chromium/base/compiler_specific.h @@ -7,9 +7,9 @@ #include "build/build_config.h" -#if defined(COMPILER_MSVC) && !defined(__clang__) -#error "Only clang-cl is supported on Windows, see https://crbug.com/988071" -#endif +// #if defined(COMPILER_MSVC) && !defined(__clang__) +// #error "Only clang-cl is supported on Windows, see https://crbug.com/988071" +// #endif // This is a wrapper around `__has_cpp_attribute`, which can be used to test for // the presence of an attribute. In case the compiler does not support this @@ -201,7 +201,7 @@ // Macro useful for writing cross-platform function pointers. #if !defined(CDECL) -#if BUILDFLAG(IS_WIN) +#if BUILDFLAG(IS_WIN) && (defined(__i386) || defined(__i386__) || defined(_M_IX86)) #define CDECL __cdecl #else // BUILDFLAG(IS_WIN) #define CDECL diff --git a/chromium/base/containers/contiguous_iterator.h b/chromium/base/containers/contiguous_iterator.h index 4559fae44d6..c2f8a1be5f7 100644 --- a/chromium/base/containers/contiguous_iterator.h +++ b/chromium/base/containers/contiguous_iterator.h @@ -1,4 +1,4 @@ -// Copyright 2020 The Chromium Authors. All rights reserved. + // Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -45,10 +45,18 @@ struct IsStringIter // An iterator to std::array is contiguous. // Reference: https://wg21.link/array.overview#1 -template <typename T, typename ArrayT = std::array<iter_value_t<T>, 1>> -struct IsArrayIter +template <typename T, size_t Num, typename ArrayT = std::array<iter_value_t<T>, Num>> +struct IsArrayIterImpl : std::disjunction<std::is_same<T, typename ArrayT::const_iterator>, - std::is_same<T, typename ArrayT::iterator>> {}; + std::is_same<T, typename ArrayT::iterator>> {}; + +template <typename T> +struct IsArrayIter + : std::disjunction<IsArrayIterImpl<T, 1>, + IsArrayIterImpl<T, 8>, + IsArrayIterImpl<T, 16>, + IsArrayIterImpl<T, 32>, + IsArrayIterImpl<T, 64>> {}; // An iterator to a non-bool std::vector is contiguous. // Reference: https://wg21.link/vector.overview#2 diff --git a/chromium/base/debug/invalid_access_win.cc b/chromium/base/debug/invalid_access_win.cc index c2dd0604089..67eb33f1ff4 100644 --- a/chromium/base/debug/invalid_access_win.cc +++ b/chromium/base/debug/invalid_access_win.cc @@ -29,11 +29,15 @@ static constexpr int kNopInstructionSize = 4; #endif // Function that can be jumped midway into safely. +#if defined(COMPILER_MSVC) +int nop_sled() { return 0; } +#else __attribute__((naked)) int nop_sled() { asm("nop\n" "nop\n" "ret\n"); } +#endif // defined(COMPILER_MSVC) using FuncType = decltype(&nop_sled); diff --git a/chromium/base/export_template.h b/chromium/base/export_template.h index b4fc8fe5fbd..e177fa5b7b9 100644 --- a/chromium/base/export_template.h +++ b/chromium/base/export_template.h @@ -105,6 +105,7 @@ #define EXPORT_TEMPLATE_STYLE_MATCH_DECLSPEC_dllexport EXPORT_DLLEXPORT #define EXPORT_TEMPLATE_STYLE_MATCH_DECLSPEC_dllimport DEFAULT +#if defined(__clang__) // Sanity checks. // // EXPORT_TEMPLATE_TEST uses the same macro invocation pattern as @@ -143,5 +144,6 @@ EXPORT_TEMPLATE_TEST(DEFAULT, __declspec(dllimport)); #undef EXPORT_TEMPLATE_TEST #undef EXPORT_TEMPLATE_TEST_DEFAULT_DEFAULT #undef EXPORT_TEMPLATE_TEST_EXPORT_DLLEXPORT_EXPORT_DLLEXPORT +#endif #endif // BASE_EXPORT_TEMPLATE_H_ diff --git a/chromium/base/feature_list.h b/chromium/base/feature_list.h index 0e2e1b81aef..33a28cf19b8 100644 --- a/chromium/base/feature_list.h +++ b/chromium/base/feature_list.h @@ -60,6 +60,7 @@ enum FeatureState { // non-readonly memory, therefore requiring a bypass of the "Mutable Constants" // check. struct BASE_EXPORT LOGICALLY_CONST Feature { + constexpr Feature() : name(nullptr), default_state(FEATURE_DISABLED_BY_DEFAULT) {} constexpr Feature(const char* name, FeatureState default_state) : name(name), default_state(default_state) { #if BUILDFLAG(ENABLE_BANNED_BASE_FEATURE_PREFIX) diff --git a/chromium/base/immediate_crash.h b/chromium/base/immediate_crash.h index b6ccd54a474..b658c5b9370 100644 --- a/chromium/base/immediate_crash.h +++ b/chromium/base/immediate_crash.h @@ -134,7 +134,11 @@ // calling function, but to this anonymous lambda. This is still useful as the // full name of the lambda will typically include the name of the function that // calls CHECK() and the debugger will still break at the right line of code. -#if !defined(COMPILER_GCC) || defined(__clang__) +#if defined(COMPILER_MSVC) && !defined(__clang__) + +#define WRAPPED_TRAP_SEQUENCE_() TRAP_SEQUENCE1_() + +#elif !defined(COMPILER_GCC) || defined(__clang__) #define WRAPPED_TRAP_SEQUENCE_() TRAP_SEQUENCE_() diff --git a/chromium/base/memory/raw_ptr.h b/chromium/base/memory/raw_ptr.h index 2ae5d979889..16735a2084c 100644 --- a/chromium/base/memory/raw_ptr.h +++ b/chromium/base/memory/raw_ptr.h @@ -1021,6 +1021,15 @@ class TRIVIAL_ABI GSL_POINTER raw_ptr { return *this += -delta_elems; } + template<typename U, typename = std::enable_if_t<std::is_integral<U>::value>> + ALWAYS_INLINE T* operator+(U delta_elems) const { + return get() + delta_elems; + } + template<typename U, typename = std::enable_if_t<std::is_integral<U>::value>> + ALWAYS_INLINE T* operator-(U delta_elems) const { + return get() - delta_elems; + } + // Stop referencing the underlying pointer and free its memory. Compared to // raw delete calls, this avoids the raw_ptr to be temporarily dangling // during the free operation, which will lead to taking the slower path that diff --git a/chromium/base/memory/shared_memory_mapping.h b/chromium/base/memory/shared_memory_mapping.h index c72114007a9..664df003ee3 100644 --- a/chromium/base/memory/shared_memory_mapping.h +++ b/chromium/base/memory/shared_memory_mapping.h @@ -189,9 +189,10 @@ class BASE_EXPORT WritableSharedMemoryMapping : public SharedMemoryMapping { // enough to contain a T, or nullptr otherwise. template <typename T> T* GetMemoryAs() const { - static_assert(std::is_trivially_copyable<T>::value, - "Copying non-trivially-copyable object across memory spaces " - "is dangerous"); +// FIXME: assert is triggered by https://crbug.com/1134659 with MSVC +// static_assert(std::is_trivially_copyable<T>::value, +// "Copying non-trivially-copyable object across memory spaces " +// "is dangerous"); if (!IsValid()) return nullptr; if (sizeof(T) > size()) diff --git a/chromium/base/metrics/histogram_macros.h b/chromium/base/metrics/histogram_macros.h index 32d9dcef4d2..02fc677920f 100644 --- a/chromium/base/metrics/histogram_macros.h +++ b/chromium/base/metrics/histogram_macros.h @@ -11,6 +11,10 @@ #include "base/metrics/histogram_macros_local.h" #include "base/time/time.h" +#ifndef CR_EXPAND_ARG +#define CR_EXPAND_ARG(x) x +#endif + // Macros for efficient use of histograms. // @@ -77,10 +81,10 @@ // enum to an arithmetic type and adding one. Instead, prefer the two argument // version of the macro which automatically deduces the boundary from kMaxValue. #define UMA_HISTOGRAM_ENUMERATION(name, ...) \ - INTERNAL_UMA_HISTOGRAM_ENUMERATION_GET_MACRO( \ + CR_EXPAND_ARG(INTERNAL_UMA_HISTOGRAM_ENUMERATION_GET_MACRO( \ __VA_ARGS__, INTERNAL_UMA_HISTOGRAM_ENUMERATION_SPECIFY_BOUNDARY, \ INTERNAL_UMA_HISTOGRAM_ENUMERATION_DEDUCE_BOUNDARY) \ - (name, __VA_ARGS__, base::HistogramBase::kUmaTargetedHistogramFlag) + (name, __VA_ARGS__, base::HistogramBase::kUmaTargetedHistogramFlag)) // As above but "scaled" count to avoid overflows caused by increments of // large amounts. See UMA_HISTOGRAM_SCALED_EXACT_LINEAR for more information. @@ -359,10 +363,10 @@ enum class ScopedHistogramTiming { base::HistogramBase::kUmaStabilityHistogramFlag) #define UMA_STABILITY_HISTOGRAM_ENUMERATION(name, ...) \ - INTERNAL_UMA_HISTOGRAM_ENUMERATION_GET_MACRO( \ + CR_EXPAND_ARG(INTERNAL_UMA_HISTOGRAM_ENUMERATION_GET_MACRO( \ __VA_ARGS__, INTERNAL_UMA_HISTOGRAM_ENUMERATION_SPECIFY_BOUNDARY, \ INTERNAL_UMA_HISTOGRAM_ENUMERATION_DEDUCE_BOUNDARY) \ - (name, __VA_ARGS__, base::HistogramBase::kUmaStabilityHistogramFlag) + (name, __VA_ARGS__, base::HistogramBase::kUmaStabilityHistogramFlag)) #define UMA_STABILITY_HISTOGRAM_LONG_TIMES(name, sample) \ STATIC_HISTOGRAM_POINTER_BLOCK( \ diff --git a/chromium/base/metrics/histogram_macros_internal.h b/chromium/base/metrics/histogram_macros_internal.h index 191dc036fb0..80b0e786d3a 100644 --- a/chromium/base/metrics/histogram_macros_internal.h +++ b/chromium/base/metrics/histogram_macros_internal.h @@ -28,9 +28,9 @@ namespace internal { template <typename Enum, typename SFINAE = void> struct EnumSizeTraits { static constexpr Enum Count() { - static_assert( - sizeof(Enum) == 0, - "enumerator must define kMaxValue enumerator to use this macro!"); +// static_assert( +// sizeof(Enum) == 0, +// "enumerator must define kMaxValue enumerator to use this macro!"); return Enum(); } }; diff --git a/chromium/base/metrics/histogram_macros_local.h b/chromium/base/metrics/histogram_macros_local.h index e41b5ef3e8c..951b9c26084 100644 --- a/chromium/base/metrics/histogram_macros_local.h +++ b/chromium/base/metrics/histogram_macros_local.h @@ -9,6 +9,10 @@ #include "base/metrics/histogram_macros_internal.h" #include "base/time/time.h" +#ifndef CR_EXPAND_ARG +#define CR_EXPAND_ARG(x) x +#endif + // TODO(rkaplow): Migrate all LOCAL_* usage within Chromium to include this // file instead of the histogram_macros.h file. @@ -18,10 +22,10 @@ // For usage details, see the equivalents in histogram_macros.h. #define LOCAL_HISTOGRAM_ENUMERATION(name, ...) \ - INTERNAL_UMA_HISTOGRAM_ENUMERATION_GET_MACRO( \ + CR_EXPAND_ARG(INTERNAL_UMA_HISTOGRAM_ENUMERATION_GET_MACRO( \ __VA_ARGS__, INTERNAL_UMA_HISTOGRAM_ENUMERATION_SPECIFY_BOUNDARY, \ INTERNAL_UMA_HISTOGRAM_ENUMERATION_DEDUCE_BOUNDARY) \ - (name, __VA_ARGS__, base::HistogramBase::kNoFlags) + (name, __VA_ARGS__, base::HistogramBase::kNoFlags)) #define LOCAL_HISTOGRAM_BOOLEAN(name, sample) \ STATIC_HISTOGRAM_POINTER_BLOCK(name, AddBoolean(sample), \ diff --git a/chromium/base/notreached.h b/chromium/base/notreached.h index 044e7067862..5ee6831849c 100644 --- a/chromium/base/notreached.h +++ b/chromium/base/notreached.h @@ -25,10 +25,17 @@ namespace logging { // implemented yet. If output spam is a serious concern, // NOTIMPLEMENTED_LOG_ONCE can be used. #if DCHECK_IS_ON() +#ifdef _MSC_VER +#define NOTIMPLEMENTED() \ + ::logging::CheckError::NotImplemented(__FILE__, __LINE__, \ + __FUNCSIG__) \ + .stream() +#else #define NOTIMPLEMENTED() \ ::logging::CheckError::NotImplemented(__FILE__, __LINE__, \ __PRETTY_FUNCTION__) \ .stream() +#endif #else #define NOTIMPLEMENTED() EAT_CHECK_STREAM_PARAMS() #endif diff --git a/chromium/base/parameter_pack.h b/chromium/base/parameter_pack.h index 7e657d33889..3f8de9b3071 100644 --- a/chromium/base/parameter_pack.h +++ b/chromium/base/parameter_pack.h @@ -85,6 +85,31 @@ struct ParameterPack { std::bool_constant<all_of({std::is_same<NthType<0>, Ts>::value...})>; }; +template <> +struct ParameterPack<> { + // Checks if |Type| occurs in the parameter pack. + template <typename Type> + using HasType = bool_constant<false>; + // Checks if the parameter pack only contains |Type|. + template <typename Type> + using OnlyHasType = bool_constant<true>; + // Checks if |Type| occurs only once in the parameter pack. + template <typename Type> + using IsUniqueInPack = bool_constant<false>; + // Returns the zero-based index of |Type| within |Pack...| or |pack_npos| if + // it's not within the pack. + template <typename Type> + static constexpr size_t IndexInPack() { + return pack_npos; + } + // Helper for extracting the Nth type from a parameter pack. + template <size_t N> + using NthType = void; + // Checks if every type in the parameter pack is the same. + using IsAllSameType = + bool_constant<true>; +}; + } // namespace base #endif // BASE_PARAMETER_PACK_H_ diff --git a/chromium/base/ranges/ranges.h b/chromium/base/ranges/ranges.h index 69c7796b38d..7017d7fc5e8 100644 --- a/chromium/base/ranges/ranges.h +++ b/chromium/base/ranges/ranges.h @@ -25,17 +25,30 @@ constexpr T* begin(T (&array)[N], priority_tag<2>) { // Overload for mutable std::array. Required since std::array::begin is not // constexpr prior to C++17. Needs to dispatch to the const overload since only // const operator[] is constexpr in C++14. +#ifdef _MSC_VER +template <typename T, size_t N> +constexpr typename std::array<T, N>::iterator begin(std::array<T, N>& array, priority_tag<2> tag) { + return array.begin(); +} +#else template <typename T, size_t N> constexpr T* begin(std::array<T, N>& array, priority_tag<2> tag) { return const_cast<T*>(begin(const_cast<const std::array<T, N>&>(array), tag)); } - +#endif // Overload for const std::array. Required since std::array::begin is not // constexpr prior to C++17. +#ifdef _MSC_VER +template <typename T, size_t N> +constexpr typename std::array<T, N>::const_iterator begin(const std::array<T, N>& array, priority_tag<2>) { + return array.cbegin(); +} +#else template <typename T, size_t N> constexpr const T* begin(const std::array<T, N>& array, priority_tag<2>) { return N != 0 ? &array[0] : nullptr; } +#endif // Generic container overload. template <typename Range> @@ -60,17 +73,31 @@ constexpr T* end(T (&array)[N], priority_tag<2>) { // Overload for mutable std::array. Required since std::array::end is not // constexpr prior to C++17. Needs to dispatch to the const overload since only // const operator[] is constexpr in C++14. +#ifdef _MSC_VER +template <typename T, size_t N> +constexpr typename std::array<T, N>::iterator end(std::array<T, N>& array, priority_tag<2> tag) { + return array.end(); +} +#else template <typename T, size_t N> constexpr T* end(std::array<T, N>& array, priority_tag<2> tag) { return const_cast<T*>(end(const_cast<const std::array<T, N>&>(array), tag)); } +#endif // Overload for const std::array. Required since std::array::end is not // constexpr prior to C++17. +#ifdef _MSC_VER +template <typename T, size_t N> +constexpr typename std::array<T, N>::const_iterator end(const std::array<T, N>& array, priority_tag<2>) { + return array.cend(); +} +#else template <typename T, size_t N> constexpr const T* end(const std::array<T, N>& array, priority_tag<2>) { return N != 0 ? (&array[0]) + N : nullptr; } +#endif // Generic container overload. template <typename Range> diff --git a/chromium/base/third_party/double_conversion/BUILD.gn b/chromium/base/third_party/double_conversion/BUILD.gn index 0083efdcd9c..f2976764775 100644 --- a/chromium/base/third_party/double_conversion/BUILD.gn +++ b/chromium/base/third_party/double_conversion/BUILD.gn @@ -5,10 +5,12 @@ config("config") { visibility = [ ":double_conversion" ] - cflags = [ - "-Wno-unused-const-variable", - "-Wno-unused-function", - ] + if (is_clang || !is_win) { + cflags = [ + "-Wno-unused-const-variable", + "-Wno-unused-function", + ] + } } static_library("double_conversion") { diff --git a/chromium/base/trace_event/optional_trace_event.h b/chromium/base/trace_event/optional_trace_event.h index 860a25bc51e..90a6e0766f2 100644 --- a/chromium/base/trace_event/optional_trace_event.h +++ b/chromium/base/trace_event/optional_trace_event.h @@ -15,9 +15,13 @@ #if BUILDFLAG(OPTIONAL_TRACE_EVENTS_ENABLED) -#define OPTIONAL_TRACE_EVENT0(...) TRACE_EVENT0(__VA_ARGS__) -#define OPTIONAL_TRACE_EVENT1(...) TRACE_EVENT1(__VA_ARGS__) -#define OPTIONAL_TRACE_EVENT2(...) TRACE_EVENT2(__VA_ARGS__) +#ifndef CR_EXPAND_ARG +#define CR_EXPAND_ARG(x) x +#endif + +#define OPTIONAL_TRACE_EVENT0(...) CR_EXPAND_ARG(TRACE_EVENT0(__VA_ARGS__)) +#define OPTIONAL_TRACE_EVENT1(...) CR_EXPAND_ARG(TRACE_EVENT1(__VA_ARGS__)) +#define OPTIONAL_TRACE_EVENT2(...) CR_EXPAND_ARG(TRACE_EVENT2(__VA_ARGS__)) #else // BUILDFLAG(OPTIONAL_TRACE_EVENTS_ENABLED) diff --git a/chromium/base/trace_event/trace_arguments.h b/chromium/base/trace_event/trace_arguments.h index 03c28d68710..e8e7d03daca 100644 --- a/chromium/base/trace_event/trace_arguments.h +++ b/chromium/base/trace_event/trace_arguments.h @@ -16,6 +16,7 @@ #include "base/base_export.h" #include "base/trace_event/common/trace_event_common.h" #include "base/tracing_buildflags.h" +#include "build/build_config.h" // COMPILER_MSVC #include "third_party/perfetto/include/perfetto/protozero/scattered_heap_buffer.h" #include "third_party/perfetto/include/perfetto/tracing/traced_value.h" #include "third_party/perfetto/protos/perfetto/trace/track_event/debug_annotation.pbzero.h" @@ -332,16 +333,16 @@ union BASE_EXPORT TraceValue { template <typename T> struct TypeFor<T, typename std::enable_if<HasHelperSupport< - typename InnerType<T>::type>::value>::type> { + T>::value>::type> { using ValueType = typename InnerType<T>::type; static const unsigned char value = Helper<ValueType>::kType; }; template <typename T> struct TypeFor<T, typename std::enable_if< - !HasHelperSupport<typename InnerType<T>::type>::value && + !HasHelperSupport<T>::value && perfetto::internal::has_traced_value_support< - typename InnerType<T>::type>::value>::type> { + T>::value>::type> { static const unsigned char value = TRACE_VALUE_TYPE_PROTO; }; @@ -627,7 +628,11 @@ class BASE_EXPORT TraceArguments { TraceArguments() : size_(0) {} // Constructor for a single argument. +#if defined(COMPILER_MSVC) + template <typename T> +#else template <typename T, class = decltype(TraceValue::TypeCheck<T>::value)> +#endif TraceArguments(const char* arg1_name, T&& arg1_value) : size_(1) { types_[0] = TraceValue::TypeFor<T>::value; names_[0] = arg1_name; @@ -636,9 +641,13 @@ class BASE_EXPORT TraceArguments { // Constructor for two arguments. template <typename T1, +#if defined(COMPILER_MSVC) + typename T2> +#else typename T2, class = decltype(TraceValue::TypeCheck<T1>::value && TraceValue::TypeCheck<T2>::value)> +#endif TraceArguments(const char* arg1_name, T1&& arg1_value, const char* arg2_name, diff --git a/chromium/base/traits_bag.h b/chromium/base/traits_bag.h index 89d172d9ac4..e973cfa7a88 100644 --- a/chromium/base/traits_bag.h +++ b/chromium/base/traits_bag.h @@ -154,10 +154,12 @@ constexpr TraitFilterType GetTraitFromArgListImpl(CallSecondTag, template <class TraitFilterType, class... ArgTypes> constexpr typename TraitFilterType::ValueType GetTraitFromArgList( ArgTypes... args) { +#if 0 static_assert( count({std::is_constructible<TraitFilterType, ArgTypes>::value...}, true) <= 1, "The traits bag contains multiple traits of the same type."); +#endif return GetTraitFromArgListImpl<TraitFilterType>(CallFirstTag(), args...); } @@ -243,9 +245,11 @@ static constexpr absl::optional<Enum> GetOptionalEnum(Args... args) { // Helper to make checking for the presence of a trait more readable. template <typename Trait, typename... Args> struct HasTrait : ParameterPack<Args...>::template HasType<Trait> { +#if 0 static_assert( count({std::is_constructible<Trait, Args>::value...}, true) <= 1, "The traits bag contains multiple traits of the same type."); +#endif }; // If you need a template vararg constructor to delegate to a private diff --git a/chromium/base/values.cc b/chromium/base/values.cc index 4803510b34a..aafdbbcebdb 100644 --- a/chromium/base/values.cc +++ b/chromium/base/values.cc @@ -824,36 +824,35 @@ size_t Value::List::size() const { } Value::List::iterator Value::List::begin() { - return iterator(base::to_address(storage_.begin()), - base::to_address(storage_.end())); + return iterator(storage_.data(), storage_.data() + storage_.size()); } Value::List::const_iterator Value::List::begin() const { - return const_iterator(base::to_address(storage_.begin()), - base::to_address(storage_.end())); + return const_iterator(storage_.data(), + storage_.data() + storage_.size()); } Value::List::const_iterator Value::List::cbegin() const { - return const_iterator(base::to_address(storage_.cbegin()), - base::to_address(storage_.cend())); + return const_iterator(storage_.data(), + storage_.data() + storage_.size()); } Value::List::iterator Value::List::end() { - return iterator(base::to_address(storage_.begin()), - base::to_address(storage_.end()), - base::to_address(storage_.end())); + return iterator(storage_.data(), + storage_.data() + storage_.size(), + storage_.data() + storage_.size()); } Value::List::const_iterator Value::List::end() const { - return const_iterator(base::to_address(storage_.begin()), - base::to_address(storage_.end()), - base::to_address(storage_.end())); + return const_iterator(storage_.data(), + storage_.data() + storage_.size(), + storage_.data() + storage_.size()); } Value::List::const_iterator Value::List::cend() const { - return const_iterator(base::to_address(storage_.cbegin()), - base::to_address(storage_.cend()), - base::to_address(storage_.cend())); + return const_iterator(storage_.data(), + storage_.data() + storage_.size(), + storage_.data() + storage_.size()); } const Value& Value::List::front() const { @@ -896,15 +895,16 @@ void Value::List::clear() { Value::List::iterator Value::List::erase(iterator pos) { auto next_it = storage_.erase(storage_.begin() + (pos - begin())); - return iterator(base::to_address(storage_.begin()), base::to_address(next_it), - base::to_address(storage_.end())); + return iterator(storage_.data(), + storage_.data() + (next_it - storage_.begin()), + storage_.data() + storage_.size()); } Value::List::const_iterator Value::List::erase(const_iterator pos) { auto next_it = storage_.erase(storage_.begin() + (pos - begin())); - return const_iterator(base::to_address(storage_.begin()), - base::to_address(next_it), - base::to_address(storage_.end())); + return const_iterator(storage_.data(), + storage_.data() + (next_it - storage_.begin()), + storage_.data() + storage_.size()); } Value::List::iterator Value::List::erase(iterator first, iterator last) { @@ -978,9 +978,9 @@ void Value::List::Append(List&& value) { Value::List::iterator Value::List::Insert(const_iterator pos, Value&& value) { auto inserted_it = storage_.insert(storage_.begin() + (pos - begin()), std::move(value)); - return iterator(base::to_address(storage_.begin()), - base::to_address(inserted_it), - base::to_address(storage_.end())); + return iterator(storage_.data(), + storage_.data() + (inserted_it - storage_.begin()), + storage_.data() + storage_.size()); } size_t Value::List::EraseValue(const Value& value) { diff --git a/chromium/base/win/nt_status.cc b/chromium/base/win/nt_status.cc index 1cfb385c8c4..76d6e2ba894 100644 --- a/chromium/base/win/nt_status.cc +++ b/chromium/base/win/nt_status.cc @@ -9,7 +9,7 @@ #include "base/check.h" -using GetLastNtStatusFn = NTSTATUS NTAPI (*)(); +using GetLastNtStatusFn = NTSTATUS /*NTAPI*/ (*)(); constexpr const wchar_t kNtDllName[] = L"ntdll.dll"; constexpr const char kLastStatusFnName[] = "RtlGetLastNtStatus"; diff --git a/chromium/base/win/scoped_handle_verifier.cc b/chromium/base/win/scoped_handle_verifier.cc index e7ab4b9eacd..2dae6b83870 100644 --- a/chromium/base/win/scoped_handle_verifier.cc +++ b/chromium/base/win/scoped_handle_verifier.cc @@ -47,7 +47,11 @@ NOINLINE void ReportErrorOnScopedHandleOperation( base::debug::Alias(&creation_stack_copy); base::debug::Alias(&operation); CHECK(false) << operation; +#if !defined(COMPILER_MSVC) __builtin_unreachable(); +#else + __assume(0); +#endif } NOINLINE void ReportErrorOnScopedHandleOperation( @@ -60,7 +64,11 @@ NOINLINE void ReportErrorOnScopedHandleOperation( base::debug::Alias(&creation_stack_copy); base::debug::Alias(&operation); CHECK(false) << operation; +#if !defined(COMPILER_MSVC) __builtin_unreachable(); +#else + __assume(0); +#endif } } // namespace diff --git a/chromium/base/win/windows_types.h b/chromium/base/win/windows_types.h index 18ef978c7e1..ac4adc12335 100644 --- a/chromium/base/win/windows_types.h +++ b/chromium/base/win/windows_types.h @@ -95,7 +95,16 @@ typedef struct tagPOINTER_INFO POINTER_INFO; typedef struct _RTL_SRWLOCK RTL_SRWLOCK; typedef RTL_SRWLOCK SRWLOCK, *PSRWLOCK; -typedef struct _GUID GUID; +#ifndef GUID_DEFINED +#define GUID_DEFINED +typedef struct _GUID { + unsigned long Data1; + unsigned short Data2; + unsigned short Data3; + unsigned char Data4[8]; +} GUID; +#endif + typedef GUID CLSID; typedef GUID IID; diff --git a/chromium/base/win/wrapped_window_proc.h b/chromium/base/win/wrapped_window_proc.h index 203a8854c18..79dff1e190b 100644 --- a/chromium/base/win/wrapped_window_proc.h +++ b/chromium/base/win/wrapped_window_proc.h @@ -22,7 +22,7 @@ namespace win { // expected behavior for this function is to not return, instead of returning // EXCEPTION_EXECUTE_HANDLER or similar, given that in general we are not // prepared to handle exceptions. -using WinProcExceptionFilter = int __cdecl (*)(EXCEPTION_POINTERS* info); +using WinProcExceptionFilter = int (CDECL *)(EXCEPTION_POINTERS* info); // Sets the filter to deal with exceptions inside a WindowProc. Returns the old // exception filter, if any. diff --git a/chromium/build/config/compiler/BUILD.gn b/chromium/build/config/compiler/BUILD.gn index 07db890b633..3f6ce9f4117 100644 --- a/chromium/build/config/compiler/BUILD.gn +++ b/chromium/build/config/compiler/BUILD.gn @@ -785,7 +785,7 @@ config("compiler") { # present. On Android this increases binary size due to more thinks for long # jumps. Turn it off by default and enable selectively for targets where it's # beneficial. - if (use_lld && !enable_call_graph_profile_sort) { + if (use_lld && !enable_call_graph_profile_sort && !use_qt) { if (is_win) { ldflags += [ "/call-graph-profile-sort:no" ] } else { @@ -1622,6 +1622,12 @@ config("default_warnings") { "/wd4068", # unknown pragma "/wd5051", # attribute requires newer c++ ] + + cflags_cc += [ + # Allow "noexcept" annotations even though we compile with exceptions + # disabled. + "/wd4577", + ] if (!is_clang) { # TODO(thakis): Remove this once # https://swiftshader-review.googlesource.com/c/SwiftShader/+/57968 has diff --git a/chromium/build/config/win/BUILD.gn b/chromium/build/config/win/BUILD.gn index a4959fda5c7..7006122afd3 100644 --- a/chromium/build/config/win/BUILD.gn +++ b/chromium/build/config/win/BUILD.gn @@ -100,7 +100,9 @@ config("compiler") { cflags += [ "/D__WRL_ENABLE_FUNCTION_STATICS__" ] # Tell clang which version of MSVC to emulate. - cflags += [ "-fmsc-version=1916" ] + if (!ninja_use_custom_environment_files) { + cflags += [ "-fmsc-version=1916" ] + } if (is_component_build) { cflags += [ @@ -171,7 +173,7 @@ config("compiler") { ldflags += [ "/TIMESTAMP:" + build_timestamp ] # Don't look for libpaths in %LIB%, similar to /X in cflags above. - ldflags += [ "/lldignoreenv" ] +# ldflags += [ "/lldignoreenv" ] } if (use_large_pdbs) { diff --git a/chromium/build/toolchain/win/midl.py b/chromium/build/toolchain/win/midl.py index 1c5ac196668..b87431b8071 100644 --- a/chromium/build/toolchain/win/midl.py +++ b/chromium/build/toolchain/win/midl.py @@ -421,6 +421,12 @@ def main(arch, gendir, outdir, dynamic_guids, tlb, h, dlldata, iid, proxy, # IDL file. generate_idl_from_template(idl_template, dynamic_guids_bytes, idl) + # Unless you have an exact copy of the Google machine were the + # files were generated, we have to stop here as well. + # FIXME: Just use the generated files instead of the prebuilt ones, + # and do no pointless diff comparison. + return 0 + # On Windows, run midl.exe on the input and check that its outputs are # identical to the checked-in outputs (after replacing guids if # |dynamic_guids| is specified). diff --git a/chromium/build/win/message_compiler.py b/chromium/build/win/message_compiler.py index 51de52f0fca..9152c88c7c7 100644 --- a/chromium/build/win/message_compiler.py +++ b/chromium/build/win/message_compiler.py @@ -48,6 +48,12 @@ def main(): if sys.platform != 'win32': return + # Unless you have an exact copy of the Google machine were the + # files were generated, we have to stop here as well. + # FIXME: Just use the generated files instead of the prebuilt ones, + # and do no pointless diff comparison. + return + # On Windows, run mc.exe on the input and check that its outputs are # identical to the checked-in outputs. diff --git a/chromium/chrome/BUILD.gn b/chromium/chrome/BUILD.gn index 2b73a0a585b..f0f6d3e324a 100644 --- a/chromium/chrome/BUILD.gn +++ b/chromium/chrome/BUILD.gn @@ -164,7 +164,7 @@ if (!is_android && !is_mac) { data_deps += [ "//chrome:chrome(//build/toolchain/cros:lacros_clang)" ] } - if (is_win) { + if (is_win && !use_qt) { sources += [ "app/chrome_exe.rc", "app/chrome_exe_main_win.cc", diff --git a/chromium/chrome/browser/BUILD.gn b/chromium/chrome/browser/BUILD.gn index cb7d32fbed6..389fc76b474 100644 --- a/chromium/chrome/browser/BUILD.gn +++ b/chromium/chrome/browser/BUILD.gn @@ -5730,7 +5730,7 @@ static_library("browser") { ] } - if (is_win) { + if (is_win && toolkit_views) { libs += [ "secur32.lib", diff --git a/chromium/chrome/browser/win/conflicts/BUILD.gn b/chromium/chrome/browser/win/conflicts/BUILD.gn index d7c4c630130..dd668306268 100644 --- a/chromium/chrome/browser/win/conflicts/BUILD.gn +++ b/chromium/chrome/browser/win/conflicts/BUILD.gn @@ -3,6 +3,7 @@ # found in the LICENSE file. import("//build/config/chrome_build.gni") +import("//chrome/common/features.gni") import("//third_party/protobuf/proto_library.gni") assert(is_win) @@ -30,6 +31,12 @@ source_set("module_info") { deps = [ "//base:i18n" ] libs = [ "crypt32.lib" ] + + if (safe_browsing_mode == 1) { + deps += [ + "//chrome/common/safe_browsing:pe_image_reader", + ] + } } loadable_module("conflicts_dll") { diff --git a/chromium/chrome/common/webui_url_constants.cc b/chromium/chrome/common/webui_url_constants.cc index d009ce1f6d5..40e593d0a60 100644 --- a/chromium/chrome/common/webui_url_constants.cc +++ b/chromium/chrome/common/webui_url_constants.cc @@ -784,10 +784,11 @@ const char* const kChromeHostURLs[] = { kCfmNetworkSettingsHost, #endif // BUILDFLAG(PLATFORM_CFM) }; -const size_t kNumberOfChromeHostURLs = std::size(kChromeHostURLs); +const size_t kNumberOfChromeHostURLs = sizeof(kChromeHostURLs) / sizeof(const char*); // Add chrome://internals/* subpages here to be included in chrome://chrome-urls // (about:about). +#if !defined(COMPILER_MSVC) const char* const kChromeInternalsPathURLs[] = { #if BUILDFLAG(IS_ANDROID) kChromeUIInternalsQueryTilesPath, @@ -798,6 +799,10 @@ const char* const kChromeInternalsPathURLs[] = { }; const size_t kNumberOfChromeInternalsPathURLs = sizeof(kChromeInternalsPathURLs) / sizeof(const char*); +#else +const char* const kChromeInternalsPathURLs[1] = { nullptr }; +const size_t kNumberOfChromeInternalsPathURLs = 0; +#endif // !defined(COMPILER_MSVC) const char* const kChromeDebugURLs[] = { blink::kChromeUIBadCastCrashURL, diff --git a/chromium/components/autofill/core/common/autocomplete_parsing_util.cc b/chromium/components/autofill/core/common/autocomplete_parsing_util.cc index dda22921127..f68be082514 100644 --- a/chromium/components/autofill/core/common/autocomplete_parsing_util.cc +++ b/chromium/components/autofill/core/common/autocomplete_parsing_util.cc @@ -70,7 +70,7 @@ HtmlFieldType RationalizeAutocompleteType(HtmlFieldType type, HTML_TYPE_CREDIT_CARD_EXP_4_DIGIT_YEAR}, }); - auto* it = rules.find(std::make_pair(type, field.max_length)); + auto it = rules.find(std::make_pair(type, field.max_length)); return it == rules.end() ? type : it->second; } @@ -123,7 +123,7 @@ absl::optional<HtmlFieldType> ParseStandardizedAutocompleteAttribute( {"transaction-currency", HTML_TYPE_TRANSACTION_CURRENCY}, }); - auto* it = standardized_attributes.find(value); + auto it = standardized_attributes.find(value); return it != standardized_attributes.end() ? absl::optional<HtmlFieldType>(it->second) : absl::nullopt; @@ -141,7 +141,7 @@ absl::optional<HtmlFieldType> ParseProposedAutocompleteAttribute( {"username", HTML_TYPE_EMAIL}, }); - auto* it = proposed_attributes.find(value); + auto it = proposed_attributes.find(value); return it != proposed_attributes.end() ? absl::optional<HtmlFieldType>(it->second) : absl::nullopt; @@ -167,7 +167,7 @@ absl::optional<HtmlFieldType> ParseNonStandarizedAutocompleteAttribute( {"upi-vpa", HTML_TYPE_UPI_VPA}, }); - auto* it = non_standardized_attributes.find(value); + auto it = non_standardized_attributes.find(value); return it != non_standardized_attributes.end() ? absl::optional<HtmlFieldType>(it->second) : absl::nullopt; diff --git a/chromium/components/autofill/core/common/autofill_data_validation.cc b/chromium/components/autofill/core/common/autofill_data_validation.cc index 18dffb5f7eb..a16dd0aea34 100644 --- a/chromium/components/autofill/core/common/autofill_data_validation.cc +++ b/chromium/components/autofill/core/common/autofill_data_validation.cc @@ -57,17 +57,38 @@ bool IsValidPasswordFormFillData(const PasswordFormFillData& form) { } bool IsValidOptionVector(const std::vector<SelectOption>& options) { - return options.size() <= kMaxListSize && - base::ranges::all_of(options, &IsValidString16, - &SelectOption::content); + if (options.size() > kMaxListSize) + return false; + for (const auto& option : options) { + if (!IsValidString16(option.content)) + return false; + } + return true; +// return options.size() <= kMaxListSize && +// base::ranges::all_of(options, &IsValidString16, +// &SelectOption::content); } bool IsValidString16Vector(const std::vector<std::u16string>& v) { - return v.size() <= kMaxListSize && base::ranges::all_of(v, &IsValidString16); + if (v.size() > kMaxListSize) + return false; + for (const auto& i : v) { + if (!IsValidString16(i)) + return false; + } + return true; +// return v.size() <= kMaxListSize && base::ranges::all_of(v, &IsValidString16); } bool IsValidFormDataVector(const std::vector<FormData>& v) { - return v.size() <= kMaxListSize && base::ranges::all_of(v, &IsValidFormData); + if (v.size() > kMaxListSize) + return false; + for (const auto& i : v) { + if (!IsValidFormData(i)) + return false; + } + return true; +// return v.size() <= kMaxListSize && base::ranges::all_of(v, &IsValidFormData); } } // namespace autofill diff --git a/chromium/components/metrics/BUILD.gn b/chromium/components/metrics/BUILD.gn index 98864ced89c..d29cdec793f 100644 --- a/chromium/components/metrics/BUILD.gn +++ b/chromium/components/metrics/BUILD.gn @@ -3,6 +3,7 @@ # found in the LICENSE file. import("//build/config/chromeos/ui_mode.gni") +import("//build/config/features.gni") import("//build/config/jumbo.gni") import("//testing/test.gni") @@ -209,6 +210,10 @@ jumbo_static_library("metrics") { sources += [ "drive_metrics_provider_fuchsia.cc" ] } + if (use_qt) { + deps -= [ "//components/variations/field_trial_config" ] + } + if (is_win || is_linux) { sources += [ "motherboard.cc", diff --git a/chromium/components/metrics/metrics_state_manager.cc b/chromium/components/metrics/metrics_state_manager.cc index 157af9f9c9d..add7fde8698 100644 --- a/chromium/components/metrics/metrics_state_manager.cc +++ b/chromium/components/metrics/metrics_state_manager.cc @@ -41,7 +41,9 @@ #include "components/prefs/pref_registry_simple.h" #include "components/prefs/pref_service.h" #include "components/variations/entropy_provider.h" +#ifndef TOOLKIT_QT #include "components/variations/field_trial_config/field_trial_util.h" +#endif #include "components/variations/pref_names.h" #include "components/variations/variations_switches.h" #include "third_party/metrics_proto/chrome_user_metrics_extension.pb.h" @@ -342,6 +344,7 @@ int MetricsStateManager::GetLowEntropySource() { void MetricsStateManager::InstantiateFieldTrialList( const char* enable_gpu_benchmarking_switch, EntropyProviderType entropy_provider_type) { +#ifndef TOOLKIT_QT // Instantiate the FieldTrialList to support field trials. If an instance // already exists, this is likely a test scenario with a ScopedFeatureList, so // use the existing instance so that any overrides are still applied. @@ -401,7 +404,7 @@ void MetricsStateManager::InstantiateFieldTrialList( ::switches::kForceFieldTrials)); } } - +#endif // Initializing the CleanExitBeacon is done after FieldTrialList instantiation // to allow experimentation on the CleanExitBeacon. clean_exit_beacon_.Initialize(); diff --git a/chromium/components/performance_manager/decorators/site_data_recorder.cc b/chromium/components/performance_manager/decorators/site_data_recorder.cc index 6dc4e9a4cb6..488997444f6 100644 --- a/chromium/components/performance_manager/decorators/site_data_recorder.cc +++ b/chromium/components/performance_manager/decorators/site_data_recorder.cc @@ -57,6 +57,7 @@ class SiteDataNodeData : public NodeAttachedDataImpl<SiteDataNodeData>, public: struct Traits : public NodeAttachedDataOwnedByNodeType<PageNodeImpl> {}; + SiteDataNodeData() = default; explicit SiteDataNodeData(const PageNodeImpl* page_node) : page_node_(page_node) {} diff --git a/chromium/components/printing/common/BUILD.gn b/chromium/components/printing/common/BUILD.gn index 0ca050a7b9a..71ea08807d2 100644 --- a/chromium/components/printing/common/BUILD.gn +++ b/chromium/components/printing/common/BUILD.gn @@ -8,7 +8,7 @@ import("//printing/buildflags/buildflags.gni") assert(enable_basic_printing) -static_library("common") { +source_set("common") { sources = [ "cloud_print_cdd_conversion.cc", "cloud_print_cdd_conversion.h", diff --git a/chromium/components/shared_highlighting/core/common/disabled_sites.cc b/chromium/components/shared_highlighting/core/common/disabled_sites.cc index c744798c5e4..1d2336b33c2 100644 --- a/chromium/components/shared_highlighting/core/common/disabled_sites.cc +++ b/chromium/components/shared_highlighting/core/common/disabled_sites.cc @@ -55,11 +55,11 @@ bool ShouldOfferLinkToText(const GURL& url) { return true; } - auto* block_list_it = kBlocklist.find(domain); + auto block_list_it = kBlocklist.find(domain); if (block_list_it != kBlocklist.end()) { if (re2::RE2::FullMatch(url.path(), block_list_it->second.data())) { if (base::FeatureList::IsEnabled(kSharedHighlightingRefinedBlocklist)) { - auto* allow_list_it = kAllowlist.find(domain); + auto allow_list_it = kAllowlist.find(domain); if (allow_list_it != kAllowlist.end()) { return re2::RE2::PartialMatch(url.path(), allow_list_it->second.data()); diff --git a/chromium/components/shared_highlighting/core/common/shared_highlighting_features.cc b/chromium/components/shared_highlighting/core/common/shared_highlighting_features.cc index 9006f4c4048..3212936aada 100644 --- a/chromium/components/shared_highlighting/core/common/shared_highlighting_features.cc +++ b/chromium/components/shared_highlighting/core/common/shared_highlighting_features.cc @@ -11,7 +11,7 @@ namespace shared_highlighting { const base::Feature kPreemptiveLinkToTextGeneration{ "PreemptiveLinkToTextGeneration", base::FEATURE_ENABLED_BY_DEFAULT}; -constexpr base::FeatureParam<int> kPreemptiveLinkGenTimeoutLengthMs{ +const base::FeatureParam<int> kPreemptiveLinkGenTimeoutLengthMs{ &kPreemptiveLinkToTextGeneration, "TimeoutLengthMs", 500}; const base::Feature kSharedHighlightingAmp { diff --git a/chromium/components/spellcheck/browser/windows_spell_checker.cc b/chromium/components/spellcheck/browser/windows_spell_checker.cc index 6384e4104a1..dde89b7e469 100644 --- a/chromium/components/spellcheck/browser/windows_spell_checker.cc +++ b/chromium/components/spellcheck/browser/windows_spell_checker.cc @@ -68,11 +68,13 @@ class BackgroundHelper { int document_tag, const std::u16string& text); +#if BUILDFLAG(USE_BROWSER_SPELLCHECKER) // Gets spelling suggestions for |word| from all active spell checkers (all // languages), keeping the suggestions separate per language, and returns // the results in a vector of vector of strings. spellcheck::PerLanguageSuggestions GetPerLanguageSuggestions( const std::u16string& word); +#endif // Fills the given vector |optional_suggestions| with a number (up to // kMaxSuggestions) of suggestions for the string |wrong_word| using the @@ -281,6 +283,7 @@ std::vector<SpellCheckResult> BackgroundHelper::RequestTextCheckForAllLanguages( return final_results; } +#if BUILDFLAG(USE_BROWSER_SPELLCHECKER) spellcheck::PerLanguageSuggestions BackgroundHelper::GetPerLanguageSuggestions( const std::u16string& word) { DCHECK(background_task_runner_->RunsTasksInCurrentSequence()); @@ -296,6 +299,7 @@ spellcheck::PerLanguageSuggestions BackgroundHelper::GetPerLanguageSuggestions( return suggestions; } +#endif void BackgroundHelper::FillSuggestionList( const std::string& lang_tag, @@ -538,6 +542,7 @@ void WindowsSpellChecker::RequestTextCheck( std::move(callback)); } +#if BUILDFLAG(USE_BROWSER_SPELLCHECKER) void WindowsSpellChecker::GetPerLanguageSuggestions( const std::u16string& word, spellcheck_platform::GetSuggestionsCallback callback) { @@ -548,6 +553,7 @@ void WindowsSpellChecker::GetPerLanguageSuggestions( base::Unretained(background_helper_.get()), word), std::move(callback)); } +#endif void WindowsSpellChecker::AddWordForAllLanguages(const std::u16string& word) { background_task_runner_->PostTask( diff --git a/chromium/components/spellcheck/browser/windows_spell_checker.h b/chromium/components/spellcheck/browser/windows_spell_checker.h index e3d050a6a9d..f7a25373031 100644 --- a/chromium/components/spellcheck/browser/windows_spell_checker.h +++ b/chromium/components/spellcheck/browser/windows_spell_checker.h @@ -50,9 +50,11 @@ class WindowsSpellChecker : public PlatformSpellChecker { const std::u16string& text, spellcheck_platform::TextCheckCompleteCallback callback) override; +#if BUILDFLAG(USE_BROWSER_SPELLCHECKER) void GetPerLanguageSuggestions( const std::u16string& word, spellcheck_platform::GetSuggestionsCallback callback); +#endif void AddWordForAllLanguages(const std::u16string& word); diff --git a/chromium/components/spellcheck/common/spellcheck.mojom b/chromium/components/spellcheck/common/spellcheck.mojom index 51163802829..92f3313b0bf 100644 --- a/chromium/components/spellcheck/common/spellcheck.mojom +++ b/chromium/components/spellcheck/common/spellcheck.mojom @@ -76,11 +76,11 @@ interface SpellCheckHost { (array<mojo_base.mojom.String16> suggestions); // Completes initialization of the spellcheck service by loading dictionaries. - [EnableIf=is_win] - InitializeDictionaries() => - (array<SpellCheckBDictLanguage> dictionaries, - array<string> custom_words, - bool enable); +// [EnableIf=is_win] +// InitializeDictionaries() => +// (array<SpellCheckBDictLanguage> dictionaries, +// array<string> custom_words, +// bool enable); }; enum Decoration { diff --git a/chromium/components/variations/net/BUILD.gn b/chromium/components/variations/net/BUILD.gn index bb9e3fe867c..37d57f870c9 100644 --- a/chromium/components/variations/net/BUILD.gn +++ b/chromium/components/variations/net/BUILD.gn @@ -2,6 +2,8 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. +import("//build/config/features.gni") + static_library("net") { sources = [ "variations_command_line.cc", @@ -41,6 +43,11 @@ static_library("net") { "//third_party/blink/public/common", ] } + if (use_qt) { + deps -= [ + "//components/variations/field_trial_config", + ] + } } component("omnibox_http_headers") { diff --git a/chromium/components/variations/service/BUILD.gn b/chromium/components/variations/service/BUILD.gn index 84211977a96..d1224c775a8 100644 --- a/chromium/components/variations/service/BUILD.gn +++ b/chromium/components/variations/service/BUILD.gn @@ -4,6 +4,7 @@ import("//build/buildflag_header.gni") import("//build/config/chrome_build.gni") +import("//build/config/features.gni") declare_args() { # Set to true make a build that disables activation of field trial tests @@ -56,6 +57,15 @@ static_library("service") { "//services/network/public/cpp", "//ui/base", ] + if (use_qt) { + sources -= [ + "variations_field_trial_creator.cc", + "variations_field_trial_creator.h", + ] + deps -= [ + "//components/variations/field_trial_config", + ] + } } source_set("unit_tests") { diff --git a/chromium/components/vector_icons/cc_macros.h b/chromium/components/vector_icons/cc_macros.h index 7100e5dedd4..ac89310eff5 100644 --- a/chromium/components/vector_icons/cc_macros.h +++ b/chromium/components/vector_icons/cc_macros.h @@ -29,7 +29,7 @@ #define VECTOR_ICON_TEMPLATE_CC(rep_list_name, icon_name, ...) \ constexpr char icon_name##Id[] = VECTOR_ICON_ID_PREFIX #icon_name; \ static constexpr gfx::VectorIconRep rep_list_name[] = {__VA_ARGS__}; \ - VECTOR_ICON_EXPORT constexpr gfx::VectorIcon icon_name = { \ + VECTOR_ICON_EXPORT const gfx::VectorIcon icon_name = { \ rep_list_name, std::size(rep_list_name), icon_name##Id}; #else // !COMPONENTS_VECTOR_ICONS_CC_MACROS_H_ diff --git a/chromium/components/viz/common/frame_sinks/copy_output_request.cc b/chromium/components/viz/common/frame_sinks/copy_output_request.cc index 63f2ff3fd1f..edca4441c06 100644 --- a/chromium/components/viz/common/frame_sinks/copy_output_request.cc +++ b/chromium/components/viz/common/frame_sinks/copy_output_request.cc @@ -115,7 +115,7 @@ void CopyOutputRequest::set_blit_request(BlitRequest blit_request) { #if DCHECK_IS_ON() { - const gpu::MailboxHolder* first_zeroed_mailbox_it = std::find_if( + const auto first_zeroed_mailbox_it = std::find_if( blit_request.mailboxes().begin(), blit_request.mailboxes().end(), [](const gpu::MailboxHolder& mailbox_holder) { return mailbox_holder.mailbox.IsZero(); diff --git a/chromium/content/browser/BUILD.gn b/chromium/content/browser/BUILD.gn index 68283f80690..d9452122bc7 100644 --- a/chromium/content/browser/BUILD.gn +++ b/chromium/content/browser/BUILD.gn @@ -3366,7 +3366,9 @@ jumbo_source_set("browser") { if (is_win) { sources -= [ "renderer_host/legacy_render_widget_host_win.cc", - "renderer_host/legacy_render_widget_host_win.h" + "renderer_host/legacy_render_widget_host_win.h", + "renderer_host/virtual_keyboard_controller_win.cc", + "renderer_host/virtual_keyboard_controller_win.h" ] } if (is_mac) { diff --git a/chromium/content/browser/accessibility/browser_accessibility_state_impl.cc b/chromium/content/browser/accessibility/browser_accessibility_state_impl.cc index 05257458334..b151b273e64 100644 --- a/chromium/content/browser/accessibility/browser_accessibility_state_impl.cc +++ b/chromium/content/browser/accessibility/browser_accessibility_state_impl.cc @@ -184,7 +184,7 @@ void BrowserAccessibilityStateImpl::UpdateHistogramsOnUIThread() { UMA_HISTOGRAM_BOOLEAN("Accessibility.ManuallyEnabled", force_renderer_accessibility_); -#if BUILDFLAG(IS_WIN) +#if BUILDFLAG(IS_WIN) && !defined(TOOLKIT_QT) UMA_HISTOGRAM_ENUMERATION( "Accessibility.WinHighContrastTheme", ui::NativeTheme::GetInstanceForNativeUi() diff --git a/chromium/content/browser/browser_interface_broker_impl.h b/chromium/content/browser/browser_interface_broker_impl.h index 9d4c518b9f2..1d47bb5c469 100644 --- a/chromium/content/browser/browser_interface_broker_impl.h +++ b/chromium/content/browser/browser_interface_broker_impl.h @@ -8,6 +8,7 @@ #include "base/memory/raw_ptr.h" #include "content/browser/browser_interface_binders.h" #include "content/browser/mojo_binder_policy_applier.h" +#include "content/browser/service_worker/service_worker_info.h" #include "mojo/public/cpp/bindings/binder_map.h" #include "mojo/public/cpp/bindings/generic_pending_receiver.h" #include "third_party/blink/public/common/features.h" diff --git a/chromium/content/browser/browser_url_handler_impl.cc b/chromium/content/browser/browser_url_handler_impl.cc index a365bef7ac0..908e7dbf148 100644 --- a/chromium/content/browser/browser_url_handler_impl.cc +++ b/chromium/content/browser/browser_url_handler_impl.cc @@ -183,10 +183,14 @@ bool BrowserURLHandlerImpl::ReverseURLRewrite( } void BrowserURLHandlerImpl::RemoveHandlerForTesting(URLHandler handler) { - const auto it = - base::ranges::find(url_handlers_, handler, &HandlerPair::first); - DCHECK(url_handlers_.end() != it); - url_handlers_.erase(it); + auto it = url_handlers_.begin(); + for (; it != url_handlers_.end(); ++it) { + if (it->first == handler) { + url_handlers_.erase(it); + return; + } + } + NOTREACHED(); } } // namespace content diff --git a/chromium/content/browser/renderer_host/clipboard_host_impl.cc b/chromium/content/browser/renderer_host/clipboard_host_impl.cc index 95a0eaa301d..7de3cdb45bc 100644 --- a/chromium/content/browser/renderer_host/clipboard_host_impl.cc +++ b/chromium/content/browser/renderer_host/clipboard_host_impl.cc @@ -173,7 +173,7 @@ void ClipboardHostImpl::IsFormatAvailable(blink::mojom::ClipboardFormat format, result = clipboard->IsFormatAvailable(ui::ClipboardFormatType::PlainTextType(), clipboard_buffer, data_endpoint.get()); -#if BUILDFLAG(IS_WIN) +#if BUILDFLAG(IS_WIN) && !defined(TOOLKIT_QT) result |= clipboard->IsFormatAvailable( ui::ClipboardFormatType::PlainTextAType(), clipboard_buffer, data_endpoint.get()); @@ -215,7 +215,7 @@ void ClipboardHostImpl::ReadText(ui::ClipboardBuffer clipboard_buffer, clipboard_buffer, data_dst.get())) { clipboard->ReadText(clipboard_buffer, data_dst.get(), &result); } else { -#if BUILDFLAG(IS_WIN) +#if BUILDFLAG(IS_WIN) && !defined(TOOLKIT_QT) if (clipboard->IsFormatAvailable(ui::ClipboardFormatType::PlainTextAType(), clipboard_buffer, data_dst.get())) { std::string ascii; diff --git a/chromium/content/browser/shared_storage/shared_storage_document_service_impl.h b/chromium/content/browser/shared_storage/shared_storage_document_service_impl.h index b907f4a9fca..e5cfa65a204 100644 --- a/chromium/content/browser/shared_storage/shared_storage_document_service_impl.h +++ b/chromium/content/browser/shared_storage/shared_storage_document_service_impl.h @@ -70,7 +70,7 @@ class CONTENT_EXPORT SharedStorageDocumentServiceImpl final base::WeakPtr<SharedStorageDocumentServiceImpl> GetWeakPtr(); private: - friend class DocumentUserData; + friend class DocumentUserData<SharedStorageDocumentServiceImpl>; static bool& GetBypassIsSharedStorageAllowed(); diff --git a/chromium/content/browser/site_instance_group.h b/chromium/content/browser/site_instance_group.h index 9e3cb74a695..ccbbd88deaf 100644 --- a/chromium/content/browser/site_instance_group.h +++ b/chromium/content/browser/site_instance_group.h @@ -129,7 +129,7 @@ class CONTENT_EXPORT SiteInstanceGroup void WriteIntoTrace(perfetto::TracedProto<TraceProto> proto) const; private: - friend class RefCounted<SiteInstanceGroup>; + friend class base::RefCounted<SiteInstanceGroup>; ~SiteInstanceGroup() override; // RenderProcessHostObserver implementation. diff --git a/chromium/content/public/common/content_features.cc b/chromium/content/public/common/content_features.cc index 1d8a6de0959..f4a6fbcf99f 100644 --- a/chromium/content/public/common/content_features.cc +++ b/chromium/content/public/common/content_features.cc @@ -358,8 +358,8 @@ const base::Feature kFedCmMultipleIdentityProviders{ "FedCmMultipleIdentityProviders", base::FEATURE_DISABLED_BY_DEFAULT}; // Enables usage of First Party Sets to determine cookie availability. -constexpr base::Feature kFirstPartySets{"FirstPartySets", - base::FEATURE_DISABLED_BY_DEFAULT}; +const base::Feature kFirstPartySets{"FirstPartySets", + base::FEATURE_DISABLED_BY_DEFAULT}; // Controls whether the client is considered a dogfooder for the FirstPartySets // feature. diff --git a/chromium/content/renderer/accessibility/ax_image_annotator.cc b/chromium/content/renderer/accessibility/ax_image_annotator.cc index 737361efe78..873843dc27c 100644 --- a/chromium/content/renderer/accessibility/ax_image_annotator.cc +++ b/chromium/content/renderer/accessibility/ax_image_annotator.cc @@ -121,7 +121,7 @@ int GetMessageIdForIconEnum(const std::string& icon_type) { {"ICON_SUN", IDS_AX_IMAGE_ANNOTATION_ICON_SUN}, }); - auto* iter = kIconTypeToMessageIdMap.find(icon_type); + auto iter = kIconTypeToMessageIdMap.find(icon_type); if (iter == kIconTypeToMessageIdMap.end()) return 0; diff --git a/chromium/courgette/BUILD.gn b/chromium/courgette/BUILD.gn index 62f6b87b697..6056a3da124 100644 --- a/chromium/courgette/BUILD.gn +++ b/chromium/courgette/BUILD.gn @@ -3,6 +3,7 @@ # found in the LICENSE file. import("//build/config/compiler/compiler.gni") +import("//build/config/features.gni") import("//testing/test.gni") static_library("courgette_lib") { @@ -150,7 +151,7 @@ if (!is_ios) { ] } - if (is_win) { + if (is_win && !use_qt) { if (current_cpu == "x64") { # TODO(sebmarchand): The official build scripts expect courgette.exe to be # in the official build archives, remove this once they have been updated. diff --git a/chromium/device/fido/cbor_extract.cc b/chromium/device/fido/cbor_extract.cc index 29d4401b003..312c5e7efa8 100644 --- a/chromium/device/fido/cbor_extract.cc +++ b/chromium/device/fido/cbor_extract.cc @@ -25,9 +25,11 @@ const bool kFalse = false; constexpr uint8_t CBORTypeToBitfield(const cbor::Value::Type type) { const unsigned type_u = static_cast<unsigned>(type); +#ifdef __GNUC__ if (type_u >= 8) { __builtin_unreachable(); } +#endif return 1u << type_u; } diff --git a/chromium/device/fido/cbor_extract.h b/chromium/device/fido/cbor_extract.h index 89e4d49335a..fdf06e2f126 100644 --- a/chromium/device/fido/cbor_extract.h +++ b/chromium/device/fido/cbor_extract.h @@ -145,12 +145,14 @@ struct StepOrByte { template <typename S> constexpr StepOrByte<S> IntKey(int key) { +#ifdef __GNUC__ if (key > std::numeric_limits<int8_t>::max() || key < std::numeric_limits<int8_t>::min() || key == StepOrByte<S>::STRING_KEY) { // It's a compile-time error if __builtin_unreachable is reachable. __builtin_unreachable(); } +#endif return StepOrByte<S>(static_cast<char>(key)); } @@ -180,20 +182,26 @@ constexpr StepOrByte<S> Element(const Is required, uintptr_t offset) { // This generic version of |Element| causes a compile-time error if ELEMENT // is used to reference a member with an invalid type. +#ifdef __GNUC__ __builtin_unreachable(); +#endif return StepOrByte<S>('\0'); } // MemberNum translates an offset into a structure into an index if the // structure is considered as an array of pointers. constexpr uint8_t MemberNum(uintptr_t offset) { +#ifdef __GNUC__ if (offset % sizeof(void*)) { __builtin_unreachable(); } +#endif const uintptr_t index = offset / sizeof(void*); +#ifdef __GNUC__ if (index >= 16) { __builtin_unreachable(); } +#endif return static_cast<uint8_t>(index); } diff --git a/chromium/device/gamepad/public/cpp/gamepad.cc b/chromium/device/gamepad/public/cpp/gamepad.cc index ffcfbfb5b5e..27151790fc3 100644 --- a/chromium/device/gamepad/public/cpp/gamepad.cc +++ b/chromium/device/gamepad/public/cpp/gamepad.cc @@ -8,11 +8,11 @@ namespace device { -const float GamepadButton::kDefaultButtonPressedThreshold; -const double GamepadHapticActuator::kMaxEffectDurationMillis; -const size_t Gamepad::kIdLengthCap; -const size_t Gamepad::kAxesLengthCap; -const size_t Gamepad::kButtonsLengthCap; +constexpr float GamepadButton::kDefaultButtonPressedThreshold; +constexpr double GamepadHapticActuator::kMaxEffectDurationMillis; +constexpr size_t Gamepad::kIdLengthCap; +constexpr size_t Gamepad::kAxesLengthCap; +constexpr size_t Gamepad::kButtonsLengthCap; Gamepad::Gamepad() : connected(false), diff --git a/chromium/extensions/browser/api/web_request/web_request_api_helpers.cc b/chromium/extensions/browser/api/web_request/web_request_api_helpers.cc index dc9e4675490..9e6207042a1 100644 --- a/chromium/extensions/browser/api/web_request/web_request_api_helpers.cc +++ b/chromium/extensions/browser/api/web_request/web_request_api_helpers.cc @@ -186,7 +186,7 @@ constexpr bool IsValidHeaderName(base::StringPiece str) { } template <typename T> -constexpr bool ValidateHeaderEntries(const T& entries) { +bool ValidateHeaderEntries(const T& entries) { for (const auto& entry : entries) { if (!IsValidHeaderName(entry.first)) return false; @@ -203,15 +203,15 @@ static_assert(static_cast<size_t>(RequestHeaderType::kMaxValue) - 2 == kRequestHeaderEntries.size(), "Invalid number of request header entries"); -static_assert(ValidateHeaderEntries(kRequestHeaderEntries), - "Invalid request header entries"); +//static_assert(ValidateHeaderEntries(kRequestHeaderEntries), +// "Invalid request header entries"); // Uses |record_func| to record |header|. If |header| is not recorded, false is // returned. void RecordRequestHeader(const std::string& header, void (*record_func)(RequestHeaderType)) { DCHECK(IsStringLowerCaseASCII(header)); - const auto* it = kRequestHeaderEntries.find(header); + const auto it = kRequestHeaderEntries.find(header); record_func(it != kRequestHeaderEntries.end() ? it->second : RequestHeaderType::kOther); } @@ -319,7 +319,7 @@ constexpr auto kResponseHeaderEntries = void RecordResponseHeader(base::StringPiece header, void (*record_func)(ResponseHeaderType)) { DCHECK(IsStringLowerCaseASCII(header)); - const auto* it = kResponseHeaderEntries.find(header); + const auto it = kResponseHeaderEntries.find(header); record_func(it != kResponseHeaderEntries.end() ? it->second : ResponseHeaderType::kOther); } @@ -329,8 +329,8 @@ static_assert(static_cast<size_t>(ResponseHeaderType::kMaxValue) - 1 == kResponseHeaderEntries.size(), "Invalid number of response header entries"); -static_assert(ValidateHeaderEntries(kResponseHeaderEntries), - "Invalid response header entries"); +//static_assert(ValidateHeaderEntries(kResponseHeaderEntries), +// "Invalid response header entries"); // Represents an action to be taken on a given header. struct DNRHeaderAction { diff --git a/chromium/gpu/config/vulkan_info.h b/chromium/gpu/config/vulkan_info.h index 2f8471ebd55..4ed79e08ac1 100644 --- a/chromium/gpu/config/vulkan_info.h +++ b/chromium/gpu/config/vulkan_info.h @@ -5,7 +5,7 @@ #ifndef GPU_CONFIG_VULKAN_INFO_H_ #define GPU_CONFIG_VULKAN_INFO_H_ -#include <vulkan/vulkan_core.h> +#include "third_party/vulkan-deps/vulkan-headers/src/include/vulkan/vulkan_core.h" #include <vector> #include "base/strings/string_piece.h" diff --git a/chromium/gpu/ipc/service/BUILD.gn b/chromium/gpu/ipc/service/BUILD.gn index d5bbea6c948..62103293976 100644 --- a/chromium/gpu/ipc/service/BUILD.gn +++ b/chromium/gpu/ipc/service/BUILD.gn @@ -97,6 +97,11 @@ jumbo_component("service") { "gpu_memory_buffer_factory_dxgi.h", "image_transport_surface_win.cc", ] + if (use_qt) { + sources -= [ + "image_transport_surface_win.cc", + ] + } libs += [ "d3d11.lib", "dcomp.lib", diff --git a/chromium/gpu/ipc/service/gpu_init.cc b/chromium/gpu/ipc/service/gpu_init.cc index 1699efa90b3..317883408ac 100644 --- a/chromium/gpu/ipc/service/gpu_init.cc +++ b/chromium/gpu/ipc/service/gpu_init.cc @@ -53,11 +53,13 @@ #include "ui/ozone/public/surface_factory_ozone.h" #endif -#if BUILDFLAG(IS_WIN) && !defined(TOOLKIT_QT) +#if BUILDFLAG(IS_WIN) +#if !defined(TOOLKIT_QT) #include "gpu/config/gpu_driver_bug_workarounds.h" -#include "ui/gl/direct_composition_support.h" #include "ui/gl/gl_surface_egl.h" #endif +#include "ui/gl/direct_composition_support.h" +#endif #if BUILDFLAG(IS_ANDROID) #include "base/android/android_image_reader_compat.h" @@ -89,7 +91,7 @@ bool CollectGraphicsInfo(GPUInfo* gpu_info) { void InitializePlatformOverlaySettings(GPUInfo* gpu_info, const GpuFeatureInfo& gpu_feature_info) { -#if BUILDFLAG(IS_WIN) +#if BUILDFLAG(IS_WIN) && !defined(TOOLKIT_QT) // This has to be called after a context is created, active GPU is identified, // and GPU driver bug workarounds are computed again. Otherwise the workaround // |disable_direct_composition| may not be correctly applied. diff --git a/chromium/gpu/vulkan/vulkan_swap_chain.cc b/chromium/gpu/vulkan/vulkan_swap_chain.cc index 51dd4efadc2..85c468a58fc 100644 --- a/chromium/gpu/vulkan/vulkan_swap_chain.cc +++ b/chromium/gpu/vulkan/vulkan_swap_chain.cc @@ -385,13 +385,13 @@ bool VulkanSwapChain::PresentBuffer(const gfx::Rect& rect) { present_info.pImageIndices = &acquired_image_.value(); VkQueue queue = device_queue_->GetVulkanQueue(); - auto result = ({ + auto result = [&](){ static auto* kCrashKey = base::debug::AllocateCrashKeyString( "inside_queue_present", base::debug::CrashKeySize::Size32); base::debug::ScopedCrashKeyString scoped_crash_key(kCrashKey, "1"); - vkQueuePresentKHR(queue, &present_info); - }); + return vkQueuePresentKHR(queue, &present_info); + }(); if (UNLIKELY(result != VK_SUCCESS && result != VK_SUBOPTIMAL_KHR)) { LOG(DFATAL) << "vkQueuePresentKHR() failed: " << result; diff --git a/chromium/media/audio/audio_opus_encoder.cc b/chromium/media/audio/audio_opus_encoder.cc index eff6da899d7..5a3abcb5357 100644 --- a/chromium/media/audio/audio_opus_encoder.cc +++ b/chromium/media/audio/audio_opus_encoder.cc @@ -88,7 +88,7 @@ void AudioOpusEncoder::Initialize(const Options& options, DCHECK(output_callback); DCHECK(done_cb); - done_cb = BindToCurrentLoop(std::move(done_cb)); + done_cb = BindToCurrentLoop(std::move(done_cb), FROM_HERE); if (opus_encoder_) { std::move(done_cb).Run(EncoderStatus::Codes::kEncoderInitializeTwice); return; @@ -130,7 +130,7 @@ void AudioOpusEncoder::Initialize(const Options& options, opus_encoder_ = std::move(status_or_encoder).value(); - output_cb_ = BindToCurrentLoop(std::move(output_callback)); + output_cb_ = BindToCurrentLoop(std::move(output_callback), FROM_HERE); std::move(done_cb).Run(EncoderStatus::Codes::kOk); } @@ -187,7 +187,7 @@ void AudioOpusEncoder::Encode(std::unique_ptr<AudioBus> audio_bus, DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(done_cb); - current_done_cb_ = BindToCurrentLoop(std::move(done_cb)); + current_done_cb_ = BindToCurrentLoop(std::move(done_cb), FROM_HERE); if (!opus_encoder_) { std::move(current_done_cb_) .Run(EncoderStatus::Codes::kEncoderInitializeNeverCompleted); @@ -212,7 +212,7 @@ void AudioOpusEncoder::Encode(std::unique_ptr<AudioBus> audio_bus, void AudioOpusEncoder::Flush(EncoderStatusCB done_cb) { DCHECK(done_cb); - done_cb = BindToCurrentLoop(std::move(done_cb)); + done_cb = BindToCurrentLoop(std::move(done_cb), FROM_HERE); if (!opus_encoder_) { std::move(done_cb).Run( EncoderStatus::Codes::kEncoderInitializeNeverCompleted); diff --git a/chromium/media/audio/audio_output_device.cc b/chromium/media/audio/audio_output_device.cc index c1b8347018d..6f1f4c2be26 100644 --- a/chromium/media/audio/audio_output_device.cc +++ b/chromium/media/audio/audio_output_device.cc @@ -163,7 +163,7 @@ void AudioOutputDevice::GetOutputDeviceInfoAsync(OutputDeviceInfoCB info_cb) { base::AutoLock auto_lock(device_info_lock_); if (!did_receive_auth_.IsSignaled()) { DCHECK(!pending_device_info_cb_); - pending_device_info_cb_ = BindToCurrentLoop(std::move(info_cb)); + pending_device_info_cb_ = BindToCurrentLoop(std::move(info_cb), FROM_HERE); return; } } diff --git a/chromium/media/audio/audio_system_impl.cc b/chromium/media/audio/audio_system_impl.cc index ee04c3e6e5e..b68454a4ad3 100644 --- a/chromium/media/audio/audio_system_impl.cc +++ b/chromium/media/audio/audio_system_impl.cc @@ -89,7 +89,7 @@ AudioSystemImpl::MaybeBindToCurrentLoop( base::OnceCallback<void(Args...)> callback) { return audio_manager_->GetTaskRunner()->BelongsToCurrentThread() ? std::move(callback) - : media::BindToCurrentLoop(std::move(callback)); + : media::BindToCurrentLoop(std::move(callback), FROM_HERE); } // static diff --git a/chromium/media/audio/win/audio_device_listener_win.cc b/chromium/media/audio/win/audio_device_listener_win.cc index cdf7bec9061..6dae391abe5 100644 --- a/chromium/media/audio/win/audio_device_listener_win.cc +++ b/chromium/media/audio/win/audio_device_listener_win.cc @@ -35,6 +35,8 @@ static std::string RoleToString(ERole role) { } } +constexpr base::TimeDelta AudioDeviceListenerWin::kDeviceChangeLimit; + AudioDeviceListenerWin::AudioDeviceListenerWin( base::RepeatingClosure listener_cb) : listener_cb_(std::move(listener_cb)), diff --git a/chromium/media/audio/win/audio_low_latency_output_win.cc b/chromium/media/audio/win/audio_low_latency_output_win.cc index c3a4facf84d..7c2b14bfc6e 100644 --- a/chromium/media/audio/win/audio_low_latency_output_win.cc +++ b/chromium/media/audio/win/audio_low_latency_output_win.cc @@ -306,7 +306,7 @@ bool WASAPIAudioOutputStream::Open() { session_listener_ = std::make_unique<AudioSessionEventListener>( audio_client_.Get(), BindToCurrentLoop(base::BindOnce( &WASAPIAudioOutputStream::OnDeviceChanged, - weak_factory_.GetWeakPtr()))); + weak_factory_.GetWeakPtr()), FROM_HERE)); opened_ = true; return true; diff --git a/chromium/media/audio/win/audio_manager_win.cc b/chromium/media/audio/win/audio_manager_win.cc index 370edec9e9f..3e5707e7aa0 100644 --- a/chromium/media/audio/win/audio_manager_win.cc +++ b/chromium/media/audio/win/audio_manager_win.cc @@ -140,7 +140,7 @@ void AudioManagerWin::InitializeOnAudioThread() { output_device_listener_ = std::make_unique<AudioDeviceListenerWin>( BindToCurrentLoop(base::BindRepeating( &AudioManagerWin::NotifyAllOutputDeviceChangeListeners, - base::Unretained(this)))); + base::Unretained(this)), FROM_HERE)); } void AudioManagerWin::GetAudioDeviceNamesImpl(bool input, diff --git a/chromium/media/base/callback_registry.h b/chromium/media/base/callback_registry.h index faf55049cd6..7911d4434bd 100644 --- a/chromium/media/base/callback_registry.h +++ b/chromium/media/base/callback_registry.h @@ -62,7 +62,7 @@ class CallbackRegistry<void(Args...)> { // Use BindToCurrentLoop so that the callbacks are always posted to the // thread where Register() is called. Also, this helps avoid reentrancy // and deadlock issues, e.g. Register() is called in one of the callbacks. - callbacks_[registration_id] = BindToCurrentLoop(std::move(cb)); + callbacks_[registration_id] = BindToCurrentLoop(std::move(cb), FROM_HERE); return std::make_unique<RegistrationImpl>(this, registration_id); } diff --git a/chromium/media/base/media_switches.cc b/chromium/media/base/media_switches.cc index b41411546bd..57520edc6e5 100644 --- a/chromium/media/base/media_switches.cc +++ b/chromium/media/base/media_switches.cc @@ -479,7 +479,7 @@ constexpr base::FeatureParam<kCrosGlobalMediaControlsPinOptions>::Option {kCrosGlobalMediaControlsPinOptions::kNotPin, "default-unpinned"}, {kCrosGlobalMediaControlsPinOptions::kHeuristic, "heuristic"}}; -constexpr base::FeatureParam<kCrosGlobalMediaControlsPinOptions> +const base::FeatureParam<kCrosGlobalMediaControlsPinOptions> kCrosGlobalMediaControlsPinParam( &kGlobalMediaControlsForChromeOS, "CrosGlobalMediaControlsPinParam", diff --git a/chromium/media/base/pipeline_impl.cc b/chromium/media/base/pipeline_impl.cc index c37a9568876..74d83be105b 100644 --- a/chromium/media/base/pipeline_impl.cc +++ b/chromium/media/base/pipeline_impl.cc @@ -613,7 +613,7 @@ void PipelineImpl::RendererWrapper::CreateRendererInternal( // BindToCurrentLoop to call OnRendererCreated() on the media task runner. auto renderer_created_cb = BindToCurrentLoop( base::BindOnce(&RendererWrapper::OnRendererCreated, - weak_factory_.GetWeakPtr(), std::move(done_cb))); + weak_factory_.GetWeakPtr(), std::move(done_cb)), FROM_HERE); main_task_runner_->PostTask( FROM_HERE, base::BindOnce(&PipelineImpl::AsyncCreateRenderer, weak_pipeline_, @@ -694,7 +694,7 @@ void PipelineImpl::OnEnabledAudioTracksChanged( base::BindOnce(&RendererWrapper::OnEnabledAudioTracksChanged, base::Unretained(renderer_wrapper_.get()), enabled_track_ids, - BindToCurrentLoop(std::move(change_completed_cb)))); + BindToCurrentLoop(std::move(change_completed_cb), FROM_HERE))); } void PipelineImpl::RendererWrapper::OnEnabledAudioTracksChanged( @@ -735,7 +735,7 @@ void PipelineImpl::OnSelectedVideoTrackChanged( base::BindOnce(&RendererWrapper::OnSelectedVideoTrackChanged, base::Unretained(renderer_wrapper_.get()), selected_track_id, - BindToCurrentLoop(std::move(change_completed_cb)))); + BindToCurrentLoop(std::move(change_completed_cb), FROM_HERE))); } void PipelineImpl::RendererWrapper::OnSelectedVideoTrackChanged( @@ -1535,7 +1535,7 @@ void PipelineImpl::SetCdm(CdmContext* cdm_context, FROM_HERE, base::BindOnce(&RendererWrapper::SetCdm, base::Unretained(renderer_wrapper_.get()), cdm_context, - BindToCurrentLoop(std::move(cdm_attached_cb)))); + BindToCurrentLoop(std::move(cdm_attached_cb), FROM_HERE))); } #define RETURN_STRING(state) \ diff --git a/chromium/media/base/sinc_resampler.cc b/chromium/media/base/sinc_resampler.cc index 96a032910d7..9b845e790dd 100644 --- a/chromium/media/base/sinc_resampler.cc +++ b/chromium/media/base/sinc_resampler.cc @@ -84,7 +84,7 @@ #include "build/build_config.h" #include "cc/base/math_util.h" -#if defined(ARCH_CPU_X86_FAMILY) +#if defined(ARCH_CPU_X86_FAMILY) && (!defined(_MSC_VER) || defined(__clang__)) #include <immintrin.h> // Including these headers directly should generally be avoided. Since // Chrome is compiled with -msse3 (the minimal requirement), we include the @@ -118,7 +118,7 @@ static double SincScaleFactor(double io_ratio) { void SincResampler::InitializeCPUSpecificFeatures() { #if defined(ARCH_CPU_ARM_FAMILY) && defined(USE_NEON) convolve_proc_ = Convolve_NEON; -#elif defined(ARCH_CPU_X86_FAMILY) +#elif defined(ARCH_CPU_X86_FAMILY) && (!defined(_MSC_VER) || defined(__clang__)) base::CPU cpu; // Using AVX2 instead of SSE2 when AVX2/FMA3 supported. if (cpu.has_avx2() && cpu.has_fma3()) @@ -372,7 +372,7 @@ float SincResampler::Convolve_C(const float* input_ptr, const float* k1, kernel_interpolation_factor * sum2); } -#if defined(ARCH_CPU_X86_FAMILY) +#if defined(ARCH_CPU_X86_FAMILY) && (!defined(_MSC_VER) || defined(__clang__)) float SincResampler::Convolve_SSE(const float* input_ptr, const float* k1, const float* k2, double kernel_interpolation_factor) { diff --git a/chromium/media/base/status.h b/chromium/media/base/status.h index 4d5452c1148..cc810c77d4d 100644 --- a/chromium/media/base/status.h +++ b/chromium/media/base/status.h @@ -59,11 +59,13 @@ struct SecondArgType<R(A1, A2)> { }; union UKMPackHelper { +#pragma pack(push, 1) struct bits { uint16_t group; StatusCodeType code; uint32_t extra_data; - } __attribute__((packed)) bits; + } bits; +#pragma pack(pop) UKMPackedType packed; static_assert(sizeof(bits) == sizeof(packed)); diff --git a/chromium/media/formats/hls/tag_name.cc b/chromium/media/formats/hls/tag_name.cc index 7057dc2ee98..f197bb73d3c 100644 --- a/chromium/media/formats/hls/tag_name.cc +++ b/chromium/media/formats/hls/tag_name.cc @@ -116,7 +116,7 @@ TagKind GetTagKind(TagName name) { absl::optional<TagName> ParseTagName(base::StringPiece name) { // Search for the tag name - const auto* match = kTagNames.find(name); + const auto match = kTagNames.find(name); if (match == kTagNames.end()) { return absl::nullopt; } diff --git a/chromium/media/gpu/windows/d3d11_h264_accelerator.cc b/chromium/media/gpu/windows/d3d11_h264_accelerator.cc index 48e827bee83..1fa463ad739 100644 --- a/chromium/media/gpu/windows/d3d11_h264_accelerator.cc +++ b/chromium/media/gpu/windows/d3d11_h264_accelerator.cc @@ -229,9 +229,13 @@ void D3D11H264Accelerator::FillPicParamsWithConstants( #define ARG_SEL(_1, _2, NAME, ...) NAME +#ifndef CR_EXPAND_ARG +#define CR_EXPAND_ARG(x) x +#endif + #define SPS_TO_PP1(a) pic_param->a = sps->a; #define SPS_TO_PP2(a, b) pic_param->a = sps->b; -#define SPS_TO_PP(...) ARG_SEL(__VA_ARGS__, SPS_TO_PP2, SPS_TO_PP1)(__VA_ARGS__) +#define SPS_TO_PP(...) CR_EXPAND_ARG(ARG_SEL(__VA_ARGS__, SPS_TO_PP2, SPS_TO_PP1)(__VA_ARGS__)) void D3D11H264Accelerator::PicParamsFromSPS(DXVA_PicParams_H264* pic_param, const H264SPS* sps, bool field_pic) { @@ -263,7 +267,7 @@ void D3D11H264Accelerator::PicParamsFromSPS(DXVA_PicParams_H264* pic_param, #define PPS_TO_PP1(a) pic_param->a = pps->a; #define PPS_TO_PP2(a, b) pic_param->a = pps->b; -#define PPS_TO_PP(...) ARG_SEL(__VA_ARGS__, PPS_TO_PP2, PPS_TO_PP1)(__VA_ARGS__) +#define PPS_TO_PP(...) CR_EXPAND_ARG(ARG_SEL(__VA_ARGS__, PPS_TO_PP2, PPS_TO_PP1)(__VA_ARGS__)) bool D3D11H264Accelerator::PicParamsFromPPS(DXVA_PicParams_H264* pic_param, const H264PPS* pps) { PPS_TO_PP(constrained_intra_pred_flag); diff --git a/chromium/media/parsers/jpeg_parser.cc b/chromium/media/parsers/jpeg_parser.cc index a01ce87cf4e..1519cfdc48f 100644 --- a/chromium/media/parsers/jpeg_parser.cc +++ b/chromium/media/parsers/jpeg_parser.cc @@ -93,13 +93,13 @@ const JpegHuffmanTable kDefaultAcTable[kJpegMaxHuffmanTableNumBaseline] = { }, }; -constexpr uint8_t kZigZag8x8[64] = { +const uint8_t kZigZag8x8[64] = { 0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63}; -constexpr JpegQuantizationTable kDefaultQuantTable[2] = { +const JpegQuantizationTable kDefaultQuantTable[2] = { // Table K.1 Luminance quantization table values. { true, diff --git a/chromium/net/base/backoff_entry.cc b/chromium/net/base/backoff_entry.cc index 400a4052712..7f062c8028b 100644 --- a/chromium/net/base/backoff_entry.cc +++ b/chromium/net/base/backoff_entry.cc @@ -142,7 +142,7 @@ base::TimeTicks BackoffEntry::CalculateReleaseTime() const { // accounted for. Both cases are handled by using CheckedNumeric<int64_t> to // perform the conversion to integers. double delay_ms = policy_->initial_delay_ms; - delay_ms *= pow(policy_->multiply_factor, effective_failure_count - 1); + delay_ms *= pow(policy_->multiply_factor, double(effective_failure_count) - 1); delay_ms -= base::RandDouble() * policy_->jitter_factor * delay_ms; // Do overflow checking in microseconds, the internal unit of TimeTicks. diff --git a/chromium/net/dns/https_record_rdata.cc b/chromium/net/dns/https_record_rdata.cc index f9512b02852..73ec33c0d8c 100644 --- a/chromium/net/dns/https_record_rdata.cc +++ b/chromium/net/dns/https_record_rdata.cc @@ -452,6 +452,7 @@ bool ServiceFormHttpsRecordRdata::IsSupportedKey(uint16_t key) { #else // Only intended for DCHECKs. IMMEDIATE_CRASH(); + return false; #endif // DCHECK_IS_ON() } diff --git a/chromium/net/third_party/quiche/BUILD.gn b/chromium/net/third_party/quiche/BUILD.gn index d88fb52de74..e63aed92831 100644 --- a/chromium/net/third_party/quiche/BUILD.gn +++ b/chromium/net/third_party/quiche/BUILD.gn @@ -49,7 +49,9 @@ config("quiche_config") { "src", ] - cflags = [ "-Wno-shadow" ] + if (is_clang || !is_win) { + cflags = [ "-Wno-shadow" ] + } } component("quiche") { diff --git a/chromium/net/third_party/quiche/src/quiche/quic/core/frames/quic_frame.h b/chromium/net/third_party/quiche/src/quiche/quic/core/frames/quic_frame.h index 358b20e1265..e57dab29bbe 100644 --- a/chromium/net/third_party/quiche/src/quiche/quic/core/frames/quic_frame.h +++ b/chromium/net/third_party/quiche/src/quiche/quic/core/frames/quic_frame.h @@ -37,7 +37,7 @@ #include "quiche/quic/platform/api/quic_export.h" #ifndef QUIC_FRAME_DEBUG -#if !defined(NDEBUG) || defined(ADDRESS_SANITIZER) +#if (!defined(NDEBUG) || defined(ADDRESS_SANITIZER)) && !defined(COMPILER_MSVC) #define QUIC_FRAME_DEBUG 1 #else // !defined(NDEBUG) || defined(ADDRESS_SANITIZER) #define QUIC_FRAME_DEBUG 0 diff --git a/chromium/net/third_party/quiche/src/quiche/quic/core/quic_interval_deque.h b/chromium/net/third_party/quiche/src/quiche/quic/core/quic_interval_deque.h index ed13e7a44df..f85119f5947 100644 --- a/chromium/net/third_party/quiche/src/quiche/quic/core/quic_interval_deque.h +++ b/chromium/net/third_party/quiche/src/quiche/quic/core/quic_interval_deque.h @@ -185,8 +185,8 @@ class QUIC_NO_EXPORT QuicIntervalDeque { ++(*this); return copy; } - reference operator*() { return deque_->container_[index_]; } - reference operator*() const { return deque_->container_[index_]; } + reference operator*() { return *&deque_->container_[index_]; } + reference operator*() const { return *&deque_->container_[index_]; } pointer operator->() { return &deque_->container_[index_]; } bool operator==(const Iterator& rhs) const { return index_ == rhs.index_ && deque_ == rhs.deque_; diff --git a/chromium/net/third_party/quiche/src/quiche/quic/core/quic_stream_send_buffer.cc b/chromium/net/third_party/quiche/src/quiche/quic/core/quic_stream_send_buffer.cc index c7eb1886f88..dd924aab0a2 100644 --- a/chromium/net/third_party/quiche/src/quiche/quic/core/quic_stream_send_buffer.cc +++ b/chromium/net/third_party/quiche/src/quiche/quic/core/quic_stream_send_buffer.cc @@ -234,6 +234,28 @@ StreamPendingRetransmission QuicStreamSendBuffer::NextPendingRetransmission() return {0, 0}; } +namespace { +template<class ForwardIt, class T, class Compare> +ForwardIt lower_bound(ForwardIt first, ForwardIt last, const T& value, Compare comp) +{ + ForwardIt it = first; + typename std::iterator_traits<ForwardIt>::difference_type count, step; + count = std::distance(first, last); + + while (count > 0) { + step = count / 2; + std::advance(it, step); + if (comp(*it, value)) { + first = ++it; + count -= step + 1; + } + else + count = step; + } + return first; +} +} + bool QuicStreamSendBuffer::FreeMemSlices(QuicStreamOffset start, QuicStreamOffset end) { auto it = interval_deque_.DataBegin(); @@ -247,8 +269,8 @@ bool QuicStreamSendBuffer::FreeMemSlices(QuicStreamOffset start, } if (!it->interval().Contains(start)) { // Slow path that not the earliest outstanding data gets acked. - it = std::lower_bound(interval_deque_.DataBegin(), - interval_deque_.DataEnd(), start, CompareOffset()); + it = lower_bound(interval_deque_.DataBegin(), + interval_deque_.DataEnd(), start, CompareOffset()); } if (it == interval_deque_.DataEnd() || it->slice.empty()) { QUIC_BUG(quic_bug_10853_5) diff --git a/chromium/pdf/file_extension.cc b/chromium/pdf/file_extension.cc index e079f3b2055..13c05616106 100644 --- a/chromium/pdf/file_extension.cc +++ b/chromium/pdf/file_extension.cc @@ -74,7 +74,7 @@ enum ExtensionIndex FileNameToExtensionIndex(const std::u16string& file_name) { const std::string& extension = extension_str_lower; #endif - auto* const* it = + const auto it = std::find(kFileExtensions.begin(), kFileExtensions.end(), extension); if (it == kFileExtensions.end()) return ExtensionIndex::kOtherExt; diff --git a/chromium/ppapi/cpp/point.h b/chromium/ppapi/cpp/point.h index 028d050e7ad..9d2d87d14e5 100644 --- a/chromium/ppapi/cpp/point.h +++ b/chromium/ppapi/cpp/point.h @@ -291,15 +291,13 @@ class FloatPoint { PP_FloatPoint float_point_; }; -} // namespace pp - /// Determines whether the x and y values of two Points are equal. /// /// @param[in] lhs The Point on the left-hand side of the equation. /// @param[in] rhs The Point on the right-hand side of the equation. /// /// @return true if they are equal, false if unequal. -inline bool operator==(const pp::Point& lhs, const pp::Point& rhs) { +inline bool operator==(const Point& lhs, const Point& rhs) { return lhs.x() == rhs.x() && lhs.y() == rhs.y(); } @@ -310,7 +308,7 @@ inline bool operator==(const pp::Point& lhs, const pp::Point& rhs) { /// /// @return true if the coordinates of lhs are equal to the coordinates /// of rhs, otherwise false. -inline bool operator!=(const pp::Point& lhs, const pp::Point& rhs) { +inline bool operator!=(const Point& lhs, const Point& rhs) { return !(lhs == rhs); } @@ -320,7 +318,7 @@ inline bool operator!=(const pp::Point& lhs, const pp::Point& rhs) { /// @param[in] rhs The Point on the right-hand side of the equation. /// /// @return true if they are equal, false if unequal. -inline bool operator==(const pp::FloatPoint& lhs, const pp::FloatPoint& rhs) { +inline bool operator==(const FloatPoint& lhs, const FloatPoint& rhs) { return lhs.x() == rhs.x() && lhs.y() == rhs.y(); } @@ -331,8 +329,10 @@ inline bool operator==(const pp::FloatPoint& lhs, const pp::FloatPoint& rhs) { /// /// @return true if the coordinates of lhs are equal to the coordinates /// of rhs, otherwise false. -inline bool operator!=(const pp::FloatPoint& lhs, const pp::FloatPoint& rhs) { +inline bool operator!=(const FloatPoint& lhs, const FloatPoint& rhs) { return !(lhs == rhs); } +} // namespace pp + #endif // PPAPI_CPP_POINT_H_ diff --git a/chromium/ppapi/cpp/rect.h b/chromium/ppapi/cpp/rect.h index c5f6163f1b2..e9abb4f6dac 100644 --- a/chromium/ppapi/cpp/rect.h +++ b/chromium/ppapi/cpp/rect.h @@ -784,8 +784,6 @@ class FloatRect { PP_FloatRect rect_; }; -} // namespace pp - /// This function determines whether the x, y, width, and height values of two /// rectangles and are equal. /// @@ -793,7 +791,7 @@ class FloatRect { /// @param[in] rhs The <code>Rect</code> on the right-hand side of the equation. /// /// @return true if they are equal, false if unequal. -inline bool operator==(const pp::Rect& lhs, const pp::Rect& rhs) { +inline bool operator==(const Rect& lhs, const Rect& rhs) { return lhs.x() == rhs.x() && lhs.y() == rhs.y() && lhs.width() == rhs.width() && @@ -807,7 +805,7 @@ inline bool operator==(const pp::Rect& lhs, const pp::Rect& rhs) { /// equation. /// /// @return true if the given Rects are equal, otherwise false. -inline bool operator!=(const pp::Rect& lhs, const pp::Rect& rhs) { +inline bool operator!=(const Rect& lhs, const Rect& rhs) { return !(lhs == rhs); } @@ -820,7 +818,7 @@ inline bool operator!=(const pp::Rect& lhs, const pp::Rect& rhs) { /// equation. /// /// @return true if they are equal, false if unequal. -inline bool operator==(const pp::FloatRect& lhs, const pp::FloatRect& rhs) { +inline bool operator==(const FloatRect& lhs, const FloatRect& rhs) { return lhs.x() == rhs.x() && lhs.y() == rhs.y() && lhs.width() == rhs.width() && @@ -835,9 +833,11 @@ inline bool operator==(const pp::FloatRect& lhs, const pp::FloatRect& rhs) { /// equation. /// /// @return true if the given Rects are equal, otherwise false. -inline bool operator!=(const pp::FloatRect& lhs, const pp::FloatRect& rhs) { +inline bool operator!=(const FloatRect& lhs, const FloatRect& rhs) { return !(lhs == rhs); } +} // namespace pp + #endif // PPAPI_CPP_RECT_H_ diff --git a/chromium/ppapi/cpp/size.h b/chromium/ppapi/cpp/size.h index e96b598b3f8..69e836a294b 100644 --- a/chromium/ppapi/cpp/size.h +++ b/chromium/ppapi/cpp/size.h @@ -279,8 +279,6 @@ class FloatSize { PP_FloatSize size_; }; -} // namespace pp - /// This function determines whether the width and height values of two sizes /// are equal. /// @@ -289,7 +287,7 @@ class FloatSize { /// equation. /// /// @return true if they are equal, false if unequal. -inline bool operator==(const pp::Size& lhs, const pp::Size& rhs) { +inline bool operator==(const Size& lhs, const Size& rhs) { return lhs.width() == rhs.width() && lhs.height() == rhs.height(); } @@ -300,7 +298,7 @@ inline bool operator==(const pp::Size& lhs, const pp::Size& rhs) { /// /// @return true if the <code>Size</code> of lhs are equal to the /// <code>Size</code> of rhs, otherwise false. -inline bool operator!=(const pp::Size& lhs, const pp::Size& rhs) { +inline bool operator!=(const Size& lhs, const Size& rhs) { return !(lhs == rhs); } @@ -313,7 +311,7 @@ inline bool operator!=(const pp::Size& lhs, const pp::Size& rhs) { /// equation. /// /// @return true if they are equal, false if unequal. -inline bool operator==(const pp::FloatSize& lhs, const pp::FloatSize& rhs) { +inline bool operator==(const FloatSize& lhs, const FloatSize& rhs) { return lhs.width() == rhs.width() && lhs.height() == rhs.height(); } @@ -326,9 +324,11 @@ inline bool operator==(const pp::FloatSize& lhs, const pp::FloatSize& rhs) { /// /// @return true if the <code>FloatSize</code> of lhs are equal to the /// <code>FloatSize</code> of rhs, otherwise false. -inline bool operator!=(const pp::FloatSize& lhs, const pp::FloatSize& rhs) { +inline bool operator!=(const FloatSize& lhs, const FloatSize& rhs) { return !(lhs == rhs); } +} // namespace pp + #endif // PPAPI_CPP_SIZE_H_ diff --git a/chromium/services/device/public/cpp/hid/hid_blocklist.cc b/chromium/services/device/public/cpp/hid/hid_blocklist.cc index f2322e6a1dd..abf2a353b0d 100644 --- a/chromium/services/device/public/cpp/hid/hid_blocklist.cc +++ b/chromium/services/device/public/cpp/hid/hid_blocklist.cc @@ -198,10 +198,10 @@ bool IsReportTypeComponent(base::StringPiece string) { } // namespace -constexpr base::Feature kWebHidBlocklist{"WebHIDBlocklist", +const base::Feature kWebHidBlocklist{"WebHIDBlocklist", base::FEATURE_ENABLED_BY_DEFAULT}; -constexpr base::FeatureParam<std::string> kWebHidBlocklistAdditions{ +const base::FeatureParam<std::string> kWebHidBlocklistAdditions{ &kWebHidBlocklist, "blocklist_additions", /*default_value=*/""}; // static diff --git a/chromium/services/network/public/cpp/supports_loading_mode/supports_loading_mode_parser.cc b/chromium/services/network/public/cpp/supports_loading_mode/supports_loading_mode_parser.cc index ab9382486e9..a9339696fa6 100644 --- a/chromium/services/network/public/cpp/supports_loading_mode/supports_loading_mode_parser.cc +++ b/chromium/services/network/public/cpp/supports_loading_mode/supports_loading_mode_parser.cc @@ -53,12 +53,21 @@ mojom::SupportsLoadingModePtr ParseSupportsLoadingMode( // Each supported token maps 1:1 to an enumerator. const auto& token = item.item.GetString(); +#ifdef _MSC_VER + for (const KnownLoadingMode& it : kKnownLoadingModes) { + if (it.token == token) { + modes.push_back(it.enumerator); + break; + } + } +#else const auto* it = base::ranges::find(kKnownLoadingModes, token, &KnownLoadingMode::token); if (it == base::ranges::end(kKnownLoadingModes)) continue; modes.push_back(it->enumerator); +#endif } // Order and repetition are not significant. diff --git a/chromium/services/tracing/public/cpp/perfetto/trace_event_data_source.h b/chromium/services/tracing/public/cpp/perfetto/trace_event_data_source.h index 99b92d714d0..200d745945d 100644 --- a/chromium/services/tracing/public/cpp/perfetto/trace_event_data_source.h +++ b/chromium/services/tracing/public/cpp/perfetto/trace_event_data_source.h @@ -153,7 +153,7 @@ class COMPONENT_EXPORT(TRACING_CPP) TraceEventDataSource public: struct SessionFlags { // True if startup tracing is enabled for the current tracing session. - bool is_startup_tracing : 1; + uint32_t is_startup_tracing : 1; // This ID is incremented whenever a new tracing session is started (either // when startup tracing is enabled or when the service tells us to start the diff --git a/chromium/services/video_capture/device_media_to_mojo_adapter.cc b/chromium/services/video_capture/device_media_to_mojo_adapter.cc index b81902c679d..d3508e92a4c 100644 --- a/chromium/services/video_capture/device_media_to_mojo_adapter.cc +++ b/chromium/services/video_capture/device_media_to_mojo_adapter.cc @@ -168,7 +168,7 @@ void DeviceMediaToMojoAdapter::Resume() { void DeviceMediaToMojoAdapter::GetPhotoState(GetPhotoStateCallback callback) { media::VideoCaptureDevice::GetPhotoStateCallback scoped_callback = mojo::WrapCallbackWithDefaultInvokeIfNotRun( - media::BindToCurrentLoop(std::move(callback)), nullptr); + media::BindToCurrentLoop(std::move(callback), FROM_HERE), nullptr); device_->GetPhotoState(std::move(scoped_callback)); } @@ -177,7 +177,7 @@ void DeviceMediaToMojoAdapter::SetPhotoOptions( SetPhotoOptionsCallback callback) { media::mojom::ImageCapture::SetOptionsCallback scoped_callback = mojo::WrapCallbackWithDefaultInvokeIfNotRun( - media::BindToCurrentLoop(std::move(callback)), false); + media::BindToCurrentLoop(std::move(callback), FROM_HERE), false); device_->SetPhotoOptions(std::move(settings), std::move(scoped_callback)); } @@ -187,7 +187,7 @@ void DeviceMediaToMojoAdapter::TakePhoto(TakePhotoCallback callback) { mojo::WrapCallbackWithDefaultInvokeIfNotRun( media::BindToCurrentLoop(base::BindOnce(&TakePhotoCallbackTrampoline, std::move(callback), - std::move(scoped_trace))), + std::move(scoped_trace)), FROM_HERE), nullptr); device_->TakePhoto(std::move(scoped_callback)); } diff --git a/chromium/skia/BUILD.gn b/chromium/skia/BUILD.gn index 7a096b9a887..72cedd4135b 100644 --- a/chromium/skia/BUILD.gn +++ b/chromium/skia/BUILD.gn @@ -132,8 +132,10 @@ config("skia_library_config") { # Skia uses C++17 language features in its internal code. Previously Skia was built with # "-std=c++17". See http://crbug.com/1257145 for why this was a bad idea. - cflags_cc = [ "-Wno-c++17-extensions" ] - cflags_objcc = [ "-Wno-c++17-extensions" ] + if (is_clang || !is_win) { + cflags_cc = [ "-Wno-c++17-extensions" ] + cflags_objcc = [ "-Wno-c++17-extensions" ] + } if (!is_ios && !use_system_freetype) { defines += [ "SK_FREETYPE_MINIMUM_RUNTIME_VERSION=(((FREETYPE_MAJOR) * 0x01000000) | ((FREETYPE_MINOR) * 0x00010000) | ((FREETYPE_PATCH) * 0x00000100))" ] diff --git a/chromium/sql/recover_module/cursor.h b/chromium/sql/recover_module/cursor.h index 845b7852648..d2cd5683f16 100644 --- a/chromium/sql/recover_module/cursor.h +++ b/chromium/sql/recover_module/cursor.h @@ -63,8 +63,10 @@ class VirtualCursor { // |sqlite_cursor| must have been returned by VirtualTable::SqliteCursor(). static inline VirtualCursor* FromSqliteCursor( sqlite3_vtab_cursor* sqlite_cursor) { +#if 0 static_assert(std::is_standard_layout<VirtualCursor>::value, "needed for the reinterpret_cast below"); +#endif static_assert(offsetof(VirtualCursor, sqlite_cursor_) == 0, "sqlite_cursor_ must be the first member of the class"); VirtualCursor* result = reinterpret_cast<VirtualCursor*>(sqlite_cursor); diff --git a/chromium/sql/recover_module/table.h b/chromium/sql/recover_module/table.h index ee4c7a5d160..a95bba90469 100644 --- a/chromium/sql/recover_module/table.h +++ b/chromium/sql/recover_module/table.h @@ -84,8 +84,10 @@ class VirtualTable { // // |sqlite_table| must have been returned by VirtualTable::SqliteTable(). static inline VirtualTable* FromSqliteTable(sqlite3_vtab* sqlite_table) { +#if 0 static_assert(std::is_standard_layout<VirtualTable>::value, "needed for the reinterpret_cast below"); +#endif static_assert(offsetof(VirtualTable, sqlite_table_) == 0, "sqlite_table_ must be the first member of the class"); VirtualTable* const result = reinterpret_cast<VirtualTable*>(sqlite_table); diff --git a/chromium/storage/browser/quota/quota_features.cc b/chromium/storage/browser/quota/quota_features.cc index c2cb26451d9..2604eeefda3 100644 --- a/chromium/storage/browser/quota/quota_features.cc +++ b/chromium/storage/browser/quota/quota_features.cc @@ -20,22 +20,22 @@ const base::Feature kStoragePressureEvent{"StoragePressureEvent", // Enables customized storage quota settings for embedders. const base::Feature kStorageQuotaSettings{"StorageQuotaSettings", base::FEATURE_DISABLED_BY_DEFAULT}; -constexpr base::FeatureParam<double> kMustRemainAvailableBytes{ +const base::FeatureParam<double> kMustRemainAvailableBytes{ &kStorageQuotaSettings, "MustRemainAvailableBytes", 1024 * kMBytes /* 1GB */ }; -constexpr base::FeatureParam<double> kMustRemainAvailableRatio{ +const base::FeatureParam<double> kMustRemainAvailableRatio{ &kStorageQuotaSettings, "MustRemainAvailableRatio", 0.01 /* 1% */ }; -constexpr base::FeatureParam<double> kPoolSizeBytes{&kStorageQuotaSettings, +const base::FeatureParam<double> kPoolSizeBytes{&kStorageQuotaSettings, "PoolSizeBytes", 0}; -constexpr base::FeatureParam<double> kPoolSizeRatio{ +const base::FeatureParam<double> kPoolSizeRatio{ &kStorageQuotaSettings, "PoolSizeRatio", 0.8 /* 80% */ }; -constexpr base::FeatureParam<double> kShouldRemainAvailableBytes{ +const base::FeatureParam<double> kShouldRemainAvailableBytes{ &kStorageQuotaSettings, "ShouldRemainAvailableBytes", 2048 * kMBytes /* 2GB */ }; -constexpr base::FeatureParam<double> kShouldRemainAvailableRatio{ +const base::FeatureParam<double> kShouldRemainAvailableRatio{ &kStorageQuotaSettings, "ShouldRemainAvailableRatio", 0.1 /* 10% */ }; diff --git a/chromium/third_party/blink/common/privacy_budget/identifiable_token_builder.cc b/chromium/third_party/blink/common/privacy_budget/identifiable_token_builder.cc index f08a18a2d5a..1bf36bb0fcd 100644 --- a/chromium/third_party/blink/common/privacy_budget/identifiable_token_builder.cc +++ b/chromium/third_party/blink/common/privacy_budget/identifiable_token_builder.cc @@ -47,7 +47,7 @@ IdentifiableTokenBuilder::IdentifiableTokenBuilder(ByteSpan buffer) } IdentifiableTokenBuilder& IdentifiableTokenBuilder::AddBytes(ByteSpan message) { - DCHECK_NE(position_, partial_.end()); +// DCHECK_NE(position_, partial_.end()); // Phase 1: // Slurp in as much of the message as necessary if there's a partial block // already assembled. Copying is expensive, so |partial_| is only involved @@ -60,7 +60,7 @@ IdentifiableTokenBuilder& IdentifiableTokenBuilder::AddBytes(ByteSpan message) { // Phase 2: // Consume as many full blocks as possible from |message|. - DCHECK_EQ(position_, partial_.begin()); +// DCHECK_EQ(position_, partial_.begin()); while (message.size() >= kBlockSizeInBytes) { DigestBlock(message.first<kBlockSizeInBytes>()); message = message.subspan(kBlockSizeInBytes); @@ -117,13 +117,13 @@ void IdentifiableTokenBuilder::AlignPartialBuffer() { if (position_ == partial_.end()) DigestBlock(TakeCompletedBlock()); - DCHECK_NE(position_, partial_.end()); +// DCHECK_NE(position_, partial_.end()); DCHECK(IsAligned()); } void IdentifiableTokenBuilder::DigestBlock(ConstFullBlockSpan block) { // partial_ should've been flushed before calling this. - DCHECK_EQ(position_, partial_.begin()); +// DCHECK_EQ(position_, partial_.begin()); // The chaining value (initialized with the initialization vector // kChainingValueSeed) is only used for diffusion. There's no length padding @@ -143,7 +143,7 @@ size_t IdentifiableTokenBuilder::PartialSize() const { IdentifiableTokenBuilder::ConstFullBlockSpan IdentifiableTokenBuilder::TakeCompletedBlock() { - DCHECK_EQ(position_, partial_.end()); +// DCHECK_EQ(position_, partial_.end()); auto buffer = base::make_span(partial_); position_ = partial_.begin(); return buffer; @@ -155,7 +155,8 @@ bool IdentifiableTokenBuilder::IsAligned() const { IdentifiableTokenBuilder::ByteSpan IdentifiableTokenBuilder::GetPartialBlock() const { - return ByteSpan(partial_.begin(), position_); + return ByteSpan(BlockBuffer::const_iterator(partial_.begin()), + BlockBuffer::const_iterator(position_)); } } // namespace blink diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h b/chromium/third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h index 0d6006a4104..f65c329444b 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h +++ b/chromium/third_party/blink/renderer/bindings/core/v8/native_value_traits_impl.h @@ -251,7 +251,7 @@ struct NativeValueTraits<IDLByteStringBase<mode>> v8::Isolate* isolate, v8::Local<v8::Value> value, ExceptionState& exception_state) { - if (value->IsString() and value.As<v8::String>()->ContainsOnlyOneByte()) + if (value->IsString() && value.As<v8::String>()->ContainsOnlyOneByte()) return bindings::NativeValueTraitsStringAdapter(value.As<v8::String>()); if (value->IsInt32()) { return bindings::NativeValueTraitsStringAdapter( diff --git a/chromium/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h b/chromium/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h index c7140a9095d..4c67d5c15e1 100644 --- a/chromium/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h +++ b/chromium/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h @@ -350,7 +350,7 @@ VectorOf<typename NativeValueTraits<IDLType>::ImplType> ToImplArguments( int start_index, ExceptionState& exception_state) { using TraitsType = NativeValueTraits<IDLType>; - using VectorType = VectorOf<typename TraitsType::ImplType>; + using VectorType = VectorOf<typename NativeValueTraits<IDLType>::ImplType>; int length = info.Length(); VectorType result; diff --git a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/callback_function.py b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/callback_function.py index d3735860eeb..1f0b50c40c5 100644 --- a/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/callback_function.py +++ b/chromium/third_party/blink/renderer/bindings/scripts/bind_gen/callback_function.py @@ -311,9 +311,11 @@ bindings::CallbackInvokeHelper<{template_params}> helper( else: body.append(T("const int argc = {};".format(len(arguments)))) if is_variadic and len(arguments) == 1: - body.append(T("v8::Local<v8::Value> argv[std::max(1, argc)];")) + body.append(T("std::vector<v8::Local<v8::Value>> argva(std::max(1, argc));")) + body.append(T("v8::Local<v8::Value>* argv = argva.data();")) else: - body.append(T("v8::Local<v8::Value> argv[argc];")) + body.append(T("std::vector<v8::Local<v8::Value>> argva(argc);")) + body.append(T("v8::Local<v8::Value>* argv = argva.data();")) for index, arg_type_and_name in enumerate(arg_type_and_names): if arguments[index].is_variadic: break @@ -590,6 +592,8 @@ def generate_callback_function(callback_function_identifier): EmptyNode(), make_header_include_directives(source_node.accumulator), EmptyNode(), + TextNode("#include <vector>"), + EmptyNode(), source_blink_ns, ]) source_blink_ns.body.extend([ diff --git a/chromium/third_party/blink/renderer/build/scripts/templates/origin_trials.cc.tmpl b/chromium/third_party/blink/renderer/build/scripts/templates/origin_trials.cc.tmpl index a330714dd22..2afb0fccdef 100644 --- a/chromium/third_party/blink/renderer/build/scripts/templates/origin_trials.cc.tmpl +++ b/chromium/third_party/blink/renderer/build/scripts/templates/origin_trials.cc.tmpl @@ -79,7 +79,7 @@ base::span<const OriginTrialFeature> origin_trials::FeaturesForTrial( std::begin(kTrialToFeaturesMap), std::end(kTrialToFeaturesMap), [&](const auto& entry) { return entry.trial_name == trial_name; }); DCHECK(it != std::end(kTrialToFeaturesMap)); - return {it->features.begin(), it->feature_count}; + return {it->features.data(), it->feature_count}; } base::span<const OriginTrialFeature> origin_trials::GetImpliedFeatures( diff --git a/chromium/third_party/blink/renderer/core/dom/events/event_queue.h b/chromium/third_party/blink/renderer/core/dom/events/event_queue.h index 12f7fe8e47c..aeb4d94c2f5 100644 --- a/chromium/third_party/blink/renderer/core/dom/events/event_queue.h +++ b/chromium/third_party/blink/renderer/core/dom/events/event_queue.h @@ -30,6 +30,7 @@ #include "base/location.h" #include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/renderer/core/core_export.h" +#include "third_party/blink/renderer/core/dom/events/event.h" #include "third_party/blink/renderer/core/execution_context/execution_context_lifecycle_observer.h" #include "third_party/blink/renderer/platform/heap/collection_support/heap_linked_hash_set.h" #include "third_party/blink/renderer/platform/wtf/linked_hash_set.h" diff --git a/chromium/third_party/blink/renderer/core/frame/local_dom_window.h b/chromium/third_party/blink/renderer/core/frame/local_dom_window.h index 7091b979bed..30a22300f0a 100644 --- a/chromium/third_party/blink/renderer/core/frame/local_dom_window.h +++ b/chromium/third_party/blink/renderer/core/frame/local_dom_window.h @@ -107,7 +107,7 @@ class CORE_EXPORT LocalDOMWindow final : public DOMWindow, USING_PRE_FINALIZER(LocalDOMWindow, Dispose); public: - class CORE_EXPORT EventListenerObserver : public GarbageCollectedMixin { + class CORE_EXPORT EventListenerObserver : public cppgc::GarbageCollectedMixin { public: virtual void DidAddEventListener(LocalDOMWindow*, const AtomicString&) = 0; virtual void DidRemoveEventListener(LocalDOMWindow*, diff --git a/chromium/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc b/chromium/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc index 8f8d65c6bc8..0007b0ac8a8 100644 --- a/chromium/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc +++ b/chromium/third_party/blink/renderer/core/html/canvas/canvas_async_blob_creator.cc @@ -200,8 +200,8 @@ CanvasAsyncBlobCreator::CanvasAsyncBlobCreator( // If image is lazy decoded, call readPixels() to trigger decoding. if (skia_image->isLazyGenerated()) { SkImageInfo info = SkImageInfo::MakeN32Premul(1, 1); - uint8_t pixel[info.bytesPerPixel()]; - skia_image->readPixels(info, pixel, info.minRowBytes(), 0, 0); + std::vector<uint8_t> pixel(info.bytesPerPixel()); + skia_image->readPixels(info, pixel.data(), info.minRowBytes(), 0, 0); } // For kHTMLCanvasToBlobCallback and kOffscreenCanvasConvertToBlobPromise diff --git a/chromium/third_party/blink/renderer/core/inspector/inspector_trace_events.h b/chromium/third_party/blink/renderer/core/inspector/inspector_trace_events.h index f46e7736d64..15de0da3c2d 100644 --- a/chromium/third_party/blink/renderer/core/inspector/inspector_trace_events.h +++ b/chromium/third_party/blink/renderer/core/inspector/inspector_trace_events.h @@ -23,6 +23,10 @@ #include "third_party/blink/renderer/platform/wtf/functional.h" #include "v8/include/v8.h" +#ifndef CR_EXPAND_ARG +#define CR_EXPAND_ARG(x) x +#endif + namespace base { class UnguessableToken; } @@ -162,12 +166,12 @@ class CORE_EXPORT InspectorTraceEvents }) #define DEVTOOLS_TIMELINE_TRACE_EVENT_INSTANT(...) \ - DEVTOOLS_TIMELINE_TRACE_EVENT_INSTANT_WITH_CATEGORIES("devtools.timeline", \ - __VA_ARGS__) + CR_EXPAND_ARG(DEVTOOLS_TIMELINE_TRACE_EVENT_INSTANT_WITH_CATEGORIES("devtools.timeline", \ + __VA_ARGS__)) #define DEVTOOLS_TIMELINE_TRACE_EVENT(...) \ - DEVTOOLS_TIMELINE_TRACE_EVENT_WITH_CATEGORIES("devtools.timeline", \ - __VA_ARGS__) + CR_EXPAND_ARG(DEVTOOLS_TIMELINE_TRACE_EVENT_WITH_CATEGORIES("devtools.timeline", \ + __VA_ARGS__)) namespace inspector_layout_event { void BeginData(perfetto::TracedValue context, LocalFrameView*); diff --git a/chromium/third_party/blink/renderer/core/layout/layout_shift_tracker.cc b/chromium/third_party/blink/renderer/core/layout/layout_shift_tracker.cc index a344f240714..1124798a9cb 100644 --- a/chromium/third_party/blink/renderer/core/layout/layout_shift_tracker.cc +++ b/chromium/third_party/blink/renderer/core/layout/layout_shift_tracker.cc @@ -764,7 +764,7 @@ std::unique_ptr<TracedValue> LayoutShiftTracker::PerFrameTraceData( } void LayoutShiftTracker::AttributionsToTracedValue(TracedValue& value) const { - const Attribution* it = attributions_.begin(); + auto it = attributions_.begin(); if (!*it) return; diff --git a/chromium/third_party/blink/renderer/core/layout/ng/inline/ng_fragment_item.h b/chromium/third_party/blink/renderer/core/layout/ng/inline/ng_fragment_item.h index 1c768e21a2e..d55b4701792 100644 --- a/chromium/third_party/blink/renderer/core/layout/ng/inline/ng_fragment_item.h +++ b/chromium/third_party/blink/renderer/core/layout/ng/inline/ng_fragment_item.h @@ -101,6 +101,8 @@ class CORE_EXPORT NGFragmentItem final { enum ItemType { kText, kSvgText, kGeneratedText, kLine, kBox }; enum TracedType { kNone, kLineItem, kBoxItem }; + NGFragmentItem() { } + // Create appropriate type for |line_item|. NGFragmentItem(NGLogicalLineItem&& line_item, WritingMode writing_mode); // Create a box item. diff --git a/chromium/third_party/blink/renderer/core/layout/ng/layout_ng_mixin.cc b/chromium/third_party/blink/renderer/core/layout/ng/layout_ng_mixin.cc index a22a7302207..bc62feaeb15 100644 --- a/chromium/third_party/blink/renderer/core/layout/ng/layout_ng_mixin.cc +++ b/chromium/third_party/blink/renderer/core/layout/ng/layout_ng_mixin.cc @@ -321,8 +321,7 @@ void LayoutNGMixin<Base>::UpdateOutOfFlowBlockLayout() { NGFragmentGeometry fragment_geometry; fragment_geometry.border = ComputeBorders(constraint_space, container_node); - fragment_geometry.scrollbar = - ComputeScrollbars(constraint_space, container_node); + fragment_geometry.scrollbar = (constraint_space.IsAnonymous() ? NGBoxStrut() : ComputeScrollbarsForNonAnonymous(container_node)); fragment_geometry.padding = ComputePadding(constraint_space, *container_style); diff --git a/chromium/third_party/blink/renderer/core/layout/ng/layout_ng_view.h b/chromium/third_party/blink/renderer/core/layout/ng/layout_ng_view.h index 388a088ae84..5064d592a79 100644 --- a/chromium/third_party/blink/renderer/core/layout/ng/layout_ng_view.h +++ b/chromium/third_party/blink/renderer/core/layout/ng/layout_ng_view.h @@ -11,10 +11,6 @@ namespace blink { -extern template class CORE_EXTERN_TEMPLATE_EXPORT - LayoutNGBlockFlowMixin<LayoutView>; -extern template class CORE_EXTERN_TEMPLATE_EXPORT LayoutNGMixin<LayoutView>; - class CORE_EXPORT LayoutNGView : public LayoutNGBlockFlowMixin<LayoutView> { public: explicit LayoutNGView(ContainerNode*); diff --git a/chromium/third_party/blink/renderer/core/layout/table_layout_algorithm_auto.cc b/chromium/third_party/blink/renderer/core/layout/table_layout_algorithm_auto.cc index 1a4a06a4761..c08fe512693 100644 --- a/chromium/third_party/blink/renderer/core/layout/table_layout_algorithm_auto.cc +++ b/chromium/third_party/blink/renderer/core/layout/table_layout_algorithm_auto.cc @@ -658,7 +658,7 @@ void TableLayoutAlgorithmAuto::InsertSpanCell(LayoutTableCell* cell) { return; unsigned size = span_cells_.size(); - if (!size || span_cells_[size - 1] != 0) { + if (!size || span_cells_[size - 1] != nullptr) { span_cells_.Grow(size + 10); for (unsigned i = 0; i < 10; i++) span_cells_[size + i] = nullptr; diff --git a/chromium/third_party/blink/renderer/core/page/scrolling/scroll_state.cc b/chromium/third_party/blink/renderer/core/page/scrolling/scroll_state.cc index e60d0182d07..677386de17b 100644 --- a/chromium/third_party/blink/renderer/core/page/scrolling/scroll_state.cc +++ b/chromium/third_party/blink/renderer/core/page/scrolling/scroll_state.cc @@ -41,7 +41,7 @@ ScrollState* ScrollState::Create(ScrollStateInit* init) { scroll_state_data->from_user_input = init->fromUserInput(); scroll_state_data->is_direct_manipulation = init->isDirectManipulation(); scroll_state_data->delta_granularity = - static_cast<ui::ScrollGranularity>(init->deltaGranularity()); + static_cast<ui::ScrollGranularity>(int(init->deltaGranularity())); ScrollState* scroll_state = MakeGarbageCollected<ScrollState>(std::move(scroll_state_data)); return scroll_state; diff --git a/chromium/third_party/blink/renderer/core/typed_arrays/dom_typed_array.h b/chromium/third_party/blink/renderer/core/typed_arrays/dom_typed_array.h index 153daec60e8..e1ca2ca260e 100644 --- a/chromium/third_party/blink/renderer/core/typed_arrays/dom_typed_array.h +++ b/chromium/third_party/blink/renderer/core/typed_arrays/dom_typed_array.h @@ -120,6 +120,7 @@ class DOMTypedArray final : public DOMArrayBufferView { V(int64_t, BigInt64, false) \ V(uint64_t, BigUint64, false) +#if !defined(_MSC_VER) || defined(__clang__) #define DOMTYPEDARRAY_DECLARE_WRAPPERTYPEINFO(val_t, Type, clamped) \ template <> \ const WrapperTypeInfo \ @@ -129,6 +130,7 @@ class DOMTypedArray final : public DOMArrayBufferView { DOMTypedArray<val_t, v8::Type##Array, clamped>::wrapper_type_info_; DOMTYPEDARRAY_FOREACH_VIEW_TYPE(DOMTYPEDARRAY_DECLARE_WRAPPERTYPEINFO) #undef DOMTYPEDARRAY_DECLARE_WRAPPERTYPEINFO +#endif #define DOMTYPEDARRAY_DEFINE_GETTYPE(val_t, Type, clamped) \ template <> \ diff --git a/chromium/third_party/blink/renderer/modules/accessibility/ax_inline_text_box.cc b/chromium/third_party/blink/renderer/modules/accessibility/ax_inline_text_box.cc index 7da19c98a7d..f9b6938015e 100644 --- a/chromium/third_party/blink/renderer/modules/accessibility/ax_inline_text_box.cc +++ b/chromium/third_party/blink/renderer/modules/accessibility/ax_inline_text_box.cc @@ -314,7 +314,7 @@ void AXInlineTextBox::SerializeMarkerAttributes( markers_used_by_accessibility); const int start_text_offset_in_parent = TextOffsetInContainer(0); for (const auto& node_marker_pair : node_marker_pairs) { - DCHECK_EQ(GetNode(), node_marker_pair.first); + DCHECK_EQ(GetNode(), node_marker_pair.first.Get()); const DocumentMarker* marker = node_marker_pair.second; if (aria_marker_type == marker->GetType()) diff --git a/chromium/third_party/blink/renderer/modules/canvas/canvas2d/canvas_path.cc b/chromium/third_party/blink/renderer/modules/canvas/canvas2d/canvas_path.cc index 168c3c1a20e..eed2014e989 100644 --- a/chromium/third_party/blink/renderer/modules/canvas/canvas2d/canvas_path.cc +++ b/chromium/third_party/blink/renderer/modules/canvas/canvas2d/canvas_path.cc @@ -527,7 +527,11 @@ void CanvasPath::roundRect( // TODO(crbug.com/1234113): Instrument new canvas APIs. identifiability_study_helper_.set_encountered_skipped_ops(); +#if !defined(COMPILER_MSVC) gfx::SizeF r[num_radii]; +#else + gfx::SizeF r[4]; +#endif for (int i = 0; i < num_radii; ++i) { switch (radii[i]->GetContentType()) { case V8UnionDOMPointInitOrUnrestrictedDouble::ContentType:: diff --git a/chromium/third_party/blink/renderer/modules/mediastream/media_stream_track.h b/chromium/third_party/blink/renderer/modules/mediastream/media_stream_track.h index 19653a5c7d9..8cb11e8c739 100644 --- a/chromium/third_party/blink/renderer/modules/mediastream/media_stream_track.h +++ b/chromium/third_party/blink/renderer/modules/mediastream/media_stream_track.h @@ -49,7 +49,7 @@ class MODULES_EXPORT MediaStreamTrack DEFINE_WRAPPERTYPEINFO(); public: - class MODULES_EXPORT Observer : public GarbageCollectedMixin { + class MODULES_EXPORT Observer : public cppgc::GarbageCollectedMixin { public: virtual ~Observer() = default; virtual void TrackChangedState() = 0; diff --git a/chromium/third_party/blink/renderer/modules/screen_enumeration/screen_details.cc b/chromium/third_party/blink/renderer/modules/screen_enumeration/screen_details.cc index 3ea9769e4a5..62294a5eae3 100644 --- a/chromium/third_party/blink/renderer/modules/screen_enumeration/screen_details.cc +++ b/chromium/third_party/blink/renderer/modules/screen_enumeration/screen_details.cc @@ -34,8 +34,14 @@ ScreenDetailed* ScreenDetails::currentScreen() const { if (screens_.IsEmpty()) return nullptr; - auto* it = base::ranges::find(screens_, current_display_id_, - &ScreenDetailed::DisplayId); + auto it = screens_.begin(); + for (; it != screens_.end(); ++it) { + const auto& screen = *it; + if (screen->DisplayId() == current_display_id_) + break; + } +// auto* it = base::ranges::find(screens_, current_display_id_, +// &ScreenDetailed::DisplayId); DCHECK(it != screens_.end()); return *it; } @@ -78,8 +84,13 @@ void ScreenDetails::UpdateScreenInfosImpl(LocalDOMWindow* window, // Check if any screens have been removed and remove them from `screens_`. for (WTF::wtf_size_t i = 0; i < screens_.size(); /*conditionally incremented*/) { - if (base::Contains(new_infos.screen_infos, screens_[i]->DisplayId(), - &display::ScreenInfo::display_id)) { + auto it = new_infos.screen_infos.cbegin(); + bool found = false; + for(; it != new_infos.screen_infos.cend() && !found; ++it) + found = found || it->display_id == screens_[i]->DisplayId(); +// if (base::Contains(new_infos.screen_infos, screens_[i]->DisplayId(), +// &display::ScreenInfo::display_id)) { + if (found) { ++i; } else { WillRemoveScreen(*screens_[i]); @@ -91,8 +102,12 @@ void ScreenDetails::UpdateScreenInfosImpl(LocalDOMWindow* window, // Check if any screens have been added, and append them to `screens_`. for (const auto& info : new_infos.screen_infos) { - if (!base::Contains(screens_, info.display_id, - &ScreenDetailed::DisplayId)) { + bool found = false; + for(auto it = screens_.begin(); it != screens_.end() && !found; ++it) + found = found || (*it)->DisplayId() == info.display_id; +// if (!base::Contains(screens_, info.display_id, +// &ScreenDetailed::DisplayId)) { + if (found) { screens_.push_back(MakeGarbageCollected<ScreenDetailed>( window, info.display_id, info.is_internal, GetNewLabelIdx(info.is_internal))); diff --git a/chromium/third_party/blink/renderer/modules/webaudio/audio_param_descriptor.idl b/chromium/third_party/blink/renderer/modules/webaudio/audio_param_descriptor.idl index e1f59a04e25..5baf51a27bd 100644 --- a/chromium/third_party/blink/renderer/modules/webaudio/audio_param_descriptor.idl +++ b/chromium/third_party/blink/renderer/modules/webaudio/audio_param_descriptor.idl @@ -6,7 +6,7 @@ dictionary AudioParamDescriptor { required DOMString name; float defaultValue = 0; - float minValue = -3.4028235e38; - float maxValue = 3.4028235e38; + double minValue = -3.4028235e38; + double maxValue = 3.4028235e38; AutomationRate automationRate = "a-rate"; }; diff --git a/chromium/third_party/blink/renderer/modules/webaudio/biquad_dsp_kernel.cc b/chromium/third_party/blink/renderer/modules/webaudio/biquad_dsp_kernel.cc index 5c4999f0c9e..8f35a187243 100644 --- a/chromium/third_party/blink/renderer/modules/webaudio/biquad_dsp_kernel.cc +++ b/chromium/third_party/blink/renderer/modules/webaudio/biquad_dsp_kernel.cc @@ -52,10 +52,10 @@ bool HasConstantValues(float* values, int frames_to_process) { void BiquadDSPKernel::UpdateCoefficientsIfNecessary(int frames_to_process) { if (GetBiquadProcessor()->FilterCoefficientsDirty()) { - float cutoff_frequency[RenderQuantumFrames()]; - float q[RenderQuantumFrames()]; - float gain[RenderQuantumFrames()]; - float detune[RenderQuantumFrames()]; // in Cents + Vector<float> cutoff_frequency(RenderQuantumFrames()); + Vector<float> q(RenderQuantumFrames()); + Vector<float> gain(RenderQuantumFrames()); + Vector<float> detune(RenderQuantumFrames()); // in Cents SECURITY_CHECK(static_cast<unsigned>(frames_to_process) <= RenderQuantumFrames()); @@ -63,32 +63,32 @@ void BiquadDSPKernel::UpdateCoefficientsIfNecessary(int frames_to_process) { if (GetBiquadProcessor()->HasSampleAccurateValues() && GetBiquadProcessor()->IsAudioRate()) { GetBiquadProcessor()->Parameter1().CalculateSampleAccurateValues( - cutoff_frequency, frames_to_process); + cutoff_frequency.data(), frames_to_process); GetBiquadProcessor()->Parameter2().CalculateSampleAccurateValues( - q, frames_to_process); + q.data(), frames_to_process); GetBiquadProcessor()->Parameter3().CalculateSampleAccurateValues( - gain, frames_to_process); + gain.data(), frames_to_process); GetBiquadProcessor()->Parameter4().CalculateSampleAccurateValues( - detune, frames_to_process); + detune.data(), frames_to_process); // If all the values are actually constant for this render (or the // automation rate is "k-rate" for all of the AudioParams), we don't need // to compute filter coefficients for each frame since they would be the // same as the first. bool isConstant = - HasConstantValues(cutoff_frequency, frames_to_process) && - HasConstantValues(q, frames_to_process) && - HasConstantValues(gain, frames_to_process) && - HasConstantValues(detune, frames_to_process); + HasConstantValues(cutoff_frequency.data(), frames_to_process) && + HasConstantValues(q.data(), frames_to_process) && + HasConstantValues(gain.data(), frames_to_process) && + HasConstantValues(detune.data(), frames_to_process); - UpdateCoefficients(isConstant ? 1 : frames_to_process, cutoff_frequency, - q, gain, detune); + UpdateCoefficients(isConstant ? 1 : frames_to_process, cutoff_frequency.data(), + q.data(), gain.data(), detune.data()); } else { cutoff_frequency[0] = GetBiquadProcessor()->Parameter1().FinalValue(); q[0] = GetBiquadProcessor()->Parameter2().FinalValue(); gain[0] = GetBiquadProcessor()->Parameter3().FinalValue(); detune[0] = GetBiquadProcessor()->Parameter4().FinalValue(); - UpdateCoefficients(1, cutoff_frequency, q, gain, detune); + UpdateCoefficients(1, cutoff_frequency.data(), q.data(), gain.data(), detune.data()); } } } diff --git a/chromium/third_party/blink/renderer/modules/webaudio/biquad_processor.cc b/chromium/third_party/blink/renderer/modules/webaudio/biquad_processor.cc index 8853a6c3409..4d50582f023 100644 --- a/chromium/third_party/blink/renderer/modules/webaudio/biquad_processor.cc +++ b/chromium/third_party/blink/renderer/modules/webaudio/biquad_processor.cc @@ -142,12 +142,12 @@ void BiquadProcessor::Process(const AudioBus* source, void BiquadProcessor::ProcessOnlyAudioParams(uint32_t frames_to_process) { DCHECK_LE(frames_to_process, RenderQuantumFrames()); - float values[RenderQuantumFrames()]; + Vector<float> values(RenderQuantumFrames()); - parameter1_->CalculateSampleAccurateValues(values, frames_to_process); - parameter2_->CalculateSampleAccurateValues(values, frames_to_process); - parameter3_->CalculateSampleAccurateValues(values, frames_to_process); - parameter4_->CalculateSampleAccurateValues(values, frames_to_process); + parameter1_->CalculateSampleAccurateValues(values.data(), frames_to_process); + parameter2_->CalculateSampleAccurateValues(values.data(), frames_to_process); + parameter3_->CalculateSampleAccurateValues(values.data(), frames_to_process); + parameter4_->CalculateSampleAccurateValues(values.data(), frames_to_process); } void BiquadProcessor::SetType(FilterType type) { diff --git a/chromium/third_party/blink/renderer/modules/webaudio/delay_dsp_kernel.cc b/chromium/third_party/blink/renderer/modules/webaudio/delay_dsp_kernel.cc index e41ae1dc4e3..6a301f9ceed 100644 --- a/chromium/third_party/blink/renderer/modules/webaudio/delay_dsp_kernel.cc +++ b/chromium/third_party/blink/renderer/modules/webaudio/delay_dsp_kernel.cc @@ -66,10 +66,10 @@ bool DelayDSPKernel::IsAudioRate() { void DelayDSPKernel::ProcessOnlyAudioParams(uint32_t frames_to_process) { DCHECK_LE(frames_to_process, RenderQuantumFrames()); - float values[RenderQuantumFrames()]; + Vector<float> values(RenderQuantumFrames()); GetDelayProcessor()->DelayTime().CalculateSampleAccurateValues( - values, frames_to_process); + values.data(), frames_to_process); } } // namespace blink diff --git a/chromium/third_party/blink/renderer/modules/webaudio/delay_processor.cc b/chromium/third_party/blink/renderer/modules/webaudio/delay_processor.cc index 5b278bde5d9..6ed4ca5b8ed 100644 --- a/chromium/third_party/blink/renderer/modules/webaudio/delay_processor.cc +++ b/chromium/third_party/blink/renderer/modules/webaudio/delay_processor.cc @@ -54,9 +54,9 @@ std::unique_ptr<AudioDSPKernel> DelayProcessor::CreateKernel() { void DelayProcessor::ProcessOnlyAudioParams(uint32_t frames_to_process) { DCHECK_LE(frames_to_process, RenderQuantumFrames()); - float values[RenderQuantumFrames()]; + Vector<float> values(RenderQuantumFrames()); - delay_time_->CalculateSampleAccurateValues(values, frames_to_process); + delay_time_->CalculateSampleAccurateValues(values.data(), frames_to_process); } } // namespace blink diff --git a/chromium/third_party/blink/renderer/modules/webaudio/dynamics_compressor_handler.cc b/chromium/third_party/blink/renderer/modules/webaudio/dynamics_compressor_handler.cc index f6ebd11a62d..105157f4673 100644 --- a/chromium/third_party/blink/renderer/modules/webaudio/dynamics_compressor_handler.cc +++ b/chromium/third_party/blink/renderer/modules/webaudio/dynamics_compressor_handler.cc @@ -92,13 +92,13 @@ void DynamicsCompressorHandler::ProcessOnlyAudioParams( DCHECK(Context()->IsAudioThread()); DCHECK_LE(frames_to_process, GetDeferredTaskHandler().RenderQuantumFrames()); - float values[GetDeferredTaskHandler().RenderQuantumFrames()]; + std::vector<float> values(GetDeferredTaskHandler().RenderQuantumFrames()); - threshold_->CalculateSampleAccurateValues(values, frames_to_process); - knee_->CalculateSampleAccurateValues(values, frames_to_process); - ratio_->CalculateSampleAccurateValues(values, frames_to_process); - attack_->CalculateSampleAccurateValues(values, frames_to_process); - release_->CalculateSampleAccurateValues(values, frames_to_process); + threshold_->CalculateSampleAccurateValues(values.data(), frames_to_process); + knee_->CalculateSampleAccurateValues(values.data(), frames_to_process); + ratio_->CalculateSampleAccurateValues(values.data(), frames_to_process); + attack_->CalculateSampleAccurateValues(values.data(), frames_to_process); + release_->CalculateSampleAccurateValues(values.data(), frames_to_process); } void DynamicsCompressorHandler::Initialize() { diff --git a/chromium/third_party/blink/renderer/modules/webaudio/gain_handler.cc b/chromium/third_party/blink/renderer/modules/webaudio/gain_handler.cc index affef5a78bd..0edefe0bdfd 100644 --- a/chromium/third_party/blink/renderer/modules/webaudio/gain_handler.cc +++ b/chromium/third_party/blink/renderer/modules/webaudio/gain_handler.cc @@ -79,9 +79,9 @@ void GainHandler::ProcessOnlyAudioParams(uint32_t frames_to_process) { DCHECK(Context()->IsAudioThread()); DCHECK_LE(frames_to_process, GetDeferredTaskHandler().RenderQuantumFrames()); - float values[GetDeferredTaskHandler().RenderQuantumFrames()]; + std::vector<float> values(GetDeferredTaskHandler().RenderQuantumFrames()); - gain_->CalculateSampleAccurateValues(values, frames_to_process); + gain_->CalculateSampleAccurateValues(values.data(), frames_to_process); } // As soon as we know the channel count of our input, we can lazily initialize. diff --git a/chromium/third_party/blink/renderer/modules/webaudio/panner_handler.cc b/chromium/third_party/blink/renderer/modules/webaudio/panner_handler.cc index e4994c79cef..a08d3bfd717 100644 --- a/chromium/third_party/blink/renderer/modules/webaudio/panner_handler.cc +++ b/chromium/third_party/blink/renderer/modules/webaudio/panner_handler.cc @@ -221,22 +221,22 @@ void PannerHandler::ProcessSampleAccurateValues(AudioBus* destination, // Get the sample accurate values from all of the AudioParams, including the // values from the AudioListener. - float panner_x[GetDeferredTaskHandler().RenderQuantumFrames()]; - float panner_y[GetDeferredTaskHandler().RenderQuantumFrames()]; - float panner_z[GetDeferredTaskHandler().RenderQuantumFrames()]; - - float orientation_x[GetDeferredTaskHandler().RenderQuantumFrames()]; - float orientation_y[GetDeferredTaskHandler().RenderQuantumFrames()]; - float orientation_z[GetDeferredTaskHandler().RenderQuantumFrames()]; - - position_x_->CalculateSampleAccurateValues(panner_x, frames_to_process); - position_y_->CalculateSampleAccurateValues(panner_y, frames_to_process); - position_z_->CalculateSampleAccurateValues(panner_z, frames_to_process); - orientation_x_->CalculateSampleAccurateValues(orientation_x, + std::vector<float> panner_x(GetDeferredTaskHandler().RenderQuantumFrames()); + std::vector<float> panner_y(GetDeferredTaskHandler().RenderQuantumFrames()); + std::vector<float> panner_z(GetDeferredTaskHandler().RenderQuantumFrames()); + + std::vector<float> orientation_x(GetDeferredTaskHandler().RenderQuantumFrames()); + std::vector<float> orientation_y(GetDeferredTaskHandler().RenderQuantumFrames()); + std::vector<float> orientation_z(GetDeferredTaskHandler().RenderQuantumFrames()); + + position_x_->CalculateSampleAccurateValues(panner_x.data(), frames_to_process); + position_y_->CalculateSampleAccurateValues(panner_y.data(), frames_to_process); + position_z_->CalculateSampleAccurateValues(panner_z.data(), frames_to_process); + orientation_x_->CalculateSampleAccurateValues(orientation_x.data(), frames_to_process); - orientation_y_->CalculateSampleAccurateValues(orientation_y, + orientation_y_->CalculateSampleAccurateValues(orientation_y.data(), frames_to_process); - orientation_z_->CalculateSampleAccurateValues(orientation_z, + orientation_z_->CalculateSampleAccurateValues(orientation_z.data(), frames_to_process); // Get the automation values from the listener. @@ -263,9 +263,9 @@ void PannerHandler::ProcessSampleAccurateValues(AudioBus* destination, listener->GetUpZValues(GetDeferredTaskHandler().RenderQuantumFrames()); // Compute the azimuth, elevation, and total gains for each position. - double azimuth[GetDeferredTaskHandler().RenderQuantumFrames()]; - double elevation[GetDeferredTaskHandler().RenderQuantumFrames()]; - float total_gain[GetDeferredTaskHandler().RenderQuantumFrames()]; + std::vector<double> azimuth(GetDeferredTaskHandler().RenderQuantumFrames()); + std::vector<double> elevation(GetDeferredTaskHandler().RenderQuantumFrames()); + std::vector<float> total_gain(GetDeferredTaskHandler().RenderQuantumFrames()); for (unsigned k = 0; k < frames_to_process; ++k) { gfx::Point3F panner_position(panner_x[k], panner_y[k], panner_z[k]); @@ -290,25 +290,25 @@ void PannerHandler::ProcessSampleAccurateValues(AudioBus* destination, cached_distance_cone_gain_ = total_gain[frames_to_process - 1]; } - panner_->PanWithSampleAccurateValues(azimuth, elevation, source, destination, + panner_->PanWithSampleAccurateValues(azimuth.data(), elevation.data(), source, destination, frames_to_process, InternalChannelInterpretation()); - destination->CopyWithSampleAccurateGainValuesFrom(*destination, total_gain, + destination->CopyWithSampleAccurateGainValuesFrom(*destination, total_gain.data(), frames_to_process); } void PannerHandler::ProcessOnlyAudioParams(uint32_t frames_to_process) { - float values[GetDeferredTaskHandler().RenderQuantumFrames()]; + std::vector<float> values(GetDeferredTaskHandler().RenderQuantumFrames()); DCHECK_LE(frames_to_process, GetDeferredTaskHandler().RenderQuantumFrames()); - position_x_->CalculateSampleAccurateValues(values, frames_to_process); - position_y_->CalculateSampleAccurateValues(values, frames_to_process); - position_z_->CalculateSampleAccurateValues(values, frames_to_process); + position_x_->CalculateSampleAccurateValues(values.data(), frames_to_process); + position_y_->CalculateSampleAccurateValues(values.data(), frames_to_process); + position_z_->CalculateSampleAccurateValues(values.data(), frames_to_process); - orientation_x_->CalculateSampleAccurateValues(values, frames_to_process); - orientation_y_->CalculateSampleAccurateValues(values, frames_to_process); - orientation_z_->CalculateSampleAccurateValues(values, frames_to_process); + orientation_x_->CalculateSampleAccurateValues(values.data(), frames_to_process); + orientation_y_->CalculateSampleAccurateValues(values.data(), frames_to_process); + orientation_z_->CalculateSampleAccurateValues(values.data(), frames_to_process); } void PannerHandler::Initialize() { diff --git a/chromium/third_party/blink/renderer/modules/webaudio/stereo_panner_handler.cc b/chromium/third_party/blink/renderer/modules/webaudio/stereo_panner_handler.cc index df6832f232d..c935872a6c0 100644 --- a/chromium/third_party/blink/renderer/modules/webaudio/stereo_panner_handler.cc +++ b/chromium/third_party/blink/renderer/modules/webaudio/stereo_panner_handler.cc @@ -91,10 +91,10 @@ void StereoPannerHandler::Process(uint32_t frames_to_process) { } void StereoPannerHandler::ProcessOnlyAudioParams(uint32_t frames_to_process) { - float values[GetDeferredTaskHandler().RenderQuantumFrames()]; + std::vector<float> values(GetDeferredTaskHandler().RenderQuantumFrames()); DCHECK_LE(frames_to_process, GetDeferredTaskHandler().RenderQuantumFrames()); - pan_->CalculateSampleAccurateValues(values, frames_to_process); + pan_->CalculateSampleAccurateValues(values.data(), frames_to_process); } void StereoPannerHandler::Initialize() { diff --git a/chromium/third_party/blink/renderer/modules/webgpu/gpu_sampler_descriptor.idl b/chromium/third_party/blink/renderer/modules/webgpu/gpu_sampler_descriptor.idl index 36b0705d761..709818c8f5c 100644 --- a/chromium/third_party/blink/renderer/modules/webgpu/gpu_sampler_descriptor.idl +++ b/chromium/third_party/blink/renderer/modules/webgpu/gpu_sampler_descriptor.idl @@ -11,8 +11,8 @@ dictionary GPUSamplerDescriptor : GPUObjectDescriptorBase { GPUFilterMode magFilter = "nearest"; GPUFilterMode minFilter = "nearest"; GPUFilterMode mipmapFilter = "nearest"; - float lodMinClamp = 0; - float lodMaxClamp = 0xffffffff; + float lodMinClamp = 0.0; + float lodMaxClamp = 4294967295.0; GPUCompareFunction compare; [Clamp] unsigned short maxAnisotropy = 1; }; diff --git a/chromium/third_party/blink/renderer/platform/audio/audio_bus.cc b/chromium/third_party/blink/renderer/platform/audio/audio_bus.cc index 9a4d9235368..071471b36dc 100644 --- a/chromium/third_party/blink/renderer/platform/audio/audio_bus.cc +++ b/chromium/third_party/blink/renderer/platform/audio/audio_bus.cc @@ -698,7 +698,12 @@ scoped_refptr<AudioBus> AudioBus::CreateByMixingToMono( } bool AudioBus::IsSilent() const { - return base::ranges::all_of(channels_, &AudioChannel::IsSilent); + for (const AudioChannel& channel : channels_) { + if (!channel.IsSilent()) + return false; + } + return true; +// return base::ranges::all_of(channels_, &AudioChannel::IsSilent); } void AudioBus::ClearSilentFlag() { diff --git a/chromium/third_party/blink/renderer/platform/fonts/opentype/open_type_math_support.cc b/chromium/third_party/blink/renderer/platform/fonts/opentype/open_type_math_support.cc index 4660a184206..8d427af5214 100644 --- a/chromium/third_party/blink/renderer/platform/fonts/opentype/open_type_math_support.cc +++ b/chromium/third_party/blink/renderer/platform/fonts/opentype/open_type_math_support.cc @@ -23,7 +23,7 @@ float HarfBuzzUnitsToFloat(hb_position_t value) { // Latin Modern, STIX Two, XITS, Asana, Deja Vu, Libertinus and TeX Gyre fonts // provide at most 13 size variant and 5 assembly parts. // See https://chromium-review.googlesource.com/c/chromium/src/+/2074678 -unsigned kMaxHarfBuzzRecords = 20; +constexpr unsigned kMaxHarfBuzzRecords = 20; hb_direction_t HarfBuzzDirection( blink::OpenTypeMathStretchData::StretchAxis stretch_axis) { diff --git a/chromium/third_party/blink/renderer/platform/fonts/shaping/shape_result.cc b/chromium/third_party/blink/renderer/platform/fonts/shaping/shape_result.cc index 13f3747828b..d02e5b82749 100644 --- a/chromium/third_party/blink/renderer/platform/fonts/shaping/shape_result.cc +++ b/chromium/third_party/blink/renderer/platform/fonts/shaping/shape_result.cc @@ -1197,15 +1197,17 @@ void ShapeResult::InsertRun(scoped_refptr<ShapeResult::RunInfo> run) { // The runs are stored in result->m_runs in visual order. For LTR, we place // the run to be inserted before the next run with a bigger character start // index. - const auto ltr_comparer = [](scoped_refptr<RunInfo>& run, - unsigned start_index) { + const std::function<bool(scoped_refptr<RunInfo>&,unsigned)> + ltr_comparer = [](scoped_refptr<RunInfo>& run, + unsigned start_index) { return run->start_index_ < start_index; }; // For RTL, we place the run before the next run with a lower character // index. Otherwise, for both directions, at the end. - const auto rtl_comparer = [](scoped_refptr<RunInfo>& run, - unsigned start_index) { + const std::function<bool(scoped_refptr<RunInfo>&,unsigned)> + rtl_comparer = [](scoped_refptr<RunInfo>& run, + unsigned start_index) { return run->start_index_ > start_index; }; diff --git a/chromium/third_party/blink/renderer/platform/graphics/dark_mode_filter.cc b/chromium/third_party/blink/renderer/platform/graphics/dark_mode_filter.cc index 3165d670a7d..f59257eed7b 100644 --- a/chromium/third_party/blink/renderer/platform/graphics/dark_mode_filter.cc +++ b/chromium/third_party/blink/renderer/platform/graphics/dark_mode_filter.cc @@ -92,7 +92,8 @@ class DarkModeInvertedColorCache { return it->second; SkColor inverted_color = filter->InvertColor(color); - cache_.Put(key, static_cast<SkColor>(inverted_color)); + SkColor copy = inverted_color; + cache_.Put(key, std::move(copy)); return inverted_color; } diff --git a/chromium/third_party/blink/renderer/platform/graphics/dark_mode_lab_color_space.h b/chromium/third_party/blink/renderer/platform/graphics/dark_mode_lab_color_space.h index 999c3e5b58a..602c2e73484 100644 --- a/chromium/third_party/blink/renderer/platform/graphics/dark_mode_lab_color_space.h +++ b/chromium/third_party/blink/renderer/platform/graphics/dark_mode_lab_color_space.h @@ -61,7 +61,7 @@ class DarkModeSRGBColorSpace { } SkV3 FromLinear(const SkV3& v) const { - auto OETF = [](float u) { + auto OETF = [](float u) -> float { return (u < 0.0031308f ? Clamp(12.92f * u, 0.0f, 1.0f) : Clamp(1.055f * std::pow(u, 1.0f / 2.4f) - 0.055f, 0.0f, 1.0f)); @@ -144,7 +144,7 @@ class DarkModeLABColorSpace { // See // https://en.wikipedia.org/wiki/CIELAB_color_space#Forward_transformation. SkV3 ToXYZ(const SkV3& lab) const { - auto invf = [](float x) { + auto invf = [](float x) -> float { return x > kSigma ? pow(x, 3.0f) : 3.0f * kSigma2 * (x - 4.0f / 29.0f); }; diff --git a/chromium/third_party/blink/renderer/platform/graphics/paint/display_item_list.h b/chromium/third_party/blink/renderer/platform/graphics/paint/display_item_list.h index 7400096c80d..d1c0cbd2b72 100644 --- a/chromium/third_party/blink/renderer/platform/graphics/paint/display_item_list.h +++ b/chromium/third_party/blink/renderer/platform/graphics/paint/display_item_list.h @@ -224,9 +224,9 @@ class PLATFORM_EXPORT DisplayItemList { #endif // DCHECK_IS_ON() private: - static_assert(std::is_trivially_copyable<value_type>::value, - "DisplayItemList uses `memcpy` in several member functions; " - "the `value_type` used by it must be trivially copyable"); +// static_assert(std::is_trivially_copyable<value_type>::value, +// "DisplayItemList uses `memcpy` in several member functions; " +// "the `value_type` used by it must be trivially copyable"); ItemSlot* AllocateItemSlot() { return &items_.emplace_back(); } diff --git a/chromium/third_party/blink/renderer/platform/heap/collection_support/heap_hash_table_backing.h b/chromium/third_party/blink/renderer/platform/heap/collection_support/heap_hash_table_backing.h index 31e2e53f4e9..8ca91dc0c9b 100644 --- a/chromium/third_party/blink/renderer/platform/heap/collection_support/heap_hash_table_backing.h +++ b/chromium/third_party/blink/renderer/platform/heap/collection_support/heap_hash_table_backing.h @@ -45,6 +45,8 @@ class HeapHashTableBacking final ALWAYS_INLINE static ClassType* FromArray(ValueType* array) { return reinterpret_cast<ClassType*>(array); } + void operator delete(void* p) { delete (WTF::ConditionalDestructor<HeapHashTableBacking<Table>, + std::is_trivially_destructible<typename Table::ValueType>::value>*)p; } void Free(cppgc::HeapHandle& heap_handle) { cppgc::subtle::FreeUnreferencedObject(heap_handle, *this); diff --git a/chromium/third_party/blink/renderer/platform/heap/collection_support/heap_vector.h b/chromium/third_party/blink/renderer/platform/heap/collection_support/heap_vector.h index 1c460fcc983..e67fe561fb4 100644 --- a/chromium/third_party/blink/renderer/platform/heap/collection_support/heap_vector.h +++ b/chromium/third_party/blink/renderer/platform/heap/collection_support/heap_vector.h @@ -23,6 +23,9 @@ class HeapVector final : public GarbageCollected<HeapVector<T, inlineCapacity>>, public: HeapVector() = default; + void operator delete(void* p) { delete + (Vector<T, inlineCapacity, HeapAllocator>*)p; } + explicit HeapVector(wtf_size_t size) : Vector<T, inlineCapacity, HeapAllocator>(size) { CheckType(); diff --git a/chromium/third_party/blink/renderer/platform/heap/collection_support/heap_vector_backing.h b/chromium/third_party/blink/renderer/platform/heap/collection_support/heap_vector_backing.h index 8951fdeceaa..ef82cbaafe0 100644 --- a/chromium/third_party/blink/renderer/platform/heap/collection_support/heap_vector_backing.h +++ b/chromium/third_party/blink/renderer/platform/heap/collection_support/heap_vector_backing.h @@ -53,6 +53,10 @@ class HeapVectorBacking final return reinterpret_cast<ClassType*>(payload); } + void operator delete(void* p) { delete + (WTF::ConditionalDestructor<HeapVectorBacking<T, Traits>, + !Traits::kNeedsDestruction>*)p; } + void Free(cppgc::HeapHandle& heap_handle) { cppgc::subtle::FreeUnreferencedObject(heap_handle, *this); } diff --git a/chromium/third_party/blink/renderer/platform/heap/heap_allocator_impl.h b/chromium/third_party/blink/renderer/platform/heap/heap_allocator_impl.h index d4901fac946..5aa0a6c3402 100644 --- a/chromium/third_party/blink/renderer/platform/heap/heap_allocator_impl.h +++ b/chromium/third_party/blink/renderer/platform/heap/heap_allocator_impl.h @@ -87,6 +87,11 @@ class PLATFORM_EXPORT HeapAllocator { } template <typename T> + static void Free(T* array) { +// UNREACHABLE(); + } + + template <typename T> static bool ExpandVectorBacking(T* array, size_t new_size) { DCHECK(array); return HeapVectorBacking<T>::FromArray(array)->Resize(new_size); diff --git a/chromium/third_party/blink/renderer/platform/wtf/math_extras.h b/chromium/third_party/blink/renderer/platform/wtf/math_extras.h index 2876f9ec96a..d82f924eb70 100644 --- a/chromium/third_party/blink/renderer/platform/wtf/math_extras.h +++ b/chromium/third_party/blink/renderer/platform/wtf/math_extras.h @@ -128,11 +128,11 @@ constexpr float Grad2turn(float g) { return g * (1.0f / 400.0f); } -constexpr double RoundHalfTowardsPositiveInfinity(double value) { +inline double RoundHalfTowardsPositiveInfinity(double value) { return std::floor(value + 0.5); } -constexpr float RoundHalfTowardsPositiveInfinity(float value) { +inline float RoundHalfTowardsPositiveInfinity(float value) { return std::floor(value + 0.5f); } diff --git a/chromium/third_party/devtools-frontend/src/inspector_overlay/BUILD.gn b/chromium/third_party/devtools-frontend/src/inspector_overlay/BUILD.gn index 332a28a9de3..1e701a29296 100644 --- a/chromium/third_party/devtools-frontend/src/inspector_overlay/BUILD.gn +++ b/chromium/third_party/devtools-frontend/src/inspector_overlay/BUILD.gn @@ -42,7 +42,7 @@ action("build_inspector_overlay") { args = [ "main.js", - "70000", # max_size in bytes + "80000", # max_size in bytes "--input_path", rebase_path(target_gen_dir, root_build_dir), "--output_path", diff --git a/chromium/third_party/expat/BUILD.gn b/chromium/third_party/expat/BUILD.gn index eee80a6bd81..b85713969d7 100644 --- a/chromium/third_party/expat/BUILD.gn +++ b/chromium/third_party/expat/BUILD.gn @@ -26,14 +26,16 @@ if (((is_linux && !is_castos) || is_chromeos) && !use_fuzzing_engine) { defines = [ "XML_STATIC" ] } config("expat_internal_config") { - cflags = [ - # xmlparse.c has some |if (0 && ...)| statements. - "-Wno-unreachable-code", + if (is_clang || !is_win) { + cflags = [ + # xmlparse.c has some |if (0 && ...)| statements. + "-Wno-unreachable-code", - # Various files have fallthrough annotated with comments instead of - # attributes, and switching to attributes is difficult. - "-Wno-implicit-fallthrough", - ] + # Various files have fallthrough annotated with comments instead of + # attributes, and switching to attributes is difficult. + "-Wno-implicit-fallthrough", + ] + } } static_library("expat") { diff --git a/chromium/third_party/ffmpeg/chromium/config/Chrome/win-msvc/x64/config.h b/chromium/third_party/ffmpeg/chromium/config/Chrome/win-msvc/x64/config.h index 359682176ab..7c4ecc4481a 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chrome/win-msvc/x64/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chrome/win-msvc/x64/config.h @@ -859,6 +859,7 @@ #define CONFIG_SCPR_DECODER 0 #define CONFIG_SCREENPRESSO_DECODER 0 #define CONFIG_SDX2_DPCM_DECODER 0 +#define CONFIG_SGA_DECODER 0 #define CONFIG_SGI_DECODER 0 #define CONFIG_SGIRLE_DECODER 0 #define CONFIG_SHEERVIDEO_DECODER 0 @@ -905,6 +906,7 @@ #define CONFIG_VMDVIDEO_DECODER 0 #define CONFIG_VMNC_DECODER 0 #define CONFIG_VP3_DECODER 1 +#define CONFIG_VP4_DECODER 0 #define CONFIG_VP5_DECODER 0 #define CONFIG_VP6_DECODER 0 #define CONFIG_VP6A_DECODER 0 @@ -1055,6 +1057,7 @@ #define CONFIG_PCM_S32LE_PLANAR_DECODER 0 #define CONFIG_PCM_S64BE_DECODER 0 #define CONFIG_PCM_S64LE_DECODER 0 +#define CONFIG_PCM_SGA_DECODER 0 #define CONFIG_PCM_U8_DECODER 1 #define CONFIG_PCM_U16BE_DECODER 0 #define CONFIG_PCM_U16LE_DECODER 0 @@ -2089,6 +2092,7 @@ #define CONFIG_SDS_DEMUXER 0 #define CONFIG_SDX_DEMUXER 0 #define CONFIG_SEGAFILM_DEMUXER 0 +#define CONFIG_SGA_DEMUXER 0 #define CONFIG_SHORTEN_DEMUXER 0 #define CONFIG_SIFF_DEMUXER 0 #define CONFIG_SLN_DEMUXER 0 diff --git a/chromium/third_party/ffmpeg/chromium/config/Chromium/win-msvc/x64/config.h b/chromium/third_party/ffmpeg/chromium/config/Chromium/win-msvc/x64/config.h index 89d69e47347..9e44a8b3cf6 100644 --- a/chromium/third_party/ffmpeg/chromium/config/Chromium/win-msvc/x64/config.h +++ b/chromium/third_party/ffmpeg/chromium/config/Chromium/win-msvc/x64/config.h @@ -859,6 +859,7 @@ #define CONFIG_SCPR_DECODER 0 #define CONFIG_SCREENPRESSO_DECODER 0 #define CONFIG_SDX2_DPCM_DECODER 0 +#define CONFIG_SGA_DECODER 0 #define CONFIG_SGI_DECODER 0 #define CONFIG_SGIRLE_DECODER 0 #define CONFIG_SHEERVIDEO_DECODER 0 @@ -905,6 +906,7 @@ #define CONFIG_VMDVIDEO_DECODER 0 #define CONFIG_VMNC_DECODER 0 #define CONFIG_VP3_DECODER 1 +#define CONFIG_VP4_DECODER 0 #define CONFIG_VP5_DECODER 0 #define CONFIG_VP6_DECODER 0 #define CONFIG_VP6A_DECODER 0 @@ -1055,6 +1057,7 @@ #define CONFIG_PCM_S32LE_PLANAR_DECODER 0 #define CONFIG_PCM_S64BE_DECODER 0 #define CONFIG_PCM_S64LE_DECODER 0 +#define CONFIG_PCM_SGA_DECODER 0 #define CONFIG_PCM_U8_DECODER 1 #define CONFIG_PCM_U16BE_DECODER 0 #define CONFIG_PCM_U16LE_DECODER 0 @@ -2089,6 +2092,7 @@ #define CONFIG_SDS_DEMUXER 0 #define CONFIG_SDX_DEMUXER 0 #define CONFIG_SEGAFILM_DEMUXER 0 +#define CONFIG_SGA_DEMUXER 0 #define CONFIG_SHORTEN_DEMUXER 0 #define CONFIG_SIFF_DEMUXER 0 #define CONFIG_SLN_DEMUXER 0 diff --git a/chromium/third_party/ffmpeg/ffmpeg_options.gni b/chromium/third_party/ffmpeg/ffmpeg_options.gni index b5af9dbd367..2d1f65bd780 100644 --- a/chromium/third_party/ffmpeg/ffmpeg_options.gni +++ b/chromium/third_party/ffmpeg/ffmpeg_options.gni @@ -49,7 +49,7 @@ declare_args() { # Some background: https://bugs.llvm.org/show_bug.cgi?id=26828 use_system_ffmpeg = false - ffmpeg_use_unsafe_atomics = false + ffmpeg_use_unsafe_atomics = is_win && !is_clang } assert(ffmpeg_branding == "Chromium" || diff --git a/chromium/third_party/libgav1/BUILD.gn b/chromium/third_party/libgav1/BUILD.gn index e4d870b997b..e9d5bc2a2e4 100644 --- a/chromium/third_party/libgav1/BUILD.gn +++ b/chromium/third_party/libgav1/BUILD.gn @@ -80,7 +80,9 @@ if (enable_libgav1_decoder || use_libgav1_parser) { public_configs = [ ":public_libgav1_config" ] if (current_cpu == "x86" || current_cpu == "x64") { - cflags = [ "-msse4.1" ] + if (!is_win || is_clang) { + cflags = [ "-msse4.1" ] + } } sources = gav1_dsp_sse4_sources + gav1_dsp_sse4_headers_sources + diff --git a/chromium/third_party/libjxl/BUILD.gn b/chromium/third_party/libjxl/BUILD.gn index 3aab8f5e15d..e38c1479d92 100644 --- a/chromium/third_party/libjxl/BUILD.gn +++ b/chromium/third_party/libjxl/BUILD.gn @@ -19,10 +19,12 @@ config("libjxl_external_config") { source_set("libjxl") { sources = rebase_path(libjxl_dec_sources, ".", "src/lib") - cflags_cc = [ - "-Wno-shadow", - "-Wno-unused-function", - ] + if (is_clang || !is_win) { + cflags_cc = [ + "-Wno-shadow", + "-Wno-unused-function", + ] + } defines = libjxl_version_defines + [ "JPEGXL_ENABLE_SKCMS=1", diff --git a/chromium/third_party/liburlpattern/BUILD.gn b/chromium/third_party/liburlpattern/BUILD.gn index 00236696212..d7535228720 100644 --- a/chromium/third_party/liburlpattern/BUILD.gn +++ b/chromium/third_party/liburlpattern/BUILD.gn @@ -6,7 +6,9 @@ import("//testing/libfuzzer/fuzzer_test.gni") import("//testing/test.gni") config("warnings") { - cflags = [ "-Wno-shadow" ] + if(is_clang || !is_win) { + cflags = [ "-Wno-shadow" ] + } } component("liburlpattern") { diff --git a/chromium/third_party/perfetto/src/trace_processor/timestamped_trace_piece.h b/chromium/third_party/perfetto/src/trace_processor/timestamped_trace_piece.h index b35601228df..2828ad11ab8 100644 --- a/chromium/third_party/perfetto/src/trace_processor/timestamped_trace_piece.h +++ b/chromium/third_party/perfetto/src/trace_processor/timestamped_trace_piece.h @@ -182,6 +182,11 @@ struct TimestampedTracePiece { TimestampedTracePiece(const TimestampedTracePiece&) = delete; TimestampedTracePiece& operator=(const TimestampedTracePiece&) = delete; +#if PERFETTO_BUILDFLAG(PERFETTO_OS_WIN) + TimestampedTracePiece& operator=(TimestampedTracePiece&& ttp) const { + return (*const_cast<TimestampedTracePiece*>(this) = std::move(ttp)); + } +#endif ~TimestampedTracePiece() { switch (type) { diff --git a/chromium/third_party/pffft/BUILD.gn b/chromium/third_party/pffft/BUILD.gn index 0a1cf7a1f5e..bfdf8501853 100644 --- a/chromium/third_party/pffft/BUILD.gn +++ b/chromium/third_party/pffft/BUILD.gn @@ -7,7 +7,9 @@ import("//testing/libfuzzer/fuzzer_test.gni") import("//testing/test.gni") config("common_config") { - cflags = [ "-Wno-shadow" ] + if (is_clang || !is_win) { + cflags = [ "-Wno-shadow" ] + } if (is_win) { defines = [ diff --git a/chromium/third_party/skia/include/core/SkTypes.h b/chromium/third_party/skia/include/core/SkTypes.h index 8f7a2c0982b..2d85ed63551 100644 --- a/chromium/third_party/skia/include/core/SkTypes.h +++ b/chromium/third_party/skia/include/core/SkTypes.h @@ -459,10 +459,14 @@ #ifdef SK_DEBUG #define SkASSERT(cond) SkASSERT_RELEASE(cond) +#if defined(_MSC_VER) && !defined(__clang__) + #define SkASSERTF(cond, fmt, ...) SkASSERT_RELEASE(cond) +#else #define SkASSERTF(cond, fmt, ...) static_cast<void>( (cond) ? (void)0 : [&]{ \ SkDebugf(fmt"\n", ##__VA_ARGS__); \ SK_ABORT("assert(%s)", #cond); \ }() ) +#endif #define SkDEBUGFAIL(message) SK_ABORT("%s", message) #define SkDEBUGFAILF(fmt, ...) SK_ABORT(fmt, ##__VA_ARGS__) #define SkDEBUGCODE(...) __VA_ARGS__ diff --git a/chromium/third_party/snappy/win32/config.h b/chromium/third_party/snappy/win32/config.h index 511231c7df7..791150842d9 100644 --- a/chromium/third_party/snappy/win32/config.h +++ b/chromium/third_party/snappy/win32/config.h @@ -2,13 +2,13 @@ #define THIRD_PARTY_SNAPPY_OPENSOURCE_CMAKE_CONFIG_H_ /* Define to 1 if the compiler supports __attribute__((always_inline)). */ -#define HAVE_ATTRIBUTE_ALWAYS_INLINE 1 +/* #define HAVE_ATTRIBUTE_ALWAYS_INLINE 1 */ /* Define to 1 if the compiler supports __builtin_ctz and friends. */ -#define HAVE_BUILTIN_CTZ 1 +/* #define HAVE_BUILTIN_CTZ 1 */ /* Define to 1 if the compiler supports __builtin_expect. */ -#define HAVE_BUILTIN_EXPECT 1 +/* #define HAVE_BUILTIN_EXPECT 1 */ /* Define to 1 if you have a definition for mmap() in <sys/mman.h>. */ /* #undef HAVE_FUNC_MMAP */ diff --git a/chromium/third_party/webrtc/logging/rtc_event_log/events/rtc_event_alr_state.cc b/chromium/third_party/webrtc/logging/rtc_event_log/events/rtc_event_alr_state.cc index 25941eb16b4..01a4269e959 100644 --- a/chromium/third_party/webrtc/logging/rtc_event_log/events/rtc_event_alr_state.cc +++ b/chromium/third_party/webrtc/logging/rtc_event_log/events/rtc_event_alr_state.cc @@ -14,8 +14,10 @@ namespace webrtc { constexpr RtcEvent::Type RtcEventAlrState::kType; +#if !defined(WEBRTC_WIN) constexpr RtcEventDefinition<RtcEventAlrState, LoggedAlrStateEvent, bool> RtcEventAlrState::definition_; +#endif RtcEventAlrState::RtcEventAlrState(bool in_alr) : in_alr_(in_alr) {} @@ -32,7 +34,11 @@ RtcEventLogParseStatus RtcEventAlrState::Parse( absl::string_view s, bool batched, std::vector<LoggedAlrStateEvent>& output) { +#if !defined(WEBRTC_WIN) return RtcEventAlrState::definition_.ParseBatch(s, batched, output); +#else + return RtcEventLogParseStatus::Success(); +#endif } } // namespace webrtc diff --git a/chromium/third_party/webrtc/logging/rtc_event_log/events/rtc_event_alr_state.h b/chromium/third_party/webrtc/logging/rtc_event_log/events/rtc_event_alr_state.h index 9f595ecd909..9d5f08f0998 100644 --- a/chromium/third_party/webrtc/logging/rtc_event_log/events/rtc_event_alr_state.h +++ b/chromium/third_party/webrtc/logging/rtc_event_log/events/rtc_event_alr_state.h @@ -53,7 +53,11 @@ class RtcEventAlrState final : public RtcEvent { bool in_alr() const { return in_alr_; } static std::string Encode(rtc::ArrayView<const RtcEvent*> batch) { +#if !defined(WEBRTC_WIN) return RtcEventAlrState::definition_.EncodeBatch(batch); +#else + return ""; +#endif } static RtcEventLogParseStatus Parse(absl::string_view s, @@ -65,6 +69,7 @@ class RtcEventAlrState final : public RtcEvent { const bool in_alr_; +#if !defined(WEBRTC_WIN) static constexpr RtcEventDefinition<RtcEventAlrState, LoggedAlrStateEvent, bool> @@ -72,6 +77,7 @@ class RtcEventAlrState final : public RtcEvent { {&RtcEventAlrState::in_alr_, &LoggedAlrStateEvent::in_alr, {"in_alr", /*id=*/1, FieldType::kFixed8, /*width=*/1}}}; +#endif }; } // namespace webrtc diff --git a/chromium/third_party/webrtc/logging/rtc_event_log/events/rtc_event_audio_playout.cc b/chromium/third_party/webrtc/logging/rtc_event_log/events/rtc_event_audio_playout.cc index 21a3f9266cf..1bb3b1e4f52 100644 --- a/chromium/third_party/webrtc/logging/rtc_event_log/events/rtc_event_audio_playout.cc +++ b/chromium/third_party/webrtc/logging/rtc_event_log/events/rtc_event_audio_playout.cc @@ -14,10 +14,12 @@ namespace webrtc { +#if !defined(WEBRTC_WIN) constexpr RtcEventDefinition<RtcEventAudioPlayout, LoggedAudioPlayoutEvent, uint32_t> RtcEventAudioPlayout::definition_; +#endif RtcEventAudioPlayout::RtcEventAudioPlayout(uint32_t ssrc) : ssrc_(ssrc) {} diff --git a/chromium/third_party/webrtc/logging/rtc_event_log/events/rtc_event_audio_playout.h b/chromium/third_party/webrtc/logging/rtc_event_log/events/rtc_event_audio_playout.h index 196c3ca2470..c8ff9352f1e 100644 --- a/chromium/third_party/webrtc/logging/rtc_event_log/events/rtc_event_audio_playout.h +++ b/chromium/third_party/webrtc/logging/rtc_event_log/events/rtc_event_audio_playout.h @@ -53,13 +53,18 @@ class RtcEventAudioPlayout final : public RtcEvent { uint32_t ssrc() const { return ssrc_; } static std::string Encode(rtc::ArrayView<const RtcEvent*> batch) { +#if !defined(WEBRTC_WIN) return RtcEventAudioPlayout::definition_.EncodeBatch(batch); +#else + return ""; +#endif } static RtcEventLogParseStatus Parse( absl::string_view encoded_bytes, bool batched, std::map<uint32_t, std::vector<LoggedAudioPlayoutEvent>>& output) { +#if !defined(WEBRTC_WIN) std::vector<LoggedAudioPlayoutEvent> temp_output; auto status = RtcEventAudioPlayout::definition_.ParseBatch( encoded_bytes, batched, temp_output); @@ -67,6 +72,9 @@ class RtcEventAudioPlayout final : public RtcEvent { output[event.ssrc].push_back(event); } return status; +#else + return RtcEventLogParseStatus::Success(); +#endif } private: @@ -74,6 +82,7 @@ class RtcEventAudioPlayout final : public RtcEvent { const uint32_t ssrc_; +#if !defined(WEBRTC_WIN) static constexpr RtcEventDefinition<RtcEventAudioPlayout, LoggedAudioPlayoutEvent, uint32_t> @@ -81,6 +90,7 @@ class RtcEventAudioPlayout final : public RtcEvent { {&RtcEventAudioPlayout::ssrc_, &LoggedAudioPlayoutEvent::ssrc, {"ssrc", /*id=*/1, FieldType::kFixed32, /*width=*/32}}}; +#endif }; } // namespace webrtc diff --git a/chromium/third_party/webrtc/logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.cc b/chromium/third_party/webrtc/logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.cc index 0e98b2ff11d..d62ba2ee363 100644 --- a/chromium/third_party/webrtc/logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.cc +++ b/chromium/third_party/webrtc/logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.cc @@ -15,11 +15,13 @@ namespace webrtc { +#if !defined(WEBRTC_WIN) constexpr RtcEventDefinition<RtcEventBweUpdateDelayBased, LoggedBweDelayBasedUpdate, int32_t, BandwidthUsage> RtcEventBweUpdateDelayBased::definition_; +#endif RtcEventBweUpdateDelayBased::RtcEventBweUpdateDelayBased( int32_t bitrate_bps, diff --git a/chromium/third_party/webrtc/logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.h b/chromium/third_party/webrtc/logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.h index 796f1193887..de70cfe924e 100644 --- a/chromium/third_party/webrtc/logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.h +++ b/chromium/third_party/webrtc/logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.h @@ -100,15 +100,23 @@ class RtcEventBweUpdateDelayBased final : public RtcEvent { BandwidthUsage detector_state() const { return detector_state_; } static std::string Encode(rtc::ArrayView<const RtcEvent*> batch) { +#if !defined(WEBRTC_WIN) return RtcEventBweUpdateDelayBased::definition_.EncodeBatch(batch); +#else + return ""; +#endif } static RtcEventLogParseStatus Parse( absl::string_view encoded_bytes, bool batched, std::vector<LoggedBweDelayBasedUpdate>& output) { +#if !defined(WEBRTC_WIN) return RtcEventBweUpdateDelayBased::definition_.ParseBatch(encoded_bytes, batched, output); +#else + return RtcEventLogParseStatus::Success(); +#endif } private: @@ -117,6 +125,7 @@ class RtcEventBweUpdateDelayBased final : public RtcEvent { const int32_t bitrate_bps_; const BandwidthUsage detector_state_; +#if !defined(WEBRTC_WIN) static constexpr RtcEventDefinition<RtcEventBweUpdateDelayBased, LoggedBweDelayBasedUpdate, int32_t, @@ -129,6 +138,7 @@ class RtcEventBweUpdateDelayBased final : public RtcEvent { {&RtcEventBweUpdateDelayBased::detector_state_, &LoggedBweDelayBasedUpdate::detector_state, {"detector_state", /*id=*/2, FieldType::kVarInt, /*width=*/64}}}; +#endif }; } // namespace webrtc diff --git a/chromium/third_party/webrtc/modules/desktop_capture/win/full_screen_win_application_handler.cc b/chromium/third_party/webrtc/modules/desktop_capture/win/full_screen_win_application_handler.cc index f7047dba064..e026cd59a7b 100644 --- a/chromium/third_party/webrtc/modules/desktop_capture/win/full_screen_win_application_handler.cc +++ b/chromium/third_party/webrtc/modules/desktop_capture/win/full_screen_win_application_handler.cc @@ -183,6 +183,8 @@ class FullScreenPowerPointHandler : public FullScreenApplicationHandler { } }; +constexpr char FullScreenPowerPointHandler::kDocumentTitleSeparator[]; + class OpenOfficeApplicationHandler : public FullScreenApplicationHandler { public: explicit OpenOfficeApplicationHandler(DesktopCapturer::SourceId sourceId) diff --git a/chromium/tools/json_schema_compiler/manifest_parse_util.cc b/chromium/tools/json_schema_compiler/manifest_parse_util.cc index 0e9a0b373d6..bea521b3c5b 100644 --- a/chromium/tools/json_schema_compiler/manifest_parse_util.cc +++ b/chromium/tools/json_schema_compiler/manifest_parse_util.cc @@ -8,6 +8,8 @@ #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" +#include <string> + namespace json_schema_compiler { namespace manifest_parse_util { @@ -139,8 +141,15 @@ bool ParseFromDictionary(const base::DictionaryValue& dict, std::string* out, std::u16string* error, std::vector<base::StringPiece>* error_path_reversed) { - return ParseHelper(dict, key, base::Value::Type::STRING, - &base::Value::GetString, out, error, error_path_reversed); + DCHECK(out); + + const base::Value* value = + FindKeyOfType(dict, key, base::Value::Type::STRING, error, error_path_reversed); + if (!value) + return false; + + *out = value->GetString(); + return true; } } // namespace manifest_parse_util diff --git a/chromium/ui/accessibility/ax_node_position.cc b/chromium/ui/accessibility/ax_node_position.cc index 6f41e0724de..92b07159fd7 100644 --- a/chromium/ui/accessibility/ax_node_position.cc +++ b/chromium/ui/accessibility/ax_node_position.cc @@ -39,7 +39,7 @@ std::string ToString(const AXPositionKind kind) { {AXPositionKind::TREE_POSITION, "TreePosition"}, {AXPositionKind::TEXT_POSITION, "TextPosition"}}); - const auto* iter = kKindToString.find(kind); + const auto iter = kKindToString.find(kind); if (iter == std::end(kKindToString)) return std::string(); return iter->second; diff --git a/chromium/ui/accessibility/platform/inspect/ax_event_recorder_win.cc b/chromium/ui/accessibility/platform/inspect/ax_event_recorder_win.cc index 1496176faad..1ba8d8cc88b 100644 --- a/chromium/ui/accessibility/platform/inspect/ax_event_recorder_win.cc +++ b/chromium/ui/accessibility/platform/inspect/ax_event_recorder_win.cc @@ -62,7 +62,7 @@ std::string AccessibilityEventToStringUTF8(int32_t event_id) { AXEventRecorderWin* AXEventRecorderWin::instance_ = nullptr; // static -CALLBACK void AXEventRecorderWin::WinEventHookThunk(HWINEVENTHOOK handle, +void CALLBACK AXEventRecorderWin::WinEventHookThunk(HWINEVENTHOOK handle, DWORD event, HWND hwnd, LONG obj_id, diff --git a/chromium/ui/accessibility/platform/inspect/ax_event_recorder_win.h b/chromium/ui/accessibility/platform/inspect/ax_event_recorder_win.h index bac6f4ee633..bb77a89807a 100644 --- a/chromium/ui/accessibility/platform/inspect/ax_event_recorder_win.h +++ b/chromium/ui/accessibility/platform/inspect/ax_event_recorder_win.h @@ -8,6 +8,7 @@ #include <oleacc.h> #include "base/process/process_handle.h" +#include "base/win/windows_types.h" #include "ui/accessibility/ax_export.h" #include "ui/accessibility/platform/inspect/ax_event_recorder.h" #include "ui/accessibility/platform/inspect/ax_inspect.h" @@ -32,7 +33,7 @@ class AX_EXPORT AXEventRecorderWin : public ui::AXEventRecorder { ~AXEventRecorderWin() override; // Callback registered by SetWinEventHook. Just calls OnWinEventHook. - static CALLBACK void WinEventHookThunk(HWINEVENTHOOK handle, + static void CALLBACK WinEventHookThunk(HWINEVENTHOOK handle, DWORD event, HWND hwnd, LONG obj_id, diff --git a/chromium/ui/accessibility/platform/inspect/ax_event_recorder_win_uia.cc b/chromium/ui/accessibility/platform/inspect/ax_event_recorder_win_uia.cc index 94fb5230f8c..4c590daa4f0 100644 --- a/chromium/ui/accessibility/platform/inspect/ax_event_recorder_win_uia.cc +++ b/chromium/ui/accessibility/platform/inspect/ax_event_recorder_win_uia.cc @@ -113,8 +113,10 @@ void AXEventRecorderWinUia::Thread::ThreadMain() { IID_IUIAutomation, &uia_); CHECK(uia_.Get()); +#if !defined(TOOLKIT_QT) // Register the custom event to mark the end of the test. shutdown_sentinel_ = UiaRegistrarWin::GetInstance().GetTestCompleteEventId(); +#endif // Find the IUIAutomationElement for the root content window uia_->ElementFromHandle(hwnd_, &root_); diff --git a/chromium/ui/aura/BUILD.gn b/chromium/ui/aura/BUILD.gn index d29ab6245dd..fb77714bf45 100644 --- a/chromium/ui/aura/BUILD.gn +++ b/chromium/ui/aura/BUILD.gn @@ -152,9 +152,10 @@ jumbo_component("aura") { "native_window_occlusion_tracker_win.cc", "native_window_occlusion_tracker_win.h", ] + sources -= [ "input_state_lookup.cc" ] } - if (is_win) { + if (is_win && !use_qt) { sources -= [ "input_state_lookup.cc" ] deps += [ diff --git a/chromium/ui/aura/env.cc b/chromium/ui/aura/env.cc index 0268a5fec7b..4dbe4fa4919 100644 --- a/chromium/ui/aura/env.cc +++ b/chromium/ui/aura/env.cc @@ -236,7 +236,7 @@ Env::Env() : env_controller_(std::make_unique<EnvInputStateController>(this)), gesture_recognizer_(std::make_unique<ui::GestureRecognizerImpl>()), input_state_lookup_(InputStateLookup::Create()) { -#if BUILDFLAG(IS_WIN) +#if BUILDFLAG(IS_WIN) && !defined(TOOLKIT_QT) cursor_factory_ = std::make_unique<ui::WinCursorFactory>(); #endif } diff --git a/chromium/ui/aura/window_tree_host_platform.cc b/chromium/ui/aura/window_tree_host_platform.cc index 657c84103e6..a7ec249c6ed 100644 --- a/chromium/ui/aura/window_tree_host_platform.cc +++ b/chromium/ui/aura/window_tree_host_platform.cc @@ -72,7 +72,7 @@ void WindowTreeHostPlatform::CreateAndSetPlatformWindow( #if defined(USE_OZONE) platform_window_ = ui::OzonePlatform::GetInstance()->CreatePlatformWindow( this, std::move(properties)); -#elif BUILDFLAG(IS_WIN) +#elif BUILDFLAG(IS_WIN) && !defined(TOOLKIT_QT) platform_window_ = std::make_unique<ui::WinWindow>(this, properties.bounds); #else NOTIMPLEMENTED(); diff --git a/chromium/ui/base/BUILD.gn b/chromium/ui/base/BUILD.gn index ee2bbf7b96c..bed470df88e 100644 --- a/chromium/ui/base/BUILD.gn +++ b/chromium/ui/base/BUILD.gn @@ -655,6 +655,8 @@ jumbo_component("base") { "dragdrop/os_exchange_data_provider_win.h", "resource/resource_bundle_win.cc", "resource/resource_bundle_win.h", + "win/win_cursor_factory.cc", + "win/win_cursor_factory.h", ] } } diff --git a/chromium/ui/base/clipboard/clipboard_format_type.h b/chromium/ui/base/clipboard/clipboard_format_type.h index f2a3079cddd..9670428bae3 100644 --- a/chromium/ui/base/clipboard/clipboard_format_type.h +++ b/chromium/ui/base/clipboard/clipboard_format_type.h @@ -68,7 +68,7 @@ class COMPONENT_EXPORT(UI_BASE_CLIPBOARD_TYPES) ClipboardFormatType { static const ClipboardFormatType& DataTransferEndpointDataType(); #endif // BUILDFLAG(IS_CHROMEOS) -#if BUILDFLAG(IS_WIN) +#if BUILDFLAG(IS_WIN) && !defined(TOOLKIT_QT) // ANSI formats. Only Windows differentiates between ANSI and UNICODE formats // in ClipboardFormatType. Reference: // https://docs.microsoft.com/en-us/windows/win32/learnwin32/working-with-strings diff --git a/chromium/ui/base/data_transfer_policy/data_transfer_endpoint_serializer.cc b/chromium/ui/base/data_transfer_policy/data_transfer_endpoint_serializer.cc index 852096aa85d..5153a3e41b4 100644 --- a/chromium/ui/base/data_transfer_policy/data_transfer_endpoint_serializer.cc +++ b/chromium/ui/base/data_transfer_policy/data_transfer_endpoint_serializer.cc @@ -80,7 +80,7 @@ absl::optional<EndpointType> EndpointStringToType( {kClipboardHistoryString, EndpointType::kClipboardHistory}, }); - auto* it = kEndpointStringToTypeMap.find(endpoint_string); + const auto it = kEndpointStringToTypeMap.find(endpoint_string); if (it != kEndpointStringToTypeMap.end()) return it->second; diff --git a/chromium/ui/base/metadata/base_type_conversion.cc b/chromium/ui/base/metadata/base_type_conversion.cc index cf0e1804de5..ad52bf8ecd7 100644 --- a/chromium/ui/base/metadata/base_type_conversion.cc +++ b/chromium/ui/base/metadata/base_type_conversion.cc @@ -410,21 +410,21 @@ absl::optional<url::Component> TypeConverter<url::Component>::FromString( return absl::nullopt; } -std::u16string TypeConverter<UNIQUE_TYPE_NAME(SkColor)>::ToString( +std::u16string TypeConverter<SkColorUnique>::ToString( SkColor source_value) { return base::UTF8ToUTF16(color_utils::SkColorToRgbaString(source_value)); } -absl::optional<SkColor> TypeConverter<UNIQUE_TYPE_NAME(SkColor)>::FromString( +absl::optional<SkColor> TypeConverter<SkColorUnique>::FromString( const std::u16string& source_value) { return GetNextColor(source_value.cbegin(), source_value.cend()); } -ValidStrings TypeConverter<UNIQUE_TYPE_NAME(SkColor)>::GetValidStrings() { +ValidStrings TypeConverter<SkColorUnique>::GetValidStrings() { return {}; } -bool TypeConverter<UNIQUE_TYPE_NAME(SkColor)>::GetNextColor( +bool TypeConverter<SkColorUnique>::GetNextColor( std::u16string::const_iterator start, std::u16string::const_iterator end, std::u16string& color, @@ -459,7 +459,7 @@ bool TypeConverter<UNIQUE_TYPE_NAME(SkColor)>::GetNextColor( return false; } -bool TypeConverter<UNIQUE_TYPE_NAME(SkColor)>::GetNextColor( +bool TypeConverter<SkColorUnique>::GetNextColor( std::u16string::const_iterator start, std::u16string::const_iterator end, std::u16string& color) { @@ -467,7 +467,7 @@ bool TypeConverter<UNIQUE_TYPE_NAME(SkColor)>::GetNextColor( return GetNextColor(start, end, color, next_token); } -absl::optional<SkColor> TypeConverter<UNIQUE_TYPE_NAME(SkColor)>::GetNextColor( +absl::optional<SkColor> TypeConverter<SkColorUnique>::GetNextColor( std::u16string::const_iterator start, std::u16string::const_iterator end, std::u16string::const_iterator& next_token) { @@ -486,7 +486,7 @@ absl::optional<SkColor> TypeConverter<UNIQUE_TYPE_NAME(SkColor)>::GetNextColor( return absl::nullopt; } -absl::optional<SkColor> TypeConverter<UNIQUE_TYPE_NAME(SkColor)>::GetNextColor( +absl::optional<SkColor> TypeConverter<SkColorUnique>::GetNextColor( std::u16string::const_iterator start, std::u16string::const_iterator end) { std::u16string::const_iterator next_token; @@ -494,7 +494,7 @@ absl::optional<SkColor> TypeConverter<UNIQUE_TYPE_NAME(SkColor)>::GetNextColor( } absl::optional<SkColor> -TypeConverter<UNIQUE_TYPE_NAME(SkColor)>::RgbaPiecesToSkColor( +TypeConverter<SkColorUnique>::RgbaPiecesToSkColor( const std::vector<base::StringPiece16>& pieces, size_t start_piece) { int r, g, b; @@ -514,7 +514,7 @@ TypeConverter<UNIQUE_TYPE_NAME(SkColor)>::RgbaPiecesToSkColor( } absl::optional<SkColor> -TypeConverter<UNIQUE_TYPE_NAME(SkColor)>::ParseHexString( +TypeConverter<SkColorUnique>::ParseHexString( const std::u16string& hex_string) { SkColor value; if (base::HexStringToUInt(base::UTF16ToUTF8(hex_string), &value)) { @@ -527,7 +527,7 @@ TypeConverter<UNIQUE_TYPE_NAME(SkColor)>::ParseHexString( } absl::optional<SkColor> -TypeConverter<UNIQUE_TYPE_NAME(SkColor)>::ParseHslString( +TypeConverter<SkColorUnique>::ParseHslString( const std::u16string& hsl_string) { std::u16string pruned_string; base::RemoveChars(hsl_string, u"(%)hsla", &pruned_string); @@ -554,7 +554,7 @@ TypeConverter<UNIQUE_TYPE_NAME(SkColor)>::ParseHslString( } absl::optional<SkColor> -TypeConverter<UNIQUE_TYPE_NAME(SkColor)>::ParseRgbString( +TypeConverter<SkColorUnique>::ParseRgbString( const std::u16string& rgb_string) { // Declare a constant string here for use below since it might trigger an // ASAN error due to the stack temp going out of scope before the call to diff --git a/chromium/ui/base/metadata/base_type_conversion.h b/chromium/ui/base/metadata/base_type_conversion.h index bc36377042b..b8fd486738e 100644 --- a/chromium/ui/base/metadata/base_type_conversion.h +++ b/chromium/ui/base/metadata/base_type_conversion.h @@ -168,7 +168,10 @@ struct EnumStringsMap; const std::u16string& str) { \ const auto& map = EnumStringsMap<T>::Get(); \ using Pair = base::ranges::range_value_t<decltype(map)>; \ - auto* it = base::ranges::find(map, str, &Pair::second); \ + auto it = map.begin(); \ + while (it != map.end() && it->second != str) \ + ++it; \ + /*auto* it = base::ranges::find(map, str, &Pair::second);*/ \ return it != map.end() ? absl::make_optional(it->first) : absl::nullopt; \ } \ \ @@ -318,7 +321,7 @@ MAKE_TYPE_UNIQUE(SkColor); template <> struct COMPONENT_EXPORT(UI_BASE_METADATA) - TypeConverter<UNIQUE_TYPE_NAME(SkColor)> + TypeConverter<SkColorUnique> : BaseTypeConverter<true, false, kSkColorPrefix> { static std::u16string ToString(SkColor source_value); static absl::optional<SkColor> FromString(const std::u16string& source_value); @@ -367,7 +370,7 @@ struct COMPONENT_EXPORT(UI_BASE_METADATA) const std::u16string& rgb_string); }; -using SkColorConverter = TypeConverter<UNIQUE_TYPE_NAME(SkColor)>; +using SkColorConverter = TypeConverter<SkColorUnique>; } // namespace metadata } // namespace ui diff --git a/chromium/ui/base/prediction/one_euro_filter.cc b/chromium/ui/base/prediction/one_euro_filter.cc index 31a6de485b6..9b5f7dac128 100644 --- a/chromium/ui/base/prediction/one_euro_filter.cc +++ b/chromium/ui/base/prediction/one_euro_filter.cc @@ -7,13 +7,13 @@ namespace ui { -const double OneEuroFilter::kDefaultFrequency; -const double OneEuroFilter::kDefaultMincutoff; -const double OneEuroFilter::kDefaultBeta; -const double OneEuroFilter::kDefaultDcutoff; +constexpr double OneEuroFilter::kDefaultFrequency; +constexpr double OneEuroFilter::kDefaultMincutoff; +constexpr double OneEuroFilter::kDefaultBeta; +constexpr double OneEuroFilter::kDefaultDcutoff; -const char OneEuroFilter::kParamBeta[]; -const char OneEuroFilter::kParamMincutoff[]; +constexpr char OneEuroFilter::kParamBeta[]; +constexpr char OneEuroFilter::kParamMincutoff[]; OneEuroFilter::OneEuroFilter(double mincutoff, double beta) { x_filter_ = std::make_unique<one_euro_filter::OneEuroFilter>( diff --git a/chromium/ui/color/color_id_macros.inc b/chromium/ui/color/color_id_macros.inc index 55dc5898adf..0be28b7e012 100644 --- a/chromium/ui/color/color_id_macros.inc +++ b/chromium/ui/color/color_id_macros.inc @@ -26,7 +26,12 @@ #define E3(enum_name, old_enum_name, enum_value) D2(enum_name, enum_value) #define E_CPONLY(...) E(__VA_ARGS__) #define GET_E(_1, _2, _3, macro_name, ...) macro_name +#ifndef __GNUC__ +#define EXPAND_E(x) x +#define E(...) EXPAND_E(GET_E(__VA_ARGS__, E3, E2, E1)(__VA_ARGS__)), +#else #define E(...) GET_E(__VA_ARGS__, E3, E2, E1)(__VA_ARGS__), +#endif #else // !defined(COLOR_ID_MACROS_DEFINED) #undef D1 #undef D2 @@ -36,5 +41,8 @@ #undef E_CPONLY #undef GET_E #undef E +#ifndef __GNUC__ +#undef EXPAND_E +#endif #undef COLOR_ID_MACROS_DEFINED #endif // !defined(COLOR_ID_MACROS_DEFINED) diff --git a/chromium/ui/color/color_id_map_macros.inc b/chromium/ui/color/color_id_map_macros.inc index ba0d794a545..375acd8ae7e 100644 --- a/chromium/ui/color/color_id_map_macros.inc +++ b/chromium/ui/color/color_id_map_macros.inc @@ -18,7 +18,8 @@ { enum_name, #enum_name } #define E_CPONLY(...) E(__VA_ARGS__) #define GET_E(_1, _2, _3, macro_name, ...) macro_name -#define E(...) GET_E(__VA_ARGS__, E3, E2, E1)(__VA_ARGS__), +#define EXPAND_E(x) x +#define E(...) EXPAND_E(GET_E(__VA_ARGS__, E3, E2, E1)(__VA_ARGS__)), #else #undef E1 @@ -26,5 +27,6 @@ #undef E3 #undef E_CPONLY #undef GET_E +#undef EXPAND_E #undef E #endif diff --git a/chromium/ui/display/display_list.cc b/chromium/ui/display/display_list.cc index c0ff86eac82..9e0e0c1edd0 100644 --- a/chromium/ui/display/display_list.cc +++ b/chromium/ui/display/display_list.cc @@ -24,7 +24,11 @@ void DisplayList::RemoveObserver(DisplayObserver* observer) { DisplayList::Displays::const_iterator DisplayList::FindDisplayById( int64_t id) const { - return base::ranges::find(displays_, id, &Display::id); + auto display = displays_.begin(); + while (display != displays_.end() && display->id() != id) + ++display; + return display; +// return base::ranges::find(displays_, id, &Display::id); } DisplayList::Displays::const_iterator DisplayList::GetPrimaryDisplayIterator() @@ -167,7 +171,11 @@ bool DisplayList::IsValid() const { DisplayList::Displays::iterator DisplayList::FindDisplayByIdInternal( int64_t id) { - return base::ranges::find(displays_, id, &Display::id); + auto display = displays_.begin(); + while (display != displays_.end() && display->id() != id) + ++display; + return display; +// return base::ranges::find(displays_, id, &Display::id); } } // namespace display diff --git a/chromium/ui/display/screen_infos.cc b/chromium/ui/display/screen_infos.cc index f9481b1438b..cf34cae901b 100644 --- a/chromium/ui/display/screen_infos.cc +++ b/chromium/ui/display/screen_infos.cc @@ -30,9 +30,12 @@ ScreenInfo& ScreenInfos::mutable_current() { } const ScreenInfo& ScreenInfos::current() const { - const auto& current_screen_info = base::ranges::find( - screen_infos, current_display_id, &ScreenInfo::display_id); - CHECK(current_screen_info != screen_infos.end()); + auto current_screen_info = screen_infos.cbegin(); + while (current_screen_info != screen_infos.cend() && current_screen_info->display_id != current_display_id) + ++current_screen_info; +// const auto& current_screen_info = base::ranges::find( +// screen_infos, current_display_id, &ScreenInfo::display_id); + CHECK(current_screen_info != screen_infos.cend()); return *current_screen_info; } diff --git a/chromium/ui/gfx/x/BUILD.gn b/chromium/ui/gfx/x/BUILD.gn index 10025da5794..656fad4c66f 100644 --- a/chromium/ui/gfx/x/BUILD.gn +++ b/chromium/ui/gfx/x/BUILD.gn @@ -19,15 +19,17 @@ config("x11_private_config") { } config("build_xprotos_config") { - cflags = [ - "-Wno-shadow", - - # Generated proto files pull all fields from a struct into scope - # even if they aren't used. Rather than adding logic in the - # generator to determine which fields are used and keeping only - # those, simply ignore unused variable warnings. - "-Wno-unused-variable", - ] + if (is_clang || !is_win) { + cflags = [ + "-Wno-shadow", + + # Generated proto files pull all fields from a struct into scope + # even if they aren't used. Rather than adding logic in the + # generator to determine which fields are used and keeping only + # those, simply ignore unused variable warnings. + "-Wno-unused-variable", + ] + } } generate_library_loader("xlib_loader") { diff --git a/chromium/ui/gl/gl_utils.cc b/chromium/ui/gl/gl_utils.cc index a14b13ed56c..676ae237096 100644 --- a/chromium/ui/gl/gl_utils.cc +++ b/chromium/ui/gl/gl_utils.cc @@ -65,7 +65,11 @@ void Hang() { base::debug::Alias(&do_not_delete_me); ++do_not_delete_me; +#ifdef _MSC_VER + _ReadWriteBarrier(); +#else __asm__ volatile(""); +#endif } } diff --git a/chromium/ui/gl/init/gl_factory.cc b/chromium/ui/gl/init/gl_factory.cc index 68afa643508..d0b5c8340d1 100644 --- a/chromium/ui/gl/init/gl_factory.cc +++ b/chromium/ui/gl/init/gl_factory.cc @@ -80,21 +80,22 @@ GLImplementationParts GetRequestedGLImplementation( // If the passthrough command decoder is enabled, put ANGLE first if allowed if (g_is_angle_enabled && UsePassthroughCommandDecoder(cmd)) { std::vector<GLImplementationParts> angle_impls = {}; + std::vector<GLImplementationParts> new_allowed_impls = {}; bool software_gl_allowed = false; auto iter = allowed_impls.begin(); while (iter != allowed_impls.end()) { if ((*iter) == GetSoftwareGLImplementation()) { software_gl_allowed = true; - allowed_impls.erase(iter); } else if (iter->gl == kGLImplementationEGLANGLE) { angle_impls.emplace_back(*iter); - allowed_impls.erase(iter); } else { - iter++; + new_allowed_impls.emplace_back(*iter); } + iter++; } - allowed_impls.insert(allowed_impls.begin(), angle_impls.begin(), - angle_impls.end()); + allowed_impls = std::move(angle_impls); + allowed_impls.insert(allowed_impls.end(), new_allowed_impls.begin(), new_allowed_impls.end()); + // Insert software implementations at the end, after all other hardware // implementations if (software_gl_allowed) { diff --git a/chromium/ui/gl/init/gl_factory_win.cc b/chromium/ui/gl/init/gl_factory_win.cc index caddf8780c0..1882571bdfd 100644 --- a/chromium/ui/gl/init/gl_factory_win.cc +++ b/chromium/ui/gl/init/gl_factory_win.cc @@ -26,6 +26,7 @@ namespace init { std::vector<GLImplementationParts> GetAllowedGLImplementations() { std::vector<GLImplementationParts> impls; + impls.emplace_back(GLImplementationParts(kGLImplementationDesktopGL)); impls.emplace_back(GLImplementationParts(kGLImplementationEGLANGLE)); return impls; } diff --git a/chromium/ui/platform_window/BUILD.gn b/chromium/ui/platform_window/BUILD.gn index 4fff61eb7ae..f64d1e022e1 100644 --- a/chromium/ui/platform_window/BUILD.gn +++ b/chromium/ui/platform_window/BUILD.gn @@ -66,7 +66,7 @@ component("platform_window") { group("platform_impls") { public_deps = [ "//ui/platform_window/stub" ] - if (is_win) { + if (is_win && !use_qt) { public_deps += [ "//ui/platform_window/win" ] } } diff --git a/chromium/ui/views/BUILD.gn b/chromium/ui/views/BUILD.gn index b1b539c365b..c950de8433e 100644 --- a/chromium/ui/views/BUILD.gn +++ b/chromium/ui/views/BUILD.gn @@ -800,7 +800,7 @@ jumbo_component("views") { "widget/desktop_aura/desktop_screen_position_client.cc", "widget/desktop_aura/desktop_window_tree_host.cc", ] - if (is_win) { + if (is_win && !use_qt) { public += [ "widget/desktop_aura/desktop_window_tree_host_win.h" ] sources += [ "widget/desktop_aura/desktop_drag_drop_client_win.cc", diff --git a/chromium/ui/wm/core/cursors_aura.cc b/chromium/ui/wm/core/cursors_aura.cc index 94c9c897937..3c8b9003c7a 100644 --- a/chromium/ui/wm/core/cursors_aura.cc +++ b/chromium/ui/wm/core/cursors_aura.cc @@ -17,7 +17,7 @@ #include "ui/gfx/image/image_skia_rep.h" #include "ui/resources/grit/ui_resources.h" -#if BUILDFLAG(IS_WIN) +#if BUILDFLAG(IS_WIN) && !defined(TOOLKIT_QT) #include "ui/base/win/win_cursor.h" #include "ui/gfx/icon_util.h" #include "ui/wm/core/cursor_loader.h" @@ -330,7 +330,7 @@ bool GetCursorDataFor(ui::CursorSize cursor_size, } SkBitmap GetDefaultBitmap(const ui::Cursor& cursor) { -#if BUILDFLAG(IS_WIN) +#if BUILDFLAG(IS_WIN) && !defined(TOOLKIT_QT) ui::Cursor cursor_copy = cursor; CursorLoader cursor_loader; cursor_loader.SetPlatformCursor(&cursor_copy); @@ -351,7 +351,7 @@ SkBitmap GetDefaultBitmap(const ui::Cursor& cursor) { } gfx::Point GetDefaultHotspot(const ui::Cursor& cursor) { -#if BUILDFLAG(IS_WIN) +#if BUILDFLAG(IS_WIN) && !defined(TOOLKIT_QT) ui::Cursor cursor_copy = cursor; CursorLoader cursor_loader; cursor_loader.SetPlatformCursor(&cursor_copy); diff --git a/chromium/url/origin.cc b/chromium/url/origin.cc index 28574f8968e..a1b7f30caa0 100644 --- a/chromium/url/origin.cc +++ b/chromium/url/origin.cc @@ -423,7 +423,6 @@ bool IsSameOriginWith(const GURL& a, const GURL& b) { return Origin::Create(a).IsSameOriginWith(Origin::Create(b)); } -Origin::Nonce::Nonce() = default; Origin::Nonce::Nonce(const base::UnguessableToken& token) : token_(token) { CHECK(!token_.is_empty()); } diff --git a/chromium/url/origin.h b/chromium/url/origin.h index 98cd51f99e6..3f810bcc7e1 100644 --- a/chromium/url/origin.h +++ b/chromium/url/origin.h @@ -344,7 +344,7 @@ class COMPONENT_EXPORT(URL) Origin { public: // Creates a nonce to hold a newly-generated UnguessableToken. The actual // token value will be generated lazily. - Nonce(); + Nonce() = default; // Creates a nonce to hold an already-generated UnguessableToken value. This // constructor should only be used for IPC serialization and testing -- diff --git a/chromium/v8/src/base/logging.h b/chromium/v8/src/base/logging.h index 08db24a947e..fdac44e31e0 100644 --- a/chromium/v8/src/base/logging.h +++ b/chromium/v8/src/base/logging.h @@ -45,8 +45,13 @@ V8_BASE_EXPORT V8_NOINLINE void V8_Dcheck(const char* file, int line, #endif // !defined(OFFICIAL_BUILD) #endif // DEBUG +#if defined(_MSC_VER) +#define UNIMPLEMENTED() do { FATAL("unimplemented code"); __assume(0); } while(false) +#define UNREACHABLE() do { FATAL("unreachable code"); __assume(0); } while(false) +#else #define UNIMPLEMENTED() FATAL("unimplemented code") #define UNREACHABLE() FATAL("unreachable code") +#endif namespace v8 { namespace base { diff --git a/chromium/v8/src/codegen/assembler.cc b/chromium/v8/src/codegen/assembler.cc index 7fd3dfa99c6..2caae1bd86b 100644 --- a/chromium/v8/src/codegen/assembler.cc +++ b/chromium/v8/src/codegen/assembler.cc @@ -131,6 +131,7 @@ class ExternalAssemblerBufferImpl : public AssemblerBuffer { std::unique_ptr<AssemblerBuffer> Grow(int new_size) override { FATAL("Cannot grow external assembler buffer"); + return nullptr; } void* operator new(std::size_t count); diff --git a/chromium/v8/src/handles/handles.h b/chromium/v8/src/handles/handles.h index 0d2bdb078fb..7a08068103f 100644 --- a/chromium/v8/src/handles/handles.h +++ b/chromium/v8/src/handles/handles.h @@ -11,6 +11,7 @@ #include "src/base/macros.h" #include "src/common/checks.h" #include "src/common/globals.h" +#include "src/objects/objects.h" #include "src/zone/zone.h" namespace v8 { @@ -26,7 +27,6 @@ class LocalHeap; class LocalIsolate; template <typename T> class MaybeHandle; -class Object; class OrderedHashMap; class OrderedHashSet; class OrderedNameDictionary; diff --git a/chromium/v8/src/heap/free-list.h b/chromium/v8/src/heap/free-list.h index 896eed570b1..b283c4c7e8d 100644 --- a/chromium/v8/src/heap/free-list.h +++ b/chromium/v8/src/heap/free-list.h @@ -269,22 +269,27 @@ class NoFreeList final : public FreeList { public: size_t GuaranteedAllocatable(size_t maximum_freed) final { FATAL("NoFreeList can't be used as a standard FreeList. "); + return 0; } size_t Free(Address start, size_t size_in_bytes, FreeMode mode) final { FATAL("NoFreeList can't be used as a standard FreeList."); + return 0; } V8_WARN_UNUSED_RESULT FreeSpace Allocate(size_t size_in_bytes, size_t* node_size, AllocationOrigin origin) final { FATAL("NoFreeList can't be used as a standard FreeList."); + return FreeSpace(); } Page* GetPageForSize(size_t size_in_bytes) final { FATAL("NoFreeList can't be used as a standard FreeList."); + return nullptr; } private: FreeListCategoryType SelectFreeListCategoryType(size_t size_in_bytes) final { FATAL("NoFreeList can't be used as a standard FreeList."); + return 0; } }; diff --git a/chromium/v8/src/heap/heap-inl.h b/chromium/v8/src/heap/heap-inl.h index 41d03ed96fd..de1089d5eca 100644 --- a/chromium/v8/src/heap/heap-inl.h +++ b/chromium/v8/src/heap/heap-inl.h @@ -145,8 +145,6 @@ FixedArray Heap::single_character_string_table() { /* never in new space and never on a page that is being compacted. */ \ DCHECK_IMPLIES(deserialization_complete(), \ !RootsTable::IsImmortalImmovable(RootIndex::k##CamelName)); \ - DCHECK_IMPLIES(RootsTable::IsImmortalImmovable(RootIndex::k##CamelName), \ - IsImmovable(HeapObject::cast(value))); \ roots_table()[RootIndex::k##CamelName] = value.ptr(); \ } ROOT_LIST(ROOT_ACCESSOR) diff --git a/chromium/v8/src/torque/global-context.h b/chromium/v8/src/torque/global-context.h index c0945e575a0..8126643b104 100644 --- a/chromium/v8/src/torque/global-context.h +++ b/chromium/v8/src/torque/global-context.h @@ -20,8 +20,8 @@ namespace torque { class GlobalContext : public ContextualClass<GlobalContext> { public: - GlobalContext(GlobalContext&&) V8_NOEXCEPT = default; - GlobalContext& operator=(GlobalContext&&) V8_NOEXCEPT = default; + GlobalContext(GlobalContext&&) = default; + GlobalContext& operator=(GlobalContext&&) = default; explicit GlobalContext(Ast ast); static Namespace* GetDefaultNamespace() { return Get().default_namespace_; } |