Closed Bug 1196294 Opened 9 years ago Closed 9 years ago

Remove the mCause from TimelineMarkers

Categories

(DevTools :: Performance Tools (Profiler/Timeline), defect)

defect
Not set
normal

Tracking

(firefox43 fixed)

RESOLVED FIXED
Firefox 43
Tracking Status
firefox43 --- fixed

People

(Reporter: vporof, Assigned: vporof)

References

Details

Attachments

(1 file)

This field is only used in a few subclasses, and having it on the base TimelineMarker class doesn't really help with any code duplication. In the interest of trimming down the base class as much as we can, let's separate concerns.
Attached patch v1Splinter Review
Assignee: nobody → vporof
Status: NEW → ASSIGNED
Attachment #8649931 - Flags: review?(ttromey)
Comment on attachment 8649931 [details] [diff] [review]
v1

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

Looks good.

::: docshell/base/timeline/ConsoleTimelineMarker.h
@@ +33,5 @@
>      }
> +    // Console markers must have matching causes as well. It is safe to perform
> +    // a static_cast here as the previous equality check ensures that this is
> +    // a console marker instance.
> +    return mCause == static_cast<const ConsoleTimelineMarker*>(&aOther)->mCause;

This gives me mild pause, because the previous test is just based on the content of a string; so it opens the door to some error in theory.  However I don't think anything better can be done without a relatively heavyweight solution.
Attachment #8649931 - Flags: review?(ttromey) → review+
(In reply to Tom Tromey :tromey from comment #2)
> Comment on attachment 8649931 [details] [diff] [review]
> v1
> 
> Review of attachment 8649931 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> Looks good.
> 
> ::: docshell/base/timeline/ConsoleTimelineMarker.h
> @@ +33,5 @@
> >      }
> > +    // Console markers must have matching causes as well. It is safe to perform
> > +    // a static_cast here as the previous equality check ensures that this is
> > +    // a console marker instance.
> > +    return mCause == static_cast<const ConsoleTimelineMarker*>(&aOther)->mCause;
> 
> This gives me mild pause, because the previous test is just based on the
> content of a string; so it opens the door to some error in theory.  However
> I don't think anything better can be done without a relatively heavyweight
> solution.

Indeed. I feel disgusted for having to write this.

I was thinking of removing the "name" altogether in favor of an enum, or better yet just enforce subclassing whenever a new type of marker needs to be added. What do you think about that?
Flags: needinfo?(ttromey)
(In reply to Victor Porof [:vporof][:vp] from comment #3)

> I was thinking of removing the "name" altogether in favor of an enum, or
> better yet just enforce subclassing whenever a new type of marker needs to
> be added. What do you think about that?

Yeah, I think that would be an improvement.
It still wouldn't be truly typesafe, but at least it would provide a spot
to document the needed behavior.
Flags: needinfo?(ttromey)
https://hg.mozilla.org/mozilla-central/rev/ce62db17d0ec
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 43
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: