-
Notifications
You must be signed in to change notification settings - Fork 370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Timeline markers #275
Timeline markers #275
Conversation
Codecov Report
@@ Coverage Diff @@
## master #275 +/- ##
==========================================
+ Coverage 71.08% 71.91% +0.83%
==========================================
Files 59 60 +1
Lines 3247 3351 +104
==========================================
+ Hits 2308 2410 +102
- Misses 939 941 +2
Continue to review full report at Codecov.
|
I pulled out the canvas logic into its own separate component. Next up is re-use the TimelineCanvas component for the TImelineFlameChart. |
fbd1ad0
to
d89d468
Compare
4fe9c72
to
7487dc5
Compare
This is now ready for review. This is a first pass and I have many follow-ups I would like to do. If you could be specific on review changes on what can be follow-ups I would appreciate it. Follow-ups
|
|
I think it's my recent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left several comments, some of them perf related, others style related , others as suggestions.
I admit I haven't looked so much at the canvas code, I'll trust you on this.
The feature is quite cool and works fine. I'd rather see it in rather than make it perfect. So if you prefer to move some of my comments to follow-ups it's fine by me.
onDoubleClickItem={this.onDoubleClickStack} | ||
getHoveredItemInfo={this.getHoveredStackInfo} | ||
drawCanvas={this.drawCanvas} | ||
hitTest={this.hitTest} />; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: should all of the functions names be prefixed by an underscore ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that would be more consistent with the codebase. I'll update it. I'm not sure (from a bikeshedding point of view) of what utility underscore has for React classes' member functions, as the class instances are never used by anyone, so all class functions are implicitly private.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TBH I usually don't care, but it's just what I've been told in this project ;)
} | ||
|
||
.timelineCanvas.hover { | ||
cursor: default; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: have you tried putting the "cursor: default" on the above block ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The behavior here is to show the grab
cursor on the Timeline when not hovering over a stack frame, then when you hover over a stack frame it changes to the default
cursor.
const { className, drawCanvas } = this.props; | ||
if (!this._requestedAnimationFrame) { | ||
this._requestedAnimationFrame = true; | ||
window.requestAnimationFrame(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optional nit: you can assign to _requestedAnimationFrame
the result of window.requestAnimationFrame
.
_ctx: CanvasRenderingContext2D | ||
state: { | ||
hoveredItem: null | HoveredItem; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: please put semicolons at the end of these lines
_devicePixelRatio: number | ||
_textMeasurement: null|TextMeasurement | ||
_ctx: null|CanvasRenderingContext2D | ||
_textMeasurement: null | TextMeasurement | ||
|
||
props: Props |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can you put a semicolon at the end of these lines ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, we should have a linting rule in place that covers this. I looked for one briefly but didn't find one, although maybe we can just switch to prettier.
<Reorderable tagName='div' | ||
className={`${className}ThreadList`} | ||
className={'timelineViewTimelinesThreadList'} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: you don't need the {} syntax, just put the class as a string :)
src/content/marker-timing.js
Outdated
markerTimingRows = markerTimingRows.concat(value); | ||
} | ||
return markerTimingRows; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional, but do you think you can split this function is several parts ? For example, the Map handling could be extracted into a higher-level component ?
// Handle different marker payloads. | ||
switch (data.type) { | ||
case 'UserTiming': | ||
return (data: UserTimingMarkerPayload).name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional nit: not sure the flow annotation is useful here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mainly did it as documentation, would it be better to leave this out?
src/content/marker-timing.js
Outdated
let markerTimingRows = []; | ||
for (const [, value] of markerTimingsMap) { | ||
markerTimingRows = markerTimingRows.concat(value); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this just work to flatten: [].concat(...marketTimingRows.values());
without intermediary arrays :)
src/content/url-handling.js
Outdated
query.react_perf = null; | ||
/* eslint-enable camelcase */ | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pretty sure this landed elsewhere :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:)
@@ -70,7 +70,7 @@ class ProfileViewerHeader extends PureComponent { | |||
} | |||
</div> | |||
<div className={`${className}HeaderIntervalMarkerOverviewContainer ${className}HeaderIntervalMarkerOverviewContainerGfx`}> | |||
{ | |||
{/* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should keep the tracing markers at the top until this tab is more polished.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Woops, I knew I forgot something. Thanks I meant to bring this up. Will do.
user-select: none; | ||
} | ||
|
||
.timelineMarkersLabels > span { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please set a class name on the span instead.
|
||
_prepCanvas() { | ||
const {canvas} = this.refs; | ||
const {containerWidth, containerHeight} = this.props; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to pick one style here and add a lint for it. At the moment we have a wild mix of hugging braces and spaced braces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, I'm ready to take on prettier at this point.
7487dc5
to
e0329ea
Compare
e0329ea
to
7cba79f
Compare
7cba79f
to
e15876f
Compare
This is a work in progress for timeline markers. I need to clean up a bunch of stuff. @mikeconley this is here if you want to check it out, but I'm only showing
TracingMarker
s, or markers that we can determine have a start and end time. YourAsyncTabSwitch
aren't being turned intoTracingMarker
s right now.