Issue metadata
Sign in to add a comment
|
Remove duplication between base::WrapUnique and WTF::wrapUnique (and similar pairs of functions) |
||||||||||||||||||||||||
Issue descriptionFrom https://codereview.chromium.org/2547053003/#msg14: we shouldn't have two different implementations of WrapUnique(). Can we move assert() in WTF::wrapUnique() to base::WrapUnique(), or can we implement the assertion in blink-gc clang plugin?
,
Dec 6 2016
,
Dec 6 2016
There's a cost to implementing checks in clang: it doesn't work in MSVC, it's harder to make changes, any changes take longer to propagate through the system, and it can make compiler rolls harder. It is a bit unfortunate to have this bit of duplication, but it doesn't feel overly burdensome either.
,
Dec 6 2016
https://codereview.chromium.org/2547053003/#msg16 haraken@ wrote: > What's the advantage of removing WTF::wrapUnique, in the first place? We are not > allowed to use base:: types directly in core/ and modules/, so we anyway need to > wrap the base:: types in wtf/. Right. There would be no much benefit because we limit base:: usage in Blink. Just code duplication is harmful in general. So if we need much effort to consolidate implementations into one, I don't think we need to do so. Ok, blink-gc plugin isn't reasonable. I think it's not difficult to move IsGarbageCollectedType to base.
,
Dec 6 2016
wrapUnique is so small and obvious that I don't care about code duplication. I'm in favor of WONTFIX-ing this.
,
Dec 6 2016
Also, Clang plugins should be used for checks that cannot be expressed in C++. If the equivalent check can be written in C++, the C++ version would be superior in all respects.
,
Jan 9 2017
,
Nov 29 2017
,
Mar 26 2018
|
|||||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||||
Comment 1 by lukasza@chromium.org
, Dec 6 2016Status: Assigned (was: Available)
haraken@, would you agree that this sounds like something that could be implemented in blink-gc clang plugin? I think this route sounds promising - if we can implement the equivalent of static_asserts from wtf/PtrUtil.h in blink-gc clang plugin, then wtf/PtrUtil.h can have no function bodies and can just say: namespace WTF { template <typename T> using makeUnique = base::MakeUnique<T> template <typename T> using wrapUnique = base::WrapUnique<T> ... } IMO, the static asserts cannot be moved into //base (because //base doesn't know anything about things like WTF::IsGarbageCollectedType<T>.