Note: There are a few cases of duplicates in user autocompletion which are being worked on.

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

RESOLVED FIXED in mozilla16

Status

()

Core
JavaScript Engine
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: billm, Assigned: billm)

Tracking

unspecified
mozilla16
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

5 years ago
Created attachment 639175 [details] [diff] [review]
patch

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+
(Assignee)

Comment 2

5 years ago
https://hg.mozilla.org/mozilla-central/rev/2ecd5bbb5289
Status: NEW → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla16
You need to log in before you can comment on or make changes to this bug.