<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>136809</bug_id>
          
          <creation_ts>2014-09-14 20:04:54 -0700</creation_ts>
          <short_desc>TYPE_CASTS_BASE needs to support both for pointer and reference argument by single expression</short_desc>
          <delta_ts>2014-09-16 09:03:34 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore Misc.</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>136773</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Gyuyoung Kim">gyuyoung.kim</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>darin</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1035145</commentid>
    <comment_count>0</comment_count>
    <who name="Gyuyoung Kim">gyuyoung.kim</who>
    <bug_when>2014-09-14 20:04:54 -0700</bug_when>
    <thetext>As suggested in https://bugs.webkit.org/show_bug.cgi?id=136775#c3, TYPE_CASTS_BASE needs to support .get() globally.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1035167</commentid>
    <comment_count>1</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2014-09-14 22:30:38 -0700</bug_when>
    <thetext>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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1035467</commentid>
    <comment_count>2</comment_count>
    <who name="Gyuyoung Kim">gyuyoung.kim</who>
    <bug_when>2014-09-16 08:08:25 -0700</bug_when>
    <thetext>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-&gt;type() == predicate, basicShape.type() == predicate) 

Any suggestion about those cases ?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1035480</commentid>
    <comment_count>3</comment_count>
    <who name="Darin Adler">darin</who>
    <bug_when>2014-09-16 09:03:34 -0700</bug_when>
    <thetext>(In reply to comment #2)
&gt; 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.
&gt; 
&gt; #define CSS_BASIC_SHAPES_TYPE_CASTS(ToValueTypeName, predicate) \
&gt;     TYPE_CASTS_BASE(ToValueTypeName, CSSBasicShape, basicShape, basicShape-&gt;type() == predicate, basicShape.type() == predicate) 
&gt; 
&gt; Any suggestion about those cases ?

I don’t see the problem you are talking about.

    a) basicShape-&gt;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?</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>