[webkit-reviews] review granted: [Bug 127899] Web Inspector: Add the model objects for the new profile data : [Attachment 222649] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jan 30 11:08:24 PST 2014


Joseph Pecoraro <joepeck at webkit.org> has granted Timothy Hatcher
<timothy at apple.com>'s request for review:
Bug 127899: Web Inspector: Add the model objects for the new profile data
https://bugs.webkit.org/show_bug.cgi?id=127899

Attachment 222649: Patch
https://bugs.webkit.org/attachment.cgi?id=222649&action=review

------- Additional Comments from Joseph Pecoraro <joepeck at webkit.org>
View in context: https://bugs.webkit.org/attachment.cgi?id=222649&action=review


r=me

> Source/WebInspectorUI/UserInterface/ProfileNode.js:148
> +	   rangeStartTime = !isNaN(rangeStartTime) ? rangeStartTime : 0;
> +	   rangeEndTime = !isNaN(rangeEndTime) ? rangeEndTime : Infinity;

This reads strange to me. I'd prefer a positive condition "isNaN(foo) ? 0 :
foo".

Or the longer but more straightforward:

if (isNaN(foo))
  foo = ..;

> Source/WebInspectorUI/UserInterface/ProfileNode.js:207
> +	   cookie[WebInspector.ProfileNode.SourceCodeURLCookieKey] =
this._sourceCodeLocation ? this._sourceCodeLocation.sourceCode.url ?
this._sourceCodeLocation.sourceCode.url.hash : null : null;

Ew! Replace:

    a ? a.b ? a.b.c : null : null;

With:

    a && a.b ? a.b.c : null

> Source/WebInspectorUI/UserInterface/ProfileNodeCall.js:30
> +    console.assert(startTime);

So, startTime cannot be 0? Should this be a type check, or is 0 not allowed?

    console.assert(typeof startTime === "number");

> Source/WebInspectorUI/UserInterface/TimelineManager.js:375
> +	   // Iterate over the node tree using a stack. Doing this recursively
can easily cause a stack overflow.
> +	   // We traverse the profile in post-order and convert the payloads in
place until we get back to the root.

This is so wild. I feel like there must be a better way. But I can't find any
logic issues with it.

> Source/WebInspectorUI/UserInterface/TimelineManager.js:396
> +	   return new WebInspector.Profile(rootNodes, payload.idleTime);

Assert "idleTime" in payload near the function entry?


More information about the webkit-reviews mailing list