summaryrefslogtreecommitdiff
path: root/www-client/chromium/files/chromium-87-CrossThreadPersistent-template.patch
blob: 585c91fe91fe968e5c86a223df0d518859c89505 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
From 37070745728cd7744e12fa5110cde304ab6a048d Mon Sep 17 00:00:00 2001
From: Jose Dapena Paz <jdapena@igalia.com>
Date: Tue, 15 Sep 2020 16:55:19 +0200
Subject: [PATCH] GCC: avoid GCC getting confused with wrong using resolution in CrossThreadPersistent

In the method to assign a CrossThreadWeakPersistent<U> to a CrossThreadPersistent<T>,
there is a call to the parent class implementation of Get. It uses Parent, that is,
in CrossThreadPersistent<T> an alias to its parent. GCC resolves it as that, but
that's wrong, and it should resolve to the parent of CrossThreadWeakPersistent<U>.

To avoid the problem, we define in that method ParentU resolving to the right
parent, and use a static cast to it.

Bug: 819294
Change-Id: I0152dac92d4a28eb1f1abbc56473204b62f33797
---

diff --git a/third_party/blink/renderer/platform/heap/persistent.h b/third_party/blink/renderer/platform/heap/persistent.h
index f08f42f..32cadc0 100644
--- a/third_party/blink/renderer/platform/heap/persistent.h
+++ b/third_party/blink/renderer/platform/heap/persistent.h
@@ -784,7 +784,9 @@
 CrossThreadPersistent<T>& CrossThreadPersistent<T>::operator=(
     const CrossThreadWeakPersistent<U>& other) {
   MutexLocker locker(ProcessHeap::CrossThreadPersistentMutex());
-  this->AssignUnsafe(other.Parent::Get());
+  using ParentU = PersistentBase<U, kWeakPersistentConfiguration,
+                                 kCrossThreadPersistentConfiguration>;
+  this->AssignUnsafe(static_cast<const ParentU&>(other).Get());
   return *this;
 }