WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
136809
TYPE_CASTS_BASE needs to support both for pointer and reference argument by single expression
https://bugs.webkit.org/show_bug.cgi?id=136809
Summary
TYPE_CASTS_BASE needs to support both for pointer and reference argument by s...
Gyuyoung Kim
Reported
2014-09-14 20:04:54 PDT
As suggested in
https://bugs.webkit.org/show_bug.cgi?id=136775#c3
, TYPE_CASTS_BASE needs to support .get() globally.
Attachments
Add attachment
proposed patch, testcase, etc.
Darin Adler
Comment 1
2014-09-14 22:30:38 PDT
If we really want to make toXXX(RefPtr) give us a raw pointer, then I think toXXX(Ref) and toXXX(PassRef) should give use a raw reference. A good way to do that is to make a template that can take any type and use getPtr to turn the pointer into a raw pointer. That will work on all smart pointer types that we overload getPtr for. Similarly, we could create a getReference to make this generic across all smart reference types. I think that’s better than something specific to RefPtr.
Gyuyoung Kim
Comment 2
2014-09-16 08:08:25 PDT
Darin, there are some specific use cases of TYPE_CASTS_BASE. For example, CSS_BASIC_SHAPES_TYPE_CASTS compares argument type to predicate argument. In this case, it is hard to convert a pointer to a reference using *(X) in the macro. #define CSS_BASIC_SHAPES_TYPE_CASTS(ToValueTypeName, predicate) \ TYPE_CASTS_BASE(ToValueTypeName, CSSBasicShape, basicShape, basicShape->type() == predicate, basicShape.type() == predicate) Any suggestion about those cases ?
Darin Adler
Comment 3
2014-09-16 09:03:34 PDT
(In reply to
comment #2
)
> Darin, there are some specific use cases of TYPE_CASTS_BASE. For example, CSS_BASIC_SHAPES_TYPE_CASTS compares argument type to predicate argument. In this case, it is hard to convert a pointer to a reference using *(X) in the macro. > > #define CSS_BASIC_SHAPES_TYPE_CASTS(ToValueTypeName, predicate) \ > TYPE_CASTS_BASE(ToValueTypeName, CSSBasicShape, basicShape, basicShape->type() == predicate, basicShape.type() == predicate) > > Any suggestion about those cases ?
I don’t see the problem you are talking about. a) basicShape->type() == predicate b) basicShape.type() == predicate c) (*basicShape).type() == predicate It seems the macro could use (*x) to use the second expression only and not need (a). Maybe I could advise you on approach if you posted a partial unsuccessful attempt?
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug