Bug 226530

Summary: Style::Scope should use CheckedPtr
Product: WebKit Reporter: Antti Koivisto <koivisto>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: annulen, benjamin, cdumez, cmarcelo, ews-watchlist, gyuyoung.kim, Hironori.Fujii, rniwa, ryuan.choi, sam, sergio, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=226369
Attachments:
Description Flags
patch
ews-feeder: commit-queue-
patch none

Description Antti Koivisto 2021-06-02 03:41:23 PDT
Instead of WeakPtr.
Comment 1 Antti Koivisto 2021-06-02 03:45:12 PDT
Created attachment 430332 [details]
patch
Comment 2 Antti Koivisto 2021-06-02 04:00:16 PDT
Created attachment 430333 [details]
patch
Comment 3 EWS 2021-06-02 09:21:23 PDT
Committed r278355 (238387@main): <https://commits.webkit.org/238387@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 430333 [details].
Comment 4 Radar WebKit Bug Importer 2021-06-02 09:22:19 PDT
<rdar://problem/78767262>
Comment 5 Fujii Hironori 2021-06-02 14:12:15 PDT
Comment on attachment 430333 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=430333&action=review

> Source/WebCore/style/StyleScope.cpp:671
> +        resolverScopes.add(makeRef(*resolver), Vector<CheckedPtr<Scope>> { }).iterator->value.append(&scope);

You add an empty vector, and append a single Scope.
Does this vector always have only a single Scope?
If so, why is ResolverScopes's ValueType using Vector<CheckedPtr<Scope>>?
Comment 6 Chris Dumez 2021-06-02 14:18:25 PDT
Comment on attachment 430333 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=430333&action=review

>> Source/WebCore/style/StyleScope.cpp:671
>> +        resolverScopes.add(makeRef(*resolver), Vector<CheckedPtr<Scope>> { }).iterator->value.append(&scope);
> 
> You add an empty vector, and append a single Scope.
> Does this vector always have only a single Scope?
> If so, why is ResolverScopes's ValueType using Vector<CheckedPtr<Scope>>?

We're in a loop so we may add more scope than one to the Vector. (Note that add() is a no-op if the key already exists)
Comment 7 Antti Koivisto 2021-06-02 23:35:33 PDT
It would be nice to have a single-argument version of add (or ensure) where the value is default constructed.
Comment 8 Ryosuke Niwa 2021-06-02 23:55:49 PDT
(In reply to Antti Koivisto from comment #7)
> It would be nice to have a single-argument version of add (or ensure) where
> the value is default constructed.

Maybe we can just add the default argument value to it...