Bug 177817 - Allow assigning WeakPtr<Derived> to WeakPtr<Base>
Summary: Allow assigning WeakPtr<Derived> to WeakPtr<Base>
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-10-03 08:14 PDT by Antti Koivisto
Modified: 2017-10-03 12:02 PDT (History)
10 users (show)

See Also:


Attachments
patch (5.87 KB, patch)
2017-10-03 08:19 PDT, Antti Koivisto
no flags Details | Formatted Diff | Diff
patch (6.23 KB, patch)
2017-10-03 08:23 PDT, Antti Koivisto
no flags Details | Formatted Diff | Diff
patch (6.23 KB, patch)
2017-10-03 08:25 PDT, Antti Koivisto
no flags Details | Formatted Diff | Diff
patch (6.28 KB, patch)
2017-10-03 08:33 PDT, Antti Koivisto
ggaren: review+
Details | Formatted Diff | Diff
patch (6.82 KB, patch)
2017-10-03 09:41 PDT, Antti Koivisto
no flags Details | Formatted Diff | Diff
patch (6.81 KB, patch)
2017-10-03 10:13 PDT, Antti Koivisto
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antti Koivisto 2017-10-03 08:14:12 PDT
More templates!
Comment 1 Antti Koivisto 2017-10-03 08:19:51 PDT
Created attachment 322519 [details]
patch
Comment 2 Antti Koivisto 2017-10-03 08:23:41 PDT
Created attachment 322521 [details]
patch
Comment 3 Antti Koivisto 2017-10-03 08:25:56 PDT
Created attachment 322523 [details]
patch
Comment 4 Antti Koivisto 2017-10-03 08:33:39 PDT
Created attachment 322525 [details]
patch
Comment 5 Geoffrey Garen 2017-10-03 08:38:20 PDT
Comment on attachment 322525 [details]
patch

r=me

Now that it's in five places, I think it's time to make a helper function that does the static_assert and reinterpret_cast on WeakReference<T>. Maybe call it static_weak_pointer_cast.
Comment 6 Antti Koivisto 2017-10-03 09:41:29 PDT
Created attachment 322536 [details]
patch
Comment 7 Antti Koivisto 2017-10-03 09:42:29 PDT
I added two helpers called weak_reference_downcast and weak_reference_upcast (the static_assert is the other way round).
Comment 8 Antti Koivisto 2017-10-03 10:13:25 PDT
Created attachment 322539 [details]
patch
Comment 9 Antti Koivisto 2017-10-03 11:49:35 PDT
https://trac.webkit.org/r222793
Comment 10 Radar WebKit Bug Importer 2017-10-03 11:50:33 PDT
<rdar://problem/34795432>
Comment 11 Geoffrey Garen 2017-10-03 11:58:25 PDT
Nice!