Bug 138361 - Add ptr() method to Ref class
Summary: Add ptr() method to Ref class
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Template Framework (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-04 10:23 PST by Chris Dumez
Modified: 2014-11-04 15:00 PST (History)
7 users (show)

See Also:


Attachments
Patch (117.92 KB, patch)
2014-11-04 12:13 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (117.80 KB, patch)
2014-11-04 14:15 PST, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2014-11-04 10:23:13 PST
It is a very common pattern in our code base to get a pointer from a Ref object. Right now, we have to call Ref.get() and take its address which is not very nice IMHO. I propose we add a asPtr() method to Ref class to get a raw pointer, in order to simplify the code a bit.
Comment 1 Chris Dumez 2014-11-04 12:13:54 PST
Created attachment 240938 [details]
Patch
Comment 2 Darin Adler 2014-11-04 14:05:56 PST
Comment on attachment 240938 [details]
Patch

I like it. I might have named this just ptr() rather than asPtr().
Comment 3 Chris Dumez 2014-11-04 14:07:35 PST
(In reply to comment #2)
> Comment on attachment 240938 [details]
> Patch
> 
> I like it. I might have named this just ptr() rather than asPtr().

Yes, it would be shorter. I will update the patch accordingly before landing, thanks.
Comment 4 Chris Dumez 2014-11-04 14:15:16 PST
Created attachment 240947 [details]
Patch
Comment 5 WebKit Commit Bot 2014-11-04 15:00:49 PST
Comment on attachment 240947 [details]
Patch

Clearing flags on attachment: 240947

Committed r175583: <http://trac.webkit.org/changeset/175583>
Comment 6 WebKit Commit Bot 2014-11-04 15:00:53 PST
All reviewed patches have been landed.  Closing bug.