Closed Bug 1189072 Opened 4 years ago Closed 4 years ago

Make the DefaultTracer for struct types call T::trace

Categories

(Core :: JavaScript: GC, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla42
Tracking Status
firefox42 --- fixed

People

(Reporter: terrence, Assigned: terrence)

Details

Attachments

(1 file)

I think this will be a bit clearer and easier to use. Specifically, it lets people add a T to a TraceableContainer by adding a trace method to T, instead of adding a DefaultTracer. As a side-effect, this means that any DynamicTraceable can be added to a TraceableContainer without any further effort.
Attachment #8640729 - Flags: review?(nfitzgerald)
Comment on attachment 8640729 [details] [diff] [review]
make_DefaultTracer_struct_call_trace-v0.diff

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

::: js/public/TraceableVector.h
@@ +12,5 @@
>  #include "js/Vector.h"
>  
>  namespace js {
>  
> +template <typename, typename=void> struct DefaultTracer;

If this is going to be used by every traceable container we end up having, it might make sense to put it somewhere else. Do we have a header for public type traits or anything like that?

Just something to mull over, no need to hold up landing this patch.
Attachment #8640729 - Flags: review?(nfitzgerald) → review+
(In reply to Nick Fitzgerald [:fitzgen][:nf] from comment #1)
> Comment on attachment 8640729 [details] [diff] [review]
> make_DefaultTracer_struct_call_trace-v0.diff
> 
> Review of attachment 8640729 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: js/public/TraceableVector.h
> @@ +12,5 @@
> >  #include "js/Vector.h"
> >  
> >  namespace js {
> >  
> > +template <typename, typename=void> struct DefaultTracer;
> 
> If this is going to be used by every traceable container we end up having,
> it might make sense to put it somewhere else. Do we have a header for public
> type traits or anything like that?
> 
> Just something to mull over, no need to hold up landing this patch.

Yeah, I agree. Maybe TracingAPI would be the right place.
https://hg.mozilla.org/mozilla-central/rev/d1288e84b4a0
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
You need to log in before you can comment on or make changes to this bug.