Bug 136809
| Summary: | TYPE_CASTS_BASE needs to support both for pointer and reference argument by single expression | ||
|---|---|---|---|
| Product: | WebKit | Reporter: | Gyuyoung Kim <gyuyoung.kim> |
| Component: | WebCore Misc. | Assignee: | Nobody <webkit-unassigned> |
| Status: | NEW | ||
| Severity: | Normal | CC: | darin |
| Priority: | P2 | ||
| Version: | 528+ (Nightly build) | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Bug Depends on: | |||
| Bug Blocks: | 136773 | ||
Gyuyoung Kim
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
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
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
(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?