void-packages/srcpkgs/electron9/files/patches/chromium-fix-template-speci...

65 lines
2.4 KiB
Diff

GCC: fix template specialization in WTF::VectorMover
GCC complains that explicit specialization in non-namespace scope
is happening for MoveOverlappingImpl. However, secialization is
not really necessary here with templates and can be moved
into MoveOverlappingImpl method without changing generated code.
Bug: 819294
Change-Id: I90b893b9701748302f7b900fbcc2c341685fe0d3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2126290
Reviewed-by: Kent Tamura <tkent@chromium.org>
Commit-Queue: Kent Tamura <tkent@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756880}
diff --git a/third_party/blink/renderer/platform/wtf/vector.h b/third_party/blink/renderer/platform/wtf/vector.h
index 632d308..82aaf96 100644
--- a/third_party/blink/renderer/platform/wtf/vector.h
+++ b/third_party/blink/renderer/platform/wtf/vector.h
@@ -205,30 +205,23 @@
}
}
- template <bool = Allocator::kIsGarbageCollected>
- static void MoveOverlappingImpl(const T* src, const T* src_end, T* dst);
- template <>
- static void MoveOverlappingImpl<false>(const T* src,
- const T* src_end,
- T* dst) {
- memmove(dst, src,
- reinterpret_cast<const char*>(src_end) -
- reinterpret_cast<const char*>(src));
- }
- template <>
- static void MoveOverlappingImpl<true>(const T* src,
- const T* src_end,
- T* dst) {
- if (src == dst)
- return;
- if (dst < src) {
- for (; src < src_end; ++src, ++dst)
- AtomicWriteMemcpy<sizeof(T)>(dst, src);
+ static void MoveOverlappingImpl(const T* src, const T* src_end, T* dst) {
+ if (Allocator::kIsGarbageCollected) {
+ if (src == dst)
+ return;
+ if (dst < src) {
+ for (; src < src_end; ++src, ++dst)
+ AtomicWriteMemcpy<sizeof(T)>(dst, src);
+ } else {
+ --src_end;
+ T* dst_end = dst + (src_end - src);
+ for (; src_end >= src; --src_end, --dst_end)
+ AtomicWriteMemcpy<sizeof(T)>(dst_end, src_end);
+ }
} else {
- --src_end;
- T* dst_end = dst + (src_end - src);
- for (; src_end >= src; --src_end, --dst_end)
- AtomicWriteMemcpy<sizeof(T)>(dst_end, src_end);
+ memmove(dst, src,
+ reinterpret_cast<const char*>(src_end) -
+ reinterpret_cast<const char*>(src));
}
}