diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-12-08 13:36:23 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2022-02-25 10:43:39 +0100 |
commit | 51cb4c43df06a8794f4896da2ff362054e95e2b3 (patch) | |
tree | 330844d1d1d659136c2b089bcdbb2a43746e9fb5 | |
parent | 7634bc45930e90c10c56e27dc7e6b26c64e32517 (diff) | |
download | qtwebengine-chromium-51cb4c43df06a8794f4896da2ff362054e95e2b3.tar.gz |
Fixes for building with MSVC
Work-around various issues to make Chromium build on MSVC
Change-Id: I3489452c9d7e61243fb60b877d289293b1850ebe
Reviewed-by: Peter Varga <pvarga@inf.u-szeged.hu>
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
185 files changed, 882 insertions, 386 deletions
diff --git a/chromium/BUILD.gn b/chromium/BUILD.gn index edc91168c77..9762ceec292 100644 --- a/chromium/BUILD.gn +++ b/chromium/BUILD.gn @@ -343,7 +343,7 @@ group("gn_all") { ] } - if (is_win && (target_cpu == "x86" || target_cpu == "x64")) { + if (is_win && (target_cpu == "x86" || target_cpu == "x64") && !use_qt) { deps += [ "//chrome/browser/browser_switcher/bho:browser_switcher_dlls" ] } @@ -667,7 +667,7 @@ group("gn_all") { ] } - if (is_win) { + if (is_win && !use_qt) { deps += [ "//base:pe_image_test", "//chrome/chrome_cleaner", @@ -701,7 +701,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/BUILD.gn b/chromium/base/BUILD.gn index 64a4ae80029..d16b4c8e151 100644 --- a/chromium/base/BUILD.gn +++ b/chromium/base/BUILD.gn @@ -2037,7 +2037,7 @@ jumbo_component("base") { ] } - if (current_cpu == "x64") { + if (current_cpu == "x64" && (!is_win || is_clang)) { defines += [ "PA_PCSCAN_STACK_SUPPORTED" ] sources += [ "allocator/partition_allocator/starscan/stack/asm/x64/push_registers_asm.cc" ] } else if (current_cpu == "x86") { diff --git a/chromium/base/allocator/partition_alloc_support.cc b/chromium/base/allocator/partition_alloc_support.cc index 35600629381..d6769b23d40 100644 --- a/chromium/base/allocator/partition_alloc_support.cc +++ b/chromium/base/allocator/partition_alloc_support.cc @@ -39,7 +39,10 @@ constexpr const char* ScannerIdToTracingString( case internal::StatsCollector::ScannerId::kOverall: return "PCScan.Scanner"; case internal::StatsCollector::ScannerId::kNumIds: +#if defined(__GNUC__) || defined(__clang__) __builtin_unreachable(); +#endif + return nullptr; } } @@ -55,7 +58,10 @@ constexpr const char* MutatorIdToTracingString( case internal::StatsCollector::MutatorId::kOverall: return "PCScan.Mutator"; case internal::StatsCollector::MutatorId::kNumIds: +#if defined(__GNUC__) || defined(__clang__) __builtin_unreachable(); +#endif + return nullptr; } } diff --git a/chromium/base/allocator/partition_allocator/partition_alloc-inl.h b/chromium/base/allocator/partition_allocator/partition_alloc-inl.h index 43bcbed56b4..5ff0e2f005e 100644 --- a/chromium/base/allocator/partition_allocator/partition_alloc-inl.h +++ b/chromium/base/allocator/partition_allocator/partition_alloc-inl.h @@ -28,10 +28,14 @@ namespace internal { 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 } // Returns true if we've hit the end of a random-length period. We don't want to diff --git a/chromium/base/allocator/partition_allocator/partition_bucket_lookup.h b/chromium/base/allocator/partition_allocator/partition_bucket_lookup.h index 3a6df17fd2c..bc3bbe19f73 100644 --- a/chromium/base/allocator/partition_allocator/partition_bucket_lookup.h +++ b/chromium/base/allocator/partition_allocator/partition_bucket_lookup.h @@ -207,7 +207,11 @@ ALWAYS_INLINE constexpr size_t BucketIndexLookup::GetIndex(size_t size) { // This forces the bucket table to be constant-initialized and immediately // materialized in the binary. constexpr BucketIndexLookup lookup{}; +#if defined(COMPILER_MSVC) && !defined(__clang__) + const uint8_t order = kBitsPerSizeT - bits::qConstexprCountLeadingZeroBits(size); +#else const uint8_t order = kBitsPerSizeT - bits::CountLeadingZeroBitsSizeT(size); +#endif // The order index is simply the next few bits after the most significant // bit. const size_t order_index = @@ -217,7 +221,7 @@ ALWAYS_INLINE constexpr size_t BucketIndexLookup::GetIndex(size_t size) { 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 0282fb431b5..9d0c55678a7 100644 --- a/chromium/base/allocator/partition_allocator/partition_page.cc +++ b/chromium/base/allocator/partition_allocator/partition_page.cc @@ -303,15 +303,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_page.h b/chromium/base/allocator/partition_allocator/partition_page.h index 631b2c22585..9ebe9e02d8c 100644 --- a/chromium/base/allocator/partition_allocator/partition_page.h +++ b/chromium/base/allocator/partition_allocator/partition_page.h @@ -86,6 +86,13 @@ ALWAYS_INLINE char* SuperPagesEndFromExtent( using AllocationStateMap = StateBitmap<kSuperPageSize, kSuperPageAlignment, kAlignment>; +#ifdef _MSC_VER +#pragma pack(push, 1) +#define ATTR_PACK +#else +#define ATTR_PACK __attribute__((packed)) +#endif + // Metadata of the slot span. // // Some notes on slot span states. It can be in one of four major states: @@ -117,7 +124,7 @@ using AllocationStateMap = // found, an empty or decommitted slot spans (if one exists) will be pulled // from the empty/decommitted list on to the active list. template <bool thread_safe> -struct __attribute__((packed)) SlotSpanMetadata { +struct ATTR_PACK SlotSpanMetadata { private: PartitionFreelistEntry* freelist_head = nullptr; @@ -301,10 +308,10 @@ struct SubsequentPageMetadata { // more than 1 page, the page metadata may contain rudimentary additional // information. template <bool thread_safe> -struct __attribute__((packed)) PartitionPage { +struct ATTR_PACK PartitionPage { // "Pack" the union so that common page metadata still fits within // kPageMetadataSize. (SlotSpanMetadata is also "packed".) - union __attribute__((packed)) { + union ATTR_PACK { SlotSpanMetadata<thread_safe> slot_span_metadata; SubsequentPageMetadata subsequent_page_metadata; @@ -346,6 +353,11 @@ struct __attribute__((packed)) PartitionPage { ALWAYS_INLINE static void* ToSlotSpanStartPtr(const PartitionPage* page); }; +#ifdef _MSC_VER +#pragma pack(pop) +#endif +#undef ATTR_PACK + static_assert(sizeof(PartitionPage<ThreadSafe>) == kPageMetadataSize, "PartitionPage must be able to fit in a metadata slot"); static_assert(sizeof(PartitionPage<NotThreadSafe>) == kPageMetadataSize, diff --git a/chromium/base/allocator/partition_allocator/partition_root.cc b/chromium/base/allocator/partition_allocator/partition_root.cc index cda9f4f1d47..c508bf583f8 100644 --- a/chromium/base/allocator/partition_allocator/partition_root.cc +++ b/chromium/base/allocator/partition_allocator/partition_root.cc @@ -1203,6 +1203,13 @@ void* PartitionRoot<internal::ThreadSafe>::MaybeInitThreadCacheAndAlloc( return tcache->GetFromCache(bucket_index, slot_size); } +template <> +void* PartitionRoot<internal::NotThreadSafe>::MaybeInitThreadCacheAndAlloc( + uint16_t bucket_index, + size_t* slot_size) { + return nullptr; +} + template struct BASE_EXPORT PartitionRoot<internal::ThreadSafe>; template struct BASE_EXPORT PartitionRoot<internal::NotThreadSafe>; diff --git a/chromium/base/allocator/partition_allocator/partition_root.h b/chromium/base/allocator/partition_allocator/partition_root.h index 794282c4194..b0dd314f70b 100644 --- a/chromium/base/allocator/partition_allocator/partition_root.h +++ b/chromium/base/allocator/partition_allocator/partition_root.h @@ -1253,7 +1253,11 @@ ALWAYS_INLINE void PartitionRoot<thread_safe>::RawFree(void* 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 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 7afa23e772b..031b4acaa1f 100644 --- a/chromium/base/allocator/partition_allocator/partition_tls.h +++ b/chromium/base/allocator/partition_allocator/partition_tls.h @@ -117,9 +117,11 @@ ALWAYS_INLINE bool PartitionTlsCreate(PartitionTlsKey* key, void (*destructor)(void*)) { // NOTIMPLEMENTED() may allocate, crash instead. IMMEDIATE_CRASH(); + return false; } ALWAYS_INLINE void* PartitionTlsGet(PartitionTlsKey key) { IMMEDIATE_CRASH(); + return nullptr; } ALWAYS_INLINE void PartitionTlsSet(PartitionTlsKey key, void* value) { IMMEDIATE_CRASH(); diff --git a/chromium/base/allocator/partition_allocator/reservation_offset_table.h b/chromium/base/allocator/partition_allocator/reservation_offset_table.h index 8f735fa87e3..60b60363940 100644 --- a/chromium/base/allocator/partition_allocator/reservation_offset_table.h +++ b/chromium/base/allocator/partition_allocator/reservation_offset_table.h @@ -163,7 +163,7 @@ ALWAYS_INLINE uintptr_t ComputeReservationStart(uintptr_t address, // If the given address doesn't point to direct-map allocated memory, // returns 0. ALWAYS_INLINE uintptr_t GetDirectMapReservationStart(uintptr_t address) { -#if DCHECK_IS_ON() +#if 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. @@ -176,7 +176,7 @@ ALWAYS_INLINE uintptr_t GetDirectMapReservationStart(uintptr_t address) { if (*offset_ptr == kOffsetTagNormalBuckets) return 0; uintptr_t reservation_start = ComputeReservationStart(address, offset_ptr); -#if DCHECK_IS_ON() +#if 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 12ff3012227..afa6deaeaf2 100644 --- a/chromium/base/allocator/partition_allocator/starscan/pcscan_internal.cc +++ b/chromium/base/allocator/partition_allocator/starscan/pcscan_internal.cc @@ -330,6 +330,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 = @@ -337,6 +338,12 @@ class SuperPageSnapshot final { ? ReservedStateBitmapSize() : 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 906aeae1c7e..50cbce2d8c3 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/memory/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 @@ -60,7 +61,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 @@ -77,7 +78,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) @@ -109,7 +110,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, 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 23b9c2fe292..d06e7d81ef0 100644 --- a/chromium/base/allocator/partition_allocator/starscan/stack/stack.cc +++ b/chromium/base/allocator/partition_allocator/starscan/stack/stack.cc @@ -89,7 +89,11 @@ Stack::Stack(void* stack_top) : stack_top_(stack_top) { } 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 2a8987bc280..96c1e5ce65a 100644 --- a/chromium/base/allocator/partition_allocator/starscan/state_bitmap.h +++ b/chromium/base/allocator/partition_allocator/starscan/state_bitmap.h @@ -237,7 +237,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; } @@ -309,7 +314,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> @@ -351,7 +360,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 80d0a1a6daa..4e277724548 100644 --- a/chromium/base/allocator/partition_allocator/starscan/stats_collector.h +++ b/chromium/base/allocator/partition_allocator/starscan/stats_collector.h @@ -216,7 +216,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 } } @@ -234,7 +238,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/thread_cache.h b/chromium/base/allocator/partition_allocator/thread_cache.h index 281faa047c4..2906cd9b95a 100644 --- a/chromium/base/allocator/partition_allocator/thread_cache.h +++ b/chromium/base/allocator/partition_allocator/thread_cache.h @@ -256,6 +256,7 @@ class BASE_EXPORT ThreadCache { static ThreadCache* Create(PartitionRoot<ThreadSafe>* root); static ThreadCache* Create(PartitionRoot<NotThreadSafe>* root) { IMMEDIATE_CRASH(); + return nullptr; } ~ThreadCache(); diff --git a/chromium/base/allocator/partition_allocator/yield_processor.h b/chromium/base/allocator/partition_allocator/yield_processor.h index d51b102902d..9a2adcbe845 100644 --- a/chromium/base/allocator/partition_allocator/yield_processor.h +++ b/chromium/base/allocator/partition_allocator/yield_processor.h @@ -18,7 +18,10 @@ #define YIELD_PROCESSOR ((void)0) #else -#if defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_X86) +#if defined(COMPILER_MSVC) +#include <windows.h> +#define YIELD_PROCESSOR YieldProcessor() +#elif defined(ARCH_CPU_X86_64) || defined(ARCH_CPU_X86) #define YIELD_PROCESSOR __asm__ __volatile__("pause") #elif (defined(ARCH_CPU_ARMEL) && __ARM_ARCH >= 6) || defined(ARCH_CPU_ARM64) #define YIELD_PROCESSOR __asm__ __volatile__("yield") diff --git a/chromium/base/bits.h b/chromium/base/bits.h index f71bc3f824f..e0c5a6b208c 100644 --- a/chromium/base/bits.h +++ b/chromium/base/bits.h @@ -81,25 +81,48 @@ inline T* AlignUp(T* ptr, size_t alignment) { // constexpr. #if defined(COMPILER_MSVC) && !defined(__clang__) +constexpr inline unsigned qConstexprPopulationCount(uint64_t v) noexcept +{ + // See http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel + return + (((v ) & 0xfff) * uint64_t(0x1001001001001) & uint64_t(0x84210842108421)) % 0x1f + + (((v >> 12) & 0xfff) * uint64_t(0x1001001001001) & uint64_t(0x84210842108421)) % 0x1f + + (((v >> 24) & 0xfff) * uint64_t(0x1001001001001) & uint64_t(0x84210842108421)) % 0x1f + + (((v >> 36) & 0xfff) * uint64_t(0x1001001001001) & uint64_t(0x84210842108421)) % 0x1f + + (((v >> 48) & 0xfff) * uint64_t(0x1001001001001) & uint64_t(0x84210842108421)) % 0x1f + + (((v >> 60) & 0xfff) * uint64_t(0x1001001001001) & uint64_t(0x84210842108421)) % 0x1f; +} + +constexpr inline unsigned qConstexprCountLeadingZeroBits(uint64_t v) noexcept +{ + v = v | (v >> 1); + v = v | (v >> 2); + v = v | (v >> 4); + v = v | (v >> 8); + v = v | (v >> 16); + v = v | (v >> 32); + return qConstexprPopulationCount(~v); +} + template <typename T, unsigned bits = sizeof(T) * 8> -ALWAYS_INLINE +ALWAYS_INLINE constexpr typename std::enable_if<std::is_unsigned<T>::value && sizeof(T) <= 4, unsigned>::type CountLeadingZeroBits(T x) { static_assert(bits > 0, "invalid instantiation"); - unsigned long index; + unsigned long index = 0; return LIKELY(_BitScanReverse(&index, static_cast<uint32_t>(x))) ? (31 - index - (32 - bits)) : bits; } template <typename T, unsigned bits = sizeof(T) * 8> -ALWAYS_INLINE +ALWAYS_INLINE constexpr typename std::enable_if<std::is_unsigned<T>::value && sizeof(T) == 8, unsigned>::type CountLeadingZeroBits(T x) { static_assert(bits > 0, "invalid instantiation"); - unsigned long index; + unsigned long index = 0; // MSVC only supplies _BitScanReverse64 when building for a 64-bit target. #if defined(ARCH_CPU_64_BITS) return LIKELY(_BitScanReverse64(&index, static_cast<uint64_t>(x))) @@ -119,23 +142,23 @@ ALWAYS_INLINE } template <typename T, unsigned bits = sizeof(T) * 8> -ALWAYS_INLINE +ALWAYS_INLINE constexpr typename std::enable_if<std::is_unsigned<T>::value && sizeof(T) <= 4, unsigned>::type CountTrailingZeroBits(T x) { static_assert(bits > 0, "invalid instantiation"); - unsigned long index; + unsigned long index = 0; return LIKELY(_BitScanForward(&index, static_cast<uint32_t>(x))) ? index : bits; } template <typename T, unsigned bits = sizeof(T) * 8> -ALWAYS_INLINE +ALWAYS_INLINE constexpr typename std::enable_if<std::is_unsigned<T>::value && sizeof(T) == 8, unsigned>::type CountTrailingZeroBits(T x) { static_assert(bits > 0, "invalid instantiation"); - unsigned long index; + unsigned long index = 0; // MSVC only supplies _BitScanForward64 when building for a 64-bit target. #if defined(ARCH_CPU_64_BITS) return LIKELY(_BitScanForward64(&index, static_cast<uint64_t>(x))) ? index diff --git a/chromium/base/check.h b/chromium/base/check.h index 86512475205..145ab61e7c9 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 8917e0d4c83..182917be2ea 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 @@ -75,9 +75,12 @@ // prevent code folding, see NO_CODE_FOLDING() in base/debug/alias.h. // Use like: // void NOT_TAIL_CALLED FooBar(); -#if defined(__clang__) && __has_attribute(not_tail_called) +#if defined(__clang__) +#if __has_attribute(not_tail_called) #define NOT_TAIL_CALLED __attribute__((not_tail_called)) -#else +#endif +#endif +#ifndef NOT_TAIL_CALLED #define NOT_TAIL_CALLED #endif @@ -208,7 +211,7 @@ // Macro useful for writing cross-platform function pointers. #if !defined(CDECL) -#if defined(OS_WIN) +#if defined(OS_WIN) && (defined(__i386) || defined(__i386__) || defined(_M_IX86)) #define CDECL __cdecl #else // defined(OS_WIN) #define CDECL @@ -274,7 +277,8 @@ #endif #endif -#if defined(__clang__) && __has_attribute(uninitialized) +#if defined(__clang__) +#if __has_attribute(uninitialized) // Attribute "uninitialized" disables -ftrivial-auto-var-init=pattern for // the specified variable. // Library-wide alternative is @@ -308,6 +312,9 @@ #else #define STACK_UNINITIALIZED #endif +#else +#define STACK_UNINITIALIZED +#endif // Attribute "no_stack_protector" disables -fstack-protector for the specified // function. @@ -397,18 +404,24 @@ inline constexpr bool AnalyzerAssumeTrue(bool arg) { // See also: // https://clang.llvm.org/docs/AttributeReference.html#trivial-abi // https://libcxx.llvm.org/docs/DesignDocs/UniquePtrTrivialAbi.html +#if defined(__has_attribute) #if defined(__clang__) && __has_attribute(trivial_abi) #define TRIVIAL_ABI [[clang::trivial_abi]] -#else +#endif +#endif +#ifndef TRIVIAL_ABI #define TRIVIAL_ABI #endif // Marks a member function as reinitializing a moved-from variable. // See also // https://clang.llvm.org/extra/clang-tidy/checks/bugprone-use-after-move.html#reinitialization +#if defined(__has_attribute) #if defined(__clang__) && __has_attribute(reinitializes) #define REINITIALIZES_AFTER_MOVE [[clang::reinitializes]] -#else +#endif +#endif +#ifndef REINITIALIZES_AFTER_MOVE #define REINITIALIZES_AFTER_MOVE #endif diff --git a/chromium/base/containers/contiguous_iterator.h b/chromium/base/containers/contiguous_iterator.h index f8d015090cc..ef5d8078c01 100644 --- a/chromium/base/containers/contiguous_iterator.h +++ b/chromium/base/containers/contiguous_iterator.h @@ -42,11 +42,19 @@ 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 : disjunction<std::is_same<T, typename ArrayT::const_iterator>, std::is_same<T, typename ArrayT::iterator>> {}; +template <typename T> +struct IsArrayIter + : 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 template <typename T, typename VectorT = std::vector<iter_value_t<T>>> 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/immediate_crash.h b/chromium/base/immediate_crash.h index 19d2cbcc619..a40b5fda54a 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) +#if defined(COMPILER_MSVC) && !defined(__clang__) + +#define WRAPPED_TRAP_SEQUENCE_() TRAP_SEQUENCE1_() + +#elif !defined(COMPILER_GCC) #define WRAPPED_TRAP_SEQUENCE_() TRAP_SEQUENCE_() diff --git a/chromium/base/memory/shared_memory_mapping.h b/chromium/base/memory/shared_memory_mapping.h index 4d9f10aa426..e2821103f50 100644 --- a/chromium/base/memory/shared_memory_mapping.h +++ b/chromium/base/memory/shared_memory_mapping.h @@ -190,9 +190,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/message_loop/timer_slack.cc b/chromium/base/message_loop/timer_slack.cc index d0cc61aac8e..a3e6d276d08 100644 --- a/chromium/base/message_loop/timer_slack.cc +++ b/chromium/base/message_loop/timer_slack.cc @@ -13,7 +13,7 @@ namespace base { namespace features { -constexpr base::Feature kLudicrousTimerSlack{"LudicrousTimerSlack", +const base::Feature kLudicrousTimerSlack{"LudicrousTimerSlack", base::FEATURE_DISABLED_BY_DEFAULT}; namespace { diff --git a/chromium/base/metrics/histogram_macros.h b/chromium/base/metrics/histogram_macros.h index 487afaeee62..ec1d99b9b6d 100644 --- a/chromium/base/metrics/histogram_macros.h +++ b/chromium/base/metrics/histogram_macros.h @@ -357,10 +357,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/notreached.h b/chromium/base/notreached.h index b6466b8a493..009c2aa2d0c 100644 --- a/chromium/base/notreached.h +++ b/chromium/base/notreached.h @@ -23,10 +23,17 @@ void BASE_EXPORT LogErrorNotReached(const char* file, int line); // 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 d6871454ce1..eb7bf4a9441 100644 --- a/chromium/base/parameter_pack.h +++ b/chromium/base/parameter_pack.h @@ -86,6 +86,31 @@ struct ParameterPack { 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..ac7636acd9e 100644 --- a/chromium/base/trace_event/optional_trace_event.h +++ b/chromium/base/trace_event/optional_trace_event.h @@ -15,9 +15,9 @@ #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__) +#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 fb4e4a6e5fb..99bc4978d36 100644 --- a/chromium/base/traits_bag.h +++ b/chromium/base/traits_bag.h @@ -155,10 +155,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...); } @@ -244,9 +246,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/win/scoped_handle_verifier.cc b/chromium/base/win/scoped_handle_verifier.cc index e64bd2c0389..43199313d0c 100644 --- a/chromium/base/win/scoped_handle_verifier.cc +++ b/chromium/base/win/scoped_handle_verifier.cc @@ -44,7 +44,11 @@ NOINLINE void ReportErrorOnScopedHandleOperation( auto creation_stack_copy = creation_stack; base::debug::Alias(&creation_stack_copy); CHECK(false); +#if !defined(COMPILER_MSVC) __builtin_unreachable(); +#else + __assume(0); +#endif } NOINLINE void ReportErrorOnScopedHandleOperation( @@ -55,7 +59,11 @@ NOINLINE void ReportErrorOnScopedHandleOperation( auto creation_stack_copy = creation_stack; base::debug::Alias(&creation_stack_copy); CHECK(false); +#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 117c359c89d..720f16a76b3 100644 --- a/chromium/base/win/windows_types.h +++ b/chromium/base/win/windows_types.h @@ -101,7 +101,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 08bba7e640d..2c9b660e0ae 100644 --- a/chromium/build/config/compiler/BUILD.gn +++ b/chromium/build/config/compiler/BUILD.gn @@ -802,7 +802,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 if (!is_apple) { diff --git a/chromium/build/config/win/BUILD.gn b/chromium/build/config/win/BUILD.gn index 34139b75dc8..2c7f785a34f 100644 --- a/chromium/build/config/win/BUILD.gn +++ b/chromium/build/config/win/BUILD.gn @@ -93,7 +93,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 += [ @@ -156,7 +158,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 cfb4220133c..706451095fb 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 ed0ead7c448..22d7b7ea91b 100644 --- a/chromium/chrome/BUILD.gn +++ b/chromium/chrome/BUILD.gn @@ -161,7 +161,7 @@ if (!is_android && !is_mac) { data_deps += [ "//sandbox/linux:chrome_sandbox" ] } - 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 45e8c8d813c..97b3a19b946 100644 --- a/chromium/chrome/browser/BUILD.gn +++ b/chromium/chrome/browser/BUILD.gn @@ -5218,7 +5218,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 83763254cd6..80a8bb5f669 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 0f16685d6dc..780d90c05c9 100644 --- a/chromium/chrome/common/webui_url_constants.cc +++ b/chromium/chrome/common/webui_url_constants.cc @@ -700,10 +700,11 @@ const char* const kChromeHostURLs[] = { kCfmNetworkSettingsHost, #endif // BUILDFLAG(PLATFORM_CFM) }; -const size_t kNumberOfChromeHostURLs = base::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 defined(OS_ANDROID) kChromeUIInternalsQueryTilesPath, @@ -714,6 +715,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/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/history/core/browser/visit_annotations_database.cc b/chromium/components/history/core/browser/visit_annotations_database.cc index 84c3704fddf..6680b9c4074 100644 --- a/chromium/components/history/core/browser/visit_annotations_database.cc +++ b/chromium/components/history/core/browser/visit_annotations_database.cc @@ -489,21 +489,19 @@ void VisitAnnotationsDatabase::AddClusters( } const int64_t cluster_id = GetDB().GetLastInsertRowId(); DCHECK(cluster_id); - base::ranges::for_each( - cluster.visits, - [&](const auto& annotated_visit) { - clusters_and_visits_statement.Reset(true); - clusters_and_visits_statement.BindInt64(0, cluster_id); - clusters_and_visits_statement.BindInt64( - 1, annotated_visit.visit_row.visit_id); - if (!clusters_and_visits_statement.Run()) { - DVLOG(0) - << "Failed to execute 'clusters_and_visits' insert statement: " - << "cluster_id = " << cluster_id - << ", visit_id = " << annotated_visit.visit_row.visit_id; - } - }, - &ClusterVisit::annotated_visit); + for (const auto& i : cluster.visits) { + const auto& annotated_visit = i.annotated_visit; + clusters_and_visits_statement.Reset(true); + clusters_and_visits_statement.BindInt64(0, cluster_id); + clusters_and_visits_statement.BindInt64( + 1, annotated_visit.visit_row.visit_id); + if (!clusters_and_visits_statement.Run()) { + DVLOG(0) + << "Failed to execute 'clusters_and_visits' insert statement: " + << "cluster_id = " << cluster_id + << ", visit_id = " << annotated_visit.visit_row.visit_id; + } + } } } 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 6baa8785d78..30425d93bb0 100644 --- a/chromium/components/printing/common/BUILD.gn +++ b/chromium/components/printing/common/BUILD.gn @@ -6,7 +6,7 @@ import("//build/config/features.gni") import("//mojo/public/tools/bindings/mojom.gni") import("//printing/buildflags/buildflags.gni") -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 80c66bd12a2..3206246c74b 100644 --- a/chromium/components/shared_highlighting/core/common/disabled_sites.cc +++ b/chromium/components/shared_highlighting/core/common/disabled_sites.cc @@ -43,7 +43,7 @@ bool ShouldOfferLinkToText(const GURL& url) { return true; } - auto* it = kBlocklist.find(domain); + auto it = kBlocklist.find(domain); if (it != kBlocklist.end()) { return !re2::RE2::FullMatch(url.path(), 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 f2ae62ba239..ddd1850d431 100644 --- a/chromium/components/shared_highlighting/core/common/shared_highlighting_features.cc +++ b/chromium/components/shared_highlighting/core/common/shared_highlighting_features.cc @@ -10,7 +10,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 kSharedHighlightingV2{"SharedHighlightingV2", diff --git a/chromium/components/spellcheck/browser/windows_spell_checker.cc b/chromium/components/spellcheck/browser/windows_spell_checker.cc index b663083515f..6f4ee5d4054 100644 --- a/chromium/components/spellcheck/browser/windows_spell_checker.cc +++ b/chromium/components/spellcheck/browser/windows_spell_checker.cc @@ -69,11 +69,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 @@ -282,6 +284,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()); @@ -297,6 +300,7 @@ spellcheck::PerLanguageSuggestions BackgroundHelper::GetPerLanguageSuggestions( return suggestions; } +#endif void BackgroundHelper::FillSuggestionList( const std::string& lang_tag, @@ -539,6 +543,7 @@ void WindowsSpellChecker::RequestTextCheck( std::move(callback)); } +#if BUILDFLAG(USE_BROWSER_SPELLCHECKER) void WindowsSpellChecker::GetPerLanguageSuggestions( const std::u16string& word, spellcheck_platform::GetSuggestionsCallback callback) { @@ -549,6 +554,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 e872d22a232..b63904f26ea 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", @@ -39,6 +41,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 95354b4930b..575e3f2004b 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 @@ -55,6 +56,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 2a587ee1da9..def6a24233f 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, base::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 690e128118c..5bade67ea3e 100644 --- a/chromium/components/viz/common/frame_sinks/copy_output_request.cc +++ b/chromium/components/viz/common/frame_sinks/copy_output_request.cc @@ -114,7 +114,7 @@ void CopyOutputRequest::set_blit_request(const 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 9bfc6bd8e7a..2659b8a75e7 100644 --- a/chromium/content/browser/BUILD.gn +++ b/chromium/content/browser/BUILD.gn @@ -3171,7 +3171,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/accessibility_event_recorder_uia_win.cc b/chromium/content/browser/accessibility/accessibility_event_recorder_uia_win.cc index fa07b037e96..c262bff0a78 100644 --- a/chromium/content/browser/accessibility/accessibility_event_recorder_uia_win.cc +++ b/chromium/content/browser/accessibility/accessibility_event_recorder_uia_win.cc @@ -125,9 +125,11 @@ void AccessibilityEventRecorderUia::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_ = ui::UiaRegistrarWin::GetInstance().GetTestCompleteEventId(); +#endif // Find the IUIAutomationElement for the root content window uia_->ElementFromHandle(hwnd_, &root_); diff --git a/chromium/content/browser/accessibility/accessibility_event_recorder_win.cc b/chromium/content/browser/accessibility/accessibility_event_recorder_win.cc index 58e40ea27c2..01410d6b57b 100644 --- a/chromium/content/browser/accessibility/accessibility_event_recorder_win.cc +++ b/chromium/content/browser/accessibility/accessibility_event_recorder_win.cc @@ -88,7 +88,7 @@ AccessibilityEventRecorderWin* AccessibilityEventRecorderWin::instance_ = nullptr; // static -CALLBACK void AccessibilityEventRecorderWin::WinEventHookThunk( +void CALLBACK AccessibilityEventRecorderWin::WinEventHookThunk( HWINEVENTHOOK handle, DWORD event, HWND hwnd, diff --git a/chromium/content/browser/accessibility/accessibility_event_recorder_win.h b/chromium/content/browser/accessibility/accessibility_event_recorder_win.h index 996019e2d48..ba80939fca7 100644 --- a/chromium/content/browser/accessibility/accessibility_event_recorder_win.h +++ b/chromium/content/browser/accessibility/accessibility_event_recorder_win.h @@ -7,6 +7,7 @@ #include <oleacc.h> +#include "base/win/windows_types.h" #include "content/browser/accessibility/accessibility_event_recorder.h" #include "content/common/content_export.h" @@ -26,7 +27,7 @@ class CONTENT_EXPORT AccessibilityEventRecorderWin ~AccessibilityEventRecorderWin() 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/content/browser/accessibility/browser_accessibility_state_impl.cc b/chromium/content/browser/accessibility/browser_accessibility_state_impl.cc index 3af397861a0..5cb9e710661 100644 --- a/chromium/content/browser/accessibility/browser_accessibility_state_impl.cc +++ b/chromium/content/browser/accessibility/browser_accessibility_state_impl.cc @@ -188,7 +188,7 @@ void BrowserAccessibilityStateImpl::UpdateHistogramsOnUIThread() { UMA_HISTOGRAM_BOOLEAN("Accessibility.ManuallyEnabled", force_renderer_accessibility_); -#if defined(OS_WIN) +#if defined(OS_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 ab5e45c57ab..ba54a34c8a4 100644 --- a/chromium/content/browser/browser_url_handler_impl.cc +++ b/chromium/content/browser/browser_url_handler_impl.cc @@ -184,10 +184,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 d32fcbed9cc..3c6f72dcbdd 100644 --- a/chromium/content/browser/renderer_host/clipboard_host_impl.cc +++ b/chromium/content/browser/renderer_host/clipboard_host_impl.cc @@ -172,7 +172,7 @@ void ClipboardHostImpl::IsFormatAvailable(blink::mojom::ClipboardFormat format, result = clipboard->IsFormatAvailable(ui::ClipboardFormatType::PlainTextType(), clipboard_buffer, data_endpoint.get()); -#if defined(OS_WIN) +#if defined(OS_WIN) && !defined(TOOLKIT_QT) result |= clipboard->IsFormatAvailable( ui::ClipboardFormatType::PlainTextAType(), clipboard_buffer, data_endpoint.get()); @@ -214,7 +214,7 @@ void ClipboardHostImpl::ReadText(ui::ClipboardBuffer clipboard_buffer, clipboard_buffer, data_dst.get())) { clipboard->ReadText(clipboard_buffer, data_dst.get(), &result); } else { -#if defined(OS_WIN) +#if defined(OS_WIN) && !defined(TOOLKIT_QT) if (clipboard->IsFormatAvailable(ui::ClipboardFormatType::PlainTextAType(), clipboard_buffer, data_dst.get())) { std::string ascii; diff --git a/chromium/content/renderer/accessibility/ax_image_annotator.cc b/chromium/content/renderer/accessibility/ax_image_annotator.cc index cb55c25bee1..5caf3f8ad73 100644 --- a/chromium/content/renderer/accessibility/ax_image_annotator.cc +++ b/chromium/content/renderer/accessibility/ax_image_annotator.cc @@ -123,7 +123,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 4b4a124355a..bfb25933580 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 10289e55639..75b2c86eaa9 100644 --- a/chromium/device/fido/cbor_extract.h +++ b/chromium/device/fido/cbor_extract.h @@ -147,12 +147,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)); } @@ -181,20 +183,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 0e71a622140..97473f0d29f 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 @@ -196,7 +196,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; @@ -213,15 +213,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); } @@ -329,7 +329,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); } @@ -339,8 +339,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 7b7a0ecf82c..8941eaffc1c 100644 --- a/chromium/gpu/ipc/service/BUILD.gn +++ b/chromium/gpu/ipc/service/BUILD.gn @@ -98,6 +98,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 d09cd6461d2..429fec114fe 100644 --- a/chromium/gpu/ipc/service/gpu_init.cc +++ b/chromium/gpu/ipc/service/gpu_init.cc @@ -47,11 +47,13 @@ #include "ui/ozone/public/surface_factory_ozone.h" #endif -#if defined(OS_WIN) && !defined(TOOLKIT_QT) +#if defined(OS_WIN) +#if !defined(TOOLKIT_QT) #include "gpu/config/gpu_driver_bug_workarounds.h" -#include "ui/gl/direct_composition_surface_win.h" #include "ui/gl/gl_surface_egl.h" #endif +#include "ui/gl/direct_composition_surface_win.h" +#endif #if defined(OS_ANDROID) #include "base/android/android_image_reader_compat.h" @@ -90,7 +92,7 @@ bool CollectGraphicsInfo(GPUInfo* gpu_info) { void InitializePlatformOverlaySettings(GPUInfo* gpu_info, const GpuFeatureInfo& gpu_feature_info) { -#if defined(OS_WIN) +#if defined(OS_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 c24d00943e8..bed34d112fd 100644 --- a/chromium/gpu/vulkan/vulkan_swap_chain.cc +++ b/chromium/gpu/vulkan/vulkan_swap_chain.cc @@ -384,13 +384,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 3b65eb4f2af..be6d122772d 100644 --- a/chromium/media/audio/audio_opus_encoder.cc +++ b/chromium/media/audio/audio_opus_encoder.cc @@ -113,7 +113,7 @@ void AudioOpusEncoder::Initialize(const Options& options, DCHECK(!output_callback.is_null()); DCHECK(!done_cb.is_null()); - done_cb = BindToCurrentLoop(std::move(done_cb)); + done_cb = BindToCurrentLoop(std::move(done_cb), FROM_HERE); if (opus_encoder_) { std::move(done_cb).Run(StatusCode::kEncoderInitializeTwice); return; @@ -154,7 +154,7 @@ void AudioOpusEncoder::Initialize(const Options& options, fifo_->Reset(converter_->GetMaxInputFramesRequested( converted_params_.frames_per_buffer())); - output_cb_ = BindToCurrentLoop(std::move(output_callback)); + output_cb_ = BindToCurrentLoop(std::move(output_callback), FROM_HERE); std::move(done_cb).Run(OkStatus()); } @@ -213,7 +213,7 @@ void AudioOpusEncoder::Encode(std::unique_ptr<AudioBus> audio_bus, DCHECK(!done_cb.is_null()); DCHECK(timestamp_tracker_); - 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(StatusCode::kEncoderInitializeNeverCompleted); @@ -236,7 +236,7 @@ void AudioOpusEncoder::Encode(std::unique_ptr<AudioBus> audio_bus, void AudioOpusEncoder::Flush(StatusCB done_cb) { DCHECK(!done_cb.is_null()); - done_cb = BindToCurrentLoop(std::move(done_cb)); + done_cb = BindToCurrentLoop(std::move(done_cb), FROM_HERE); if (!opus_encoder_) { std::move(done_cb).Run(StatusCode::kEncoderInitializeNeverCompleted); return; diff --git a/chromium/media/audio/audio_output_device.cc b/chromium/media/audio/audio_output_device.cc index 5ace3586045..b61fd5e7089 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 68a9652e053..33001b20e37 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 65626736273..af68f565422 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 a15162b9ff4..d7d887e2d00 100644 --- a/chromium/media/base/media_switches.cc +++ b/chromium/media/base/media_switches.cc @@ -418,7 +418,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 e8170075929..e224d7d65fd 100644 --- a/chromium/media/base/pipeline_impl.cc +++ b/chromium/media/base/pipeline_impl.cc @@ -611,7 +611,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_, @@ -685,7 +685,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( @@ -726,7 +726,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( @@ -1498,7 +1498,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/gpu/windows/d3d11_h264_accelerator.cc b/chromium/media/gpu/windows/d3d11_h264_accelerator.cc index 102a44996de..549fff122b6 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 77189d6235e..fe4eb540de6 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/base/features.cc b/chromium/net/base/features.cc index 36cc78d9987..f2d7b879d88 100644 --- a/chromium/net/base/features.cc +++ b/chromium/net/base/features.cc @@ -228,8 +228,8 @@ extern const base::FeatureParam<base::TimeDelta> kTimeoutTcpConnectAttemptMax( "TimeoutTcpConnectAttemptMax", base::Seconds(30)); -constexpr base::Feature kFirstPartySets{"FirstPartySets", - base::FEATURE_DISABLED_BY_DEFAULT}; +const base::Feature kFirstPartySets{"FirstPartySets", + base::FEATURE_DISABLED_BY_DEFAULT}; const base::FeatureParam<bool> kFirstPartySetsIsDogfooder{ &kFirstPartySets, "FirstPartySetsIsDogfooder", false}; diff --git a/chromium/net/dns/host_resolver.cc b/chromium/net/dns/host_resolver.cc index fc3112f3782..4bd0071e2b5 100644 --- a/chromium/net/dns/host_resolver.cc +++ b/chromium/net/dns/host_resolver.cc @@ -95,6 +95,9 @@ class FailingRequestImpl : public HostResolver::ResolveHostRequest, const absl::optional<std::vector<bool>>& HostResolver::ResolveHostRequest::GetExperimentalResultsForTesting() const { IMMEDIATE_CRASH(); + static const base::NoDestructor<absl::optional<std::vector<bool>>> + nullopt_result; + return *nullopt_result; } const size_t HostResolver::ManagerOptions::kDefaultRetryAttempts = diff --git a/chromium/net/dns/https_record_rdata.cc b/chromium/net/dns/https_record_rdata.cc index 109259da7f8..358a3976e62 100644 --- a/chromium/net/dns/https_record_rdata.cc +++ b/chromium/net/dns/https_record_rdata.cc @@ -479,6 +479,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/quic/platform/impl/quic_flags_impl.cc b/chromium/net/quic/platform/impl/quic_flags_impl.cc index 7aa37b241a6..12b4f247ecc 100644 --- a/chromium/net/quic/platform/impl/quic_flags_impl.cc +++ b/chromium/net/quic/platform/impl/quic_flags_impl.cc @@ -39,10 +39,10 @@ // Select the right macro based on the number of arguments. #define GET_6TH_ARG(arg1, arg2, arg3, arg4, arg5, arg6, ...) arg6 #define QUIC_PROTOCOL_FLAG_MACRO_CHOOSER(...) \ - GET_6TH_ARG(__VA_ARGS__, DEFINE_QUIC_PROTOCOL_FLAG_TWO_VALUES, \ - DEFINE_QUIC_PROTOCOL_FLAG_SINGLE_VALUE) + CR_EXPAND_ARG(GET_6TH_ARG(__VA_ARGS__, DEFINE_QUIC_PROTOCOL_FLAG_TWO_VALUES, \ + DEFINE_QUIC_PROTOCOL_FLAG_SINGLE_VALUE)) #define QUIC_PROTOCOL_FLAG(...) \ - QUIC_PROTOCOL_FLAG_MACRO_CHOOSER(__VA_ARGS__)(__VA_ARGS__) + CR_EXPAND_ARG(QUIC_PROTOCOL_FLAG_MACRO_CHOOSER(__VA_ARGS__)(__VA_ARGS__)) #include "net/third_party/quiche/src/quic/core/quic_protocol_flags_list.h" diff --git a/chromium/net/third_party/quiche/BUILD.gn b/chromium/net/third_party/quiche/BUILD.gn index 23537cba4fa..34a0157a32b 100644 --- a/chromium/net/third_party/quiche/BUILD.gn +++ b/chromium/net/third_party/quiche/BUILD.gn @@ -15,7 +15,9 @@ config("quiche_config") { "src", ] - cflags = [ "-Wno-shadow" ] + if (is_clang || !is_win) { + cflags = [ "-Wno-shadow" ] + } } # Since //net and //net/third_party/quiche have a circular dependency on each diff --git a/chromium/net/third_party/quiche/src/quic/core/frames/quic_frame.h b/chromium/net/third_party/quiche/src/quic/core/frames/quic_frame.h index 9ee45689117..814378c9f2c 100644 --- a/chromium/net/third_party/quiche/src/quic/core/frames/quic_frame.h +++ b/chromium/net/third_party/quiche/src/quic/core/frames/quic_frame.h @@ -38,7 +38,7 @@ #include "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/quic/core/quic_interval_deque.h b/chromium/net/third_party/quiche/src/quic/core/quic_interval_deque.h index 274c2e384df..a01fc801db6 100644 --- a/chromium/net/third_party/quiche/src/quic/core/quic_interval_deque.h +++ b/chromium/net/third_party/quiche/src/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/quic/core/quic_stream_send_buffer.cc b/chromium/net/third_party/quiche/src/quic/core/quic_stream_send_buffer.cc index b2ac6bfc7c4..a7f23beb61f 100644 --- a/chromium/net/third_party/quiche/src/quic/core/quic_stream_send_buffer.cc +++ b/chromium/net/third_party/quiche/src/quic/core/quic_stream_send_buffer.cc @@ -235,6 +235,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(); @@ -248,8 +270,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/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/sandbox/win/src/broker_services.cc b/chromium/sandbox/win/src/broker_services.cc index 99d04dfe938..9b34dc2edc8 100644 --- a/chromium/sandbox/win/src/broker_services.cc +++ b/chromium/sandbox/win/src/broker_services.cc @@ -440,7 +440,7 @@ ResultCode BrokerServicesBase::SpawnTarget(const wchar_t* exe_path, ResultCode* last_warning, DWORD* last_error, PROCESS_INFORMATION* target_info) { -#if DCHECK_IS_ON() +#if DCHECK_IS_ON() && !defined(TOOLKIT_QT) // This code should only be called from the exe, ensure that this is always // the case. HMODULE exe_module = nullptr; diff --git a/chromium/services/device/public/cpp/hid/hid_blocklist.cc b/chromium/services/device/public/cpp/hid/hid_blocklist.cc index 191e3f9d03e..5db1c5d0e6d 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 4c4a6806f3f..40757fa8fd0 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 @@ -158,7 +158,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 1488c8a6c0b..89c6a04b145 100644 --- a/chromium/services/video_capture/device_media_to_mojo_adapter.cc +++ b/chromium/services/video_capture/device_media_to_mojo_adapter.cc @@ -130,7 +130,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)); } @@ -139,14 +139,14 @@ 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)); } void DeviceMediaToMojoAdapter::TakePhoto(TakePhotoCallback callback) { media::mojom::ImageCapture::TakePhotoCallback scoped_callback = mojo::WrapCallbackWithDefaultInvokeIfNotRun( - media::BindToCurrentLoop(std::move(callback)), nullptr); + media::BindToCurrentLoop(std::move(callback), FROM_HERE), nullptr); device_->TakePhoto(std::move(scoped_callback)); } diff --git a/chromium/skia/BUILD.gn b/chromium/skia/BUILD.gn index e7ad2b92865..a0cc4efd31f 100644 --- a/chromium/skia/BUILD.gn +++ b/chromium/skia/BUILD.gn @@ -135,8 +135,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 04985ab9fc0..e68cd6d88bc 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 26581399cfa..eb4b63465db 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 @@ -249,7 +249,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 6d792efbe37..3c2ccc2d57a 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 @@ -338,7 +338,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 cae8eb97604..794e96a543e 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 @@ -302,9 +302,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 @@ -581,6 +583,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 2baddc4533b..c53778d78f2 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 @@ -74,7 +74,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 99cdcb17057..701488fecd7 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 @@ -29,6 +29,7 @@ #include "base/location.h" #include "third_party/blink/public/platform/task_type.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 aa047794b58..d788254e24d 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 @@ -104,7 +104,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 01bc6b9b830..40c24cfb0f8 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 @@ -199,8 +199,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 2bcac832913..728fd11f4e0 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 @@ -162,12 +162,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 7588d69e6bb..c67e3da7655 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 @@ -748,7 +748,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 599babbffb6..e3521a7a72b 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 @@ -88,6 +88,8 @@ class CORE_EXPORT NGFragmentItem { enum ItemType { kText, kSvgText, kGeneratedText, kLine, kBox }; + 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 6c9e1ced117..c8a6dcc8dc3 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 @@ -278,8 +278,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/page/scrolling/scroll_state.cc b/chromium/third_party/blink/renderer/core/page/scrolling/scroll_state.cc index 728e964d684..5fe784f0c28 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<ScrollGranularity>(init->deltaGranularity()); + static_cast<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 c0740321c2b..3739334d777 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/cache_storage/cache_storage_trace_utils.h b/chromium/third_party/blink/renderer/modules/cache_storage/cache_storage_trace_utils.h index e2d67e48dea..84e0ba37c32 100644 --- a/chromium/third_party/blink/renderer/modules/cache_storage/cache_storage_trace_utils.h +++ b/chromium/third_party/blink/renderer/modules/cache_storage/cache_storage_trace_utils.h @@ -6,6 +6,7 @@ #define THIRD_PARTY_BLINK_RENDERER_MODULES_CACHE_STORAGE_CACHE_STORAGE_TRACE_UTILS_H_ #include <memory> +#include <string> #include "third_party/blink/public/mojom/cache_storage/cache_storage.mojom-blink-forward.h" #include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-blink-forward.h" 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 e66dc59e8bf..9a56ba5043b 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 @@ -530,7 +530,12 @@ 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 + std::assert(num_radii <= 4); + 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 54c82ee7b08..7cfcbccc5b4 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 @@ -58,7 +58,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 e98a523fd04..8e20475af4e 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 @@ -33,8 +33,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; } @@ -71,8 +77,13 @@ void ScreenDetails::UpdateScreenInfos(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]); @@ -85,8 +96,12 @@ void ScreenDetails::UpdateScreenInfos(LocalDOMWindow* window, // Check if any screens have been added, and append them to the end of // 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))); @@ -138,11 +153,21 @@ void ScreenDetails::UpdateScreenInfos(LocalDOMWindow* window, for (wtf_size_t i = 0; i < screens_.size(); ++i) { const auto& screen = screens_[i]; auto id = screen->DisplayId(); - auto new_it = base::ranges::find(new_infos.screen_infos, id, - &display::ScreenInfo::display_id); + auto new_it = new_infos.screen_infos.begin(); + for (; new_it != new_infos.screen_infos.end(); ++new_it) { + if (new_it->display_id == id) + break; + } +// base::ranges::find(new_infos.screen_infos, id, +// &display::ScreenInfo::display_id); DCHECK(new_it != new_infos.screen_infos.end()); - auto old_it = base::ranges::find(prev_screen_infos_.screen_infos, id, - &display::ScreenInfo::display_id); + auto old_it = prev_screen_infos_.screen_infos.begin(); + for (; old_it != new_infos.screen_infos.end(); ++old_it) { + if (old_it->display_id == id) + break; + } +// auto old_it = base::ranges::find(prev_screen_infos_.screen_infos, id, +// &display::ScreenInfo::display_id); if (old_it != prev_screen_infos_.screen_infos.end() && !ScreenDetailed::AreWebExposedScreenDetailedPropertiesEqual(*old_it, *new_it)) { 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 085557d6016..cf17a437971 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 @@ -9,8 +9,8 @@ dictionary AudioParamDescriptor { // TODO(hongchan): These numbers are minimum/maximum number possible for // |float| type. Remove this comment when the spec is fixed. - 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 e8caa61dcc5..d2935b88497 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 @@ -48,10 +48,10 @@ static 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()); @@ -59,32 +59,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 bf86e538978..9f3f3d3e4af 100644 --- a/chromium/third_party/blink/renderer/modules/webaudio/biquad_processor.cc +++ b/chromium/third_party/blink/renderer/modules/webaudio/biquad_processor.cc @@ -140,12 +140,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 addcccccadc..cf6fcee85a5 100644 --- a/chromium/third_party/blink/renderer/modules/webaudio/delay_processor.cc +++ b/chromium/third_party/blink/renderer/modules/webaudio/delay_processor.cc @@ -53,9 +53,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_node.cc b/chromium/third_party/blink/renderer/modules/webaudio/dynamics_compressor_node.cc index b7d6de9cc1f..11acc2f75f5 100644 --- a/chromium/third_party/blink/renderer/modules/webaudio/dynamics_compressor_node.cc +++ b/chromium/third_party/blink/renderer/modules/webaudio/dynamics_compressor_node.cc @@ -114,13 +114,13 @@ void DynamicsCompressorHandler::ProcessOnlyAudioParams( DCHECK(Context()->IsAudioThread()); DCHECK_LE(frames_to_process, GetDeferredTaskHandler().RenderQuantumFrames()); - float values[GetDeferredTaskHandler().RenderQuantumFrames()]; + 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_node.cc b/chromium/third_party/blink/renderer/modules/webaudio/gain_node.cc index ed374a443bd..8df24b5e71c 100644 --- a/chromium/third_party/blink/renderer/modules/webaudio/gain_node.cc +++ b/chromium/third_party/blink/renderer/modules/webaudio/gain_node.cc @@ -101,9 +101,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); } // FIXME: this can go away when we do mixing with gain directly in summing diff --git a/chromium/third_party/blink/renderer/modules/webaudio/panner_node.cc b/chromium/third_party/blink/renderer/modules/webaudio/panner_node.cc index 9deef42f57d..948f73ff0a6 100644 --- a/chromium/third_party/blink/renderer/modules/webaudio/panner_node.cc +++ b/chromium/third_party/blink/renderer/modules/webaudio/panner_node.cc @@ -236,22 +236,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. @@ -278,9 +278,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) { FloatPoint3D panner_position(panner_x[k], panner_y[k], panner_z[k]); @@ -305,25 +305,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_node.cc b/chromium/third_party/blink/renderer/modules/webaudio/stereo_panner_node.cc index f92279495aa..5b83884cf20 100644 --- a/chromium/third_party/blink/renderer/modules/webaudio/stereo_panner_node.cc +++ b/chromium/third_party/blink/renderer/modules/webaudio/stereo_panner_node.cc @@ -83,10 +83,11 @@ 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()); + //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 7e26b65b801..d40c32ca3b1 100644 --- a/chromium/third_party/blink/renderer/platform/audio/audio_bus.cc +++ b/chromium/third_party/blink/renderer/platform/audio/audio_bus.cc @@ -672,7 +672,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 a721a886d17..c08e3354d6e 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 49f013ab457..d444a94a9eb 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 @@ -1174,15 +1174,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 23545ccfd34..7d42b468cfb 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 @@ -39,7 +39,8 @@ class DarkModeInvertedColorCache { return *cached_value; 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 1b7cd9ab407..0c3044362e7 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 @@ -223,9 +223,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/wtf/allocator/allocator.h b/chromium/third_party/blink/renderer/platform/wtf/allocator/allocator.h index b9eec06c43b..173f6e293ee 100644 --- a/chromium/third_party/blink/renderer/platform/wtf/allocator/allocator.h +++ b/chromium/third_party/blink/renderer/platform/wtf/allocator/allocator.h @@ -78,7 +78,7 @@ class __thisIsHereToForceASemicolonAfterThisMacro; #define STACK_ALLOCATED() \ public: \ - using IsStackAllocatedTypeMarker [[maybe_unused]] = int; \ + using IsStackAllocatedTypeMarker = int; \ \ private: \ ANNOTATE_STACK_ALLOCATED void* operator new(size_t) = delete; \ diff --git a/chromium/third_party/expat/BUILD.gn b/chromium/third_party/expat/BUILD.gn index 93ce32b1413..88fbbeb8f19 100644 --- a/chromium/third_party/expat/BUILD.gn +++ b/chromium/third_party/expat/BUILD.gn @@ -26,14 +26,16 @@ if ((is_linux || is_chromeos) && !is_chromecast && !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 e917f515dda..8bb310fe3df 100644 --- a/chromium/third_party/ffmpeg/ffmpeg_options.gni +++ b/chromium/third_party/ffmpeg/ffmpeg_options.gni @@ -51,7 +51,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 1b1a0f61039..7c2012d4ae2 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 @@ -213,6 +213,11 @@ struct PERFETTO_TTS_ALIGNMENT 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 bbf64318e65..325e536d2a2 100644 --- a/chromium/third_party/skia/include/core/SkTypes.h +++ b/chromium/third_party/skia/include/core/SkTypes.h @@ -471,10 +471,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/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 ad45047cfcc..3dc5496636f 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 @@ -179,6 +179,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/aura/BUILD.gn b/chromium/ui/aura/BUILD.gn index 49394895f23..0a1516685f8 100644 --- a/chromium/ui/aura/BUILD.gn +++ b/chromium/ui/aura/BUILD.gn @@ -150,9 +150,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/cursor/cursors_aura.cc b/chromium/ui/aura/cursor/cursors_aura.cc index f22b71592a2..a7b4e0641dc 100644 --- a/chromium/ui/aura/cursor/cursors_aura.cc +++ b/chromium/ui/aura/cursor/cursors_aura.cc @@ -17,7 +17,7 @@ #include "ui/gfx/image/image_skia.h" #include "ui/resources/grit/ui_resources.h" -#if defined(OS_WIN) +#if defined(OS_WIN) && !defined(TOOLKIT_QT) #include "ui/aura/cursor/cursor_loader.h" #include "ui/base/win/win_cursor.h" #include "ui/gfx/icon_util.h" @@ -330,7 +330,7 @@ bool GetCursorDataFor(ui::CursorSize cursor_size, } SkBitmap GetDefaultBitmap(const ui::Cursor& cursor) { -#if defined(OS_WIN) +#if defined(OS_WIN) && !defined(TOOLKIT_QT) ui::Cursor cursor_copy = cursor; aura::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 defined(OS_WIN) +#if defined(OS_WIN) && !defined(TOOLKIT_QT) ui::Cursor cursor_copy = cursor; aura::CursorLoader cursor_loader; cursor_loader.SetPlatformCursor(&cursor_copy); diff --git a/chromium/ui/aura/env.cc b/chromium/ui/aura/env.cc index f458afd57c0..66e7ef28c87 100644 --- a/chromium/ui/aura/env.cc +++ b/chromium/ui/aura/env.cc @@ -204,7 +204,7 @@ Env::Env() : env_controller_(std::make_unique<EnvInputStateController>(this)), gesture_recognizer_(std::make_unique<ui::GestureRecognizerImpl>()), input_state_lookup_(InputStateLookup::Create()) { -#if defined(OS_WIN) +#if defined(OS_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 e80c9dd023f..217eccdf83b 100644 --- a/chromium/ui/aura/window_tree_host_platform.cc +++ b/chromium/ui/aura/window_tree_host_platform.cc @@ -71,7 +71,7 @@ void WindowTreeHostPlatform::CreateAndSetPlatformWindow( #if defined(USE_OZONE) platform_window_ = ui::OzonePlatform::GetInstance()->CreatePlatformWindow( this, std::move(properties)); -#elif defined(OS_WIN) +#elif defined(OS_WIN) && !defined(TOOLKIT_QT) platform_window_ = std::make_unique<ui::WinWindow>(this, properties.bounds); #else NOTIMPLEMENTED(); diff --git a/chromium/ui/base/clipboard/clipboard_format_type.h b/chromium/ui/base/clipboard/clipboard_format_type.h index e08d4c7f383..e31fb6c44c3 100644 --- a/chromium/ui/base/clipboard/clipboard_format_type.h +++ b/chromium/ui/base/clipboard/clipboard_format_type.h @@ -62,7 +62,7 @@ class COMPONENT_EXPORT(UI_BASE_CLIPBOARD_TYPES) ClipboardFormatType { static const ClipboardFormatType& BitmapType(); static const ClipboardFormatType& WebCustomDataType(); -#if defined(OS_WIN) +#if defined(OS_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/metadata/base_type_conversion.cc b/chromium/ui/base/metadata/base_type_conversion.cc index ae3e4d24159..c7b9fa0cebe 100644 --- a/chromium/ui/base/metadata/base_type_conversion.cc +++ b/chromium/ui/base/metadata/base_type_conversion.cc @@ -407,21 +407,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, @@ -456,7 +456,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) { @@ -464,7 +464,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) { @@ -483,7 +483,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; @@ -491,7 +491,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; @@ -511,7 +511,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)) { @@ -524,7 +524,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); @@ -551,7 +551,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 6459687fd77..5367d776378 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 112e49bb46b..487a036598b 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 #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 diff --git a/chromium/ui/display/display_list.cc b/chromium/ui/display/display_list.cc index d76e9059585..be663b82c2d 100644 --- a/chromium/ui/display/display_list.cc +++ b/chromium/ui/display/display_list.cc @@ -23,7 +23,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() @@ -162,7 +166,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 5de6ee77761..4ac4d8026b8 100644 --- a/chromium/ui/display/screen_infos.cc +++ b/chromium/ui/display/screen_infos.cc @@ -27,9 +27,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 f7c9cfdc953..52b730e3fa5 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 8043d883b9b..5ced2800f41 100644 --- a/chromium/ui/gl/gl_utils.cc +++ b/chromium/ui/gl/gl_utils.cc @@ -63,7 +63,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 078e01ef35f..e7a3d8d95dc 100644 --- a/chromium/ui/gl/init/gl_factory.cc +++ b/chromium/ui/gl/init/gl_factory.cc @@ -81,25 +81,25 @@ GLImplementationParts GetRequestedGLImplementation( // If the passthrough command decoder is enabled, put ANGLE first if allowed if (g_is_angle_enabled && gl::UsePassthroughCommandDecoder(cmd)) { std::vector<GLImplementationParts> angle_impls = {}; + std::vector<GLImplementationParts> new_allowed_impls = {}; bool software_gl_allowed = false; bool legacy_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) == GetLegacySoftwareGLImplementation()) { legacy_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 33562b508e2..3d94fe483b9 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)); impls.emplace_back(GLImplementationParts(kGLImplementationSwiftShaderGL)); return impls; diff --git a/chromium/ui/platform_window/BUILD.gn b/chromium/ui/platform_window/BUILD.gn index 9db1f75aa30..9fcbe23b0af 100644 --- a/chromium/ui/platform_window/BUILD.gn +++ b/chromium/ui/platform_window/BUILD.gn @@ -61,7 +61,7 @@ group("platform_impls") { public_deps = [ "//ui/platform_window/stub" ] if (ozone_platform_x11) { public_deps += [ "//ui/platform_window/x11" ] - } else if (is_win) { + } else 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 f7282e3fda5..d540cba5149 100644 --- a/chromium/ui/views/BUILD.gn +++ b/chromium/ui/views/BUILD.gn @@ -795,7 +795,7 @@ jumbo_component("views") { "widget/desktop_aura/desktop_window_tree_host.cc", ] public_deps += [ "//ui/aura/cursor" ] - 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/url/origin.cc b/chromium/url/origin.cc index 6bcf0113476..48ba6c9962b 100644 --- a/chromium/url/origin.cc +++ b/chromium/url/origin.cc @@ -411,7 +411,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 222f1d290f1..dc9c13b020d 100644 --- a/chromium/url/origin.h +++ b/chromium/url/origin.h @@ -325,7 +325,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 dd5c8b2d9aa..713c3f6ed23 100644 --- a/chromium/v8/src/codegen/assembler.cc +++ b/chromium/v8/src/codegen/assembler.cc @@ -130,6 +130,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 3bde90f81ff..bd1a0a6878d 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 afa23e051a4..769c3e2a8bc 100644 --- a/chromium/v8/src/heap/free-list.h +++ b/chromium/v8/src/heap/free-list.h @@ -268,22 +268,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 68abf816b04..789ef7dfdf7 100644 --- a/chromium/v8/src/heap/heap-inl.h +++ b/chromium/v8/src/heap/heap-inl.h @@ -135,8 +135,6 @@ MUTABLE_ROOT_LIST(ROOT_ACCESSOR) /* 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_; } |