Closed Bug 770999 Opened 12 years ago Closed 12 years ago

Convert reference(), value(), raw() on handles and Root<> to get()

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla16

People

(Reporter: billm, Assigned: billm)

Details

Attachments

(1 file)

Attached patch patchSplinter Review
There are a number of ways to get the value out of a rooted thing explicitly, but they differ depending on whether you have a Handle<> or a Root<>. Also, HeapPtr<> has its own method called get() to do pretty much the same thing. I like get() best because it's short, so I converted the other ones to it. I'm open to changing the name, but I think it's useful for them all to be the same.
Attachment #639175 - Flags: review?(bhackett1024)
Comment on attachment 639175 [details] [diff] [review]
patch

Review of attachment 639175 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/gc/Root.h
@@ +212,5 @@
>      T operator ->() const { return ptr; }
>      T * address() { return &ptr; }
>      const T * address() const { return &ptr; }
> +    T & get() { return ptr; }
> +    T get() const { return ptr; }

Can the const method here just be removed?  It looks weird to have overloads that return either a T or a T&, and Rooted should never be const anyways.  (I see a CrossCompartmentKey constructor that does this, but that signature is broken)
Attachment #639175 - Flags: review?(bhackett1024) → review+
https://hg.mozilla.org/mozilla-central/rev/2ecd5bbb5289
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla16
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: