Re: [webkit-dev] RefPtr/PassRefPtr Question
fwiw, check-webkit-style has been fixed: http://trac.webkit.org/changeset/94803 On Wed, Sep 7, 2011 at 7:56 AM, Darin Adler da...@apple.com wrote: On Sep 6, 2011, at 6:24 PM, Maciej Stachowiak wrote: On Aug 31, 2011, at 3:31 PM, David Levin wrote: Ignore me. I'm missing the . I suppose if you want a RefPtr, then the style checker is wrong and the parameter should be allowed to be a RefPtr. Feel free to file a bug and I'll get to it (-- it may take me a week or two at the moment). It should definitely be allowed - it's a good way to represent I need a T and I won't take ownership, but I want to guarantee that my caller is holding on to this. Yes. Also a good way to represent a RefPtr out parameter for a function with more than one return value. Also occasionally useful to make a function that conditionally takes ownership of something passed in. -- Darin ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
Re: [webkit-dev] RefPtr/PassRefPtr Question
On Sep 6, 2011, at 6:24 PM, Maciej Stachowiak wrote: On Aug 31, 2011, at 3:31 PM, David Levin wrote: Ignore me. I'm missing the . I suppose if you want a RefPtr, then the style checker is wrong and the parameter should be allowed to be a RefPtr. Feel free to file a bug and I'll get to it (-- it may take me a week or two at the moment). It should definitely be allowed - it's a good way to represent I need a T and I won't take ownership, but I want to guarantee that my caller is holding on to this. Yes. Also a good way to represent a RefPtr out parameter for a function with more than one return value. Also occasionally useful to make a function that conditionally takes ownership of something passed in. -- Darin ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
Re: [webkit-dev] RefPtr/PassRefPtr Question
On Aug 31, 2011, at 3:31 PM, David Levin wrote: Ignore me. I'm missing the . I suppose if you want a RefPtr, then the style checker is wrong and the parameter should be allowed to be a RefPtr. Feel free to file a bug and I'll get to it (-- it may take me a week or two at the moment). It should definitely be allowed - it's a good way to represent I need a T and I won't take ownership, but I want to guarantee that my caller is holding on to this. - Maciej dave On Wed, Aug 31, 2011 at 3:28 PM, David Levin le...@google.com wrote: Any of these should work: RefPtrT myLocal; bool success = myFunc(myLocal); Uses templatetypename U PassRefPtr(const RefPtrU); Or RefPtrT myLocal; bool success = myFunc(myLocal.release()); Or RefPtrT myLocal; bool success = myFunc(myLocal.get()); Uses PassRefPtr(T* ptr) The second form is prefered if you won't be using myLocal again in the function. I would use the first form if you are using myLocal again. dave On Wed, Aug 31, 2011 at 3:16 PM, David Hyatt hy...@apple.com wrote: I am getting complaints from check-webkit-style in a bug regarding PassRefPtr/RefPtr usage, and I can't figure out what I should be doing. It yells at me no matter what I try. The scenario I have is that a function is wanting to transfer ownership but it's not doing it via a return value. Instead it is filling in a reference parameter. The current code looks like this: Caller: RefPtrT myLocal; bool success = myFunc(myLocal); With the function being: bool myFunc(RefPtrT result); With this setup though, I get yelled at by the style checker and it tells me that the parameter should be a PassRefPtr. However I don't get how I can do that, since then I have: PassRefPtrT myLocal; and I get yelled at for making a PassRefPtr local variable. What's the right way to write this code such that it will pass? Is this just a flaw in the style checker? It sure seems like a RefPtrT reference parameter should be allowed... dave (hy...@apple.com) ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
[webkit-dev] RefPtr/PassRefPtr Question
I am getting complaints from check-webkit-style in a bug regarding PassRefPtr/RefPtr usage, and I can't figure out what I should be doing. It yells at me no matter what I try. The scenario I have is that a function is wanting to transfer ownership but it's not doing it via a return value. Instead it is filling in a reference parameter. The current code looks like this: Caller: RefPtrT myLocal; bool success = myFunc(myLocal); With the function being: bool myFunc(RefPtrT result); With this setup though, I get yelled at by the style checker and it tells me that the parameter should be a PassRefPtr. However I don't get how I can do that, since then I have: PassRefPtrT myLocal; and I get yelled at for making a PassRefPtr local variable. What's the right way to write this code such that it will pass? Is this just a flaw in the style checker? It sure seems like a RefPtrT reference parameter should be allowed... dave (hy...@apple.com) ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
Re: [webkit-dev] RefPtr/PassRefPtr Question
Any of these should work: RefPtrT myLocal; bool success = myFunc(myLocal); Uses templatetypename U PassRefPtr(const RefPtrU); Or RefPtrT myLocal; bool success = myFunc(myLocal.release()); Or RefPtrT myLocal; bool success = myFunc(myLocal.get()); Uses PassRefPtr(T* ptr) The second form is prefered if you won't be using myLocal again in the function. I would use the first form if you are using myLocal again. dave On Wed, Aug 31, 2011 at 3:16 PM, David Hyatt hy...@apple.com wrote: I am getting complaints from check-webkit-style in a bug regarding PassRefPtr/RefPtr usage, and I can't figure out what I should be doing. It yells at me no matter what I try. The scenario I have is that a function is wanting to transfer ownership but it's not doing it via a return value. Instead it is filling in a reference parameter. The current code looks like this: Caller: RefPtrT myLocal; bool success = myFunc(myLocal); With the function being: bool myFunc(RefPtrT result); With this setup though, I get yelled at by the style checker and it tells me that the parameter should be a PassRefPtr. However I don't get how I can do that, since then I have: PassRefPtrT myLocal; and I get yelled at for making a PassRefPtr local variable. What's the right way to write this code such that it will pass? Is this just a flaw in the style checker? It sure seems like a RefPtrT reference parameter should be allowed... dave (hy...@apple.com) ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
Re: [webkit-dev] RefPtr/PassRefPtr Question
Ignore me. I'm missing the . I suppose if you want a RefPtr, then the style checker is wrong and the parameter should be allowed to be a RefPtr. Feel free to file a bug and I'll get to it (-- it may take me a week or two at the moment). dave On Wed, Aug 31, 2011 at 3:28 PM, David Levin le...@google.com wrote: Any of these should work: RefPtrT myLocal; bool success = myFunc(myLocal); Uses templatetypename U PassRefPtr(const RefPtrU); Or RefPtrT myLocal; bool success = myFunc(myLocal.release()); Or RefPtrT myLocal; bool success = myFunc(myLocal.get()); Uses PassRefPtr(T* ptr) The second form is prefered if you won't be using myLocal again in the function. I would use the first form if you are using myLocal again. dave On Wed, Aug 31, 2011 at 3:16 PM, David Hyatt hy...@apple.com wrote: I am getting complaints from check-webkit-style in a bug regarding PassRefPtr/RefPtr usage, and I can't figure out what I should be doing. It yells at me no matter what I try. The scenario I have is that a function is wanting to transfer ownership but it's not doing it via a return value. Instead it is filling in a reference parameter. The current code looks like this: Caller: RefPtrT myLocal; bool success = myFunc(myLocal); With the function being: bool myFunc(RefPtrT result); With this setup though, I get yelled at by the style checker and it tells me that the parameter should be a PassRefPtr. However I don't get how I can do that, since then I have: PassRefPtrT myLocal; and I get yelled at for making a PassRefPtr local variable. What's the right way to write this code such that it will pass? Is this just a flaw in the style checker? It sure seems like a RefPtrT reference parameter should be allowed... dave (hy...@apple.com) ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev ___ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev