Last Comment Bug 770999 - Convert reference(), value(), raw() on handles and Root<> to get()
: Convert reference(), value(), raw() on handles and Root<> to get()
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: All All
-- normal (vote)
: mozilla16
Assigned To: Bill McCloskey (:billm)
: Jason Orendorff [:jorendorff]
Depends on:
  Show dependency treegraph
Reported: 2012-07-04 14:03 PDT by Bill McCloskey (:billm)
Modified: 2012-07-04 18:27 PDT (History)
1 user (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

patch (40.64 KB, patch)
2012-07-04 14:03 PDT, Bill McCloskey (:billm)
bhackett1024: review+
Details | Diff | Splinter Review

Description User image Bill McCloskey (:billm) 2012-07-04 14:03:11 PDT
Created attachment 639175 [details] [diff] [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.
Comment 1 User image Brian Hackett (:bhackett) 2012-07-04 14:26:37 PDT
Comment on attachment 639175 [details] [diff] [review]

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)
Comment 2 User image Bill McCloskey (:billm) 2012-07-04 18:27:18 PDT

Note You need to log in before you can comment on or make changes to this bug.