Bug 85624 - Web Inspector: HTMLCanvasElement::didDraw instrumentation.
Summary: Web Inspector: HTMLCanvasElement::didDraw instrumentation.
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: eustas.bug
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-05-04 07:59 PDT by eustas.bug
Modified: 2014-12-12 14:36 PST (History)
13 users (show)

See Also:


Attachments
Patch (12.98 KB, patch)
2012-05-04 08:09 PDT, eustas.bug
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ec2-cr-linux-03 (5.68 MB, application/zip)
2012-05-04 08:51 PDT, WebKit Review Bot
no flags Details
Patch (13.92 KB, patch)
2012-05-05 04:55 PDT, eustas.bug
no flags Details | Formatted Diff | Diff
Patch (13.55 KB, patch)
2012-05-10 01:34 PDT, eustas.bug
no flags Details | Formatted Diff | Diff
New instrumentation records. (109.13 KB, image/png)
2012-05-10 08:33 PDT, eustas.bug
no flags Details
Patch (11.76 KB, patch)
2012-05-14 02:40 PDT, eustas.bug
no flags Details | Formatted Diff | Diff
Patch (11.89 KB, patch)
2012-05-14 03:08 PDT, eustas.bug
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description eustas.bug 2012-05-04 07:59:25 PDT
Append record to timeline when drawing on HTML Canvas causes invalidation, which leads to deferred repaint.
Comment 1 eustas.bug 2012-05-04 08:09:45 PDT
Created attachment 140233 [details]
Patch
Comment 2 WebKit Review Bot 2012-05-04 08:50:55 PDT
Comment on attachment 140233 [details]
Patch

Attachment 140233 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/12630166

New failing tests:
inspector/timeline/timeline-enum-stability.html
Comment 3 WebKit Review Bot 2012-05-04 08:51:02 PDT
Created attachment 140245 [details]
Archive of layout-test-results from ec2-cr-linux-03

The attached test failures were seen while running run-webkit-tests on the chromium-ews.
Bot: ec2-cr-linux-03  Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'>  Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Comment 4 Pavel Feldman 2012-05-04 22:56:14 PDT
Comment on attachment 140233 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=140233&action=review

> Source/WebCore/ChangeLog:8
> +        Append record to timeline when drawing on HTML Canvas causes invalidation,

Do you want a stack that caused repaint here? Why are you only interested in canvas invalidations?

> Source/WebCore/html/HTMLCanvasElement.cpp:232
> +        InspectorInstrumentation::didInvalidateRect(this->document(), dirtyRect);

This is only a fraction of invalidations, a more specific name is needed. Also, why do we want to instrument invalidation? Are you trying to trace the subsequent paint from InspectorInstrumentation::willPaint to it?

> Source/WebCore/inspector/front-end/TimelineModel.js:82
> +    InvalidateRect: "InvalidateRect"

That's what is making the test fail, you should update the test.
Comment 5 eustas.bug 2012-05-05 04:55:42 PDT
Created attachment 140392 [details]
Patch
Comment 6 eustas.bug 2012-05-05 04:58:01 PDT
Comment on attachment 140233 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=140233&action=review

>> Source/WebCore/ChangeLog:8
>> +        Append record to timeline when drawing on HTML Canvas causes invalidation,
> 
> Do you want a stack that caused repaint here? Why are you only interested in canvas invalidations?

Stack is captured as well.

>> Source/WebCore/html/HTMLCanvasElement.cpp:232
>> +        InspectorInstrumentation::didInvalidateRect(this->document(), dirtyRect);
> 
> This is only a fraction of invalidations, a more specific name is needed. Also, why do we want to instrument invalidation? Are you trying to trace the subsequent paint from InspectorInstrumentation::willPaint to it?

Renamed to didInvalidateCanvasRect.
We want to instrument invalidation to show to user code point that initiated deferred painting.
Currently we do not link invalidation with subsequent painting.

>> Source/WebCore/inspector/front-end/TimelineModel.js:82
>> +    InvalidateRect: "InvalidateRect"
> 
> That's what is making the test fail, you should update the test.

Fixed.
Comment 7 Pavel Feldman 2012-05-05 08:23:43 PDT
Comment on attachment 140392 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=140392&action=review

> Source/WebCore/html/HTMLCanvasElement.cpp:232
> +        InspectorInstrumentation::didInvalidateCanvasRect(this->document(), dirtyRect);

simply document()

> Source/WebCore/inspector/TimelineRecordFactory.cpp:196
> +PassRefPtr<InspectorObject> TimelineRecordFactory::createInvalidateCanvasRectData(const IntRect& rect)

This is just a rect data, you should re-use createPaintData.

> Source/WebCore/inspector/front-end/TimelinePresentationModel.js:519
> +                contentHelper._appendTextRow(WebInspector.UIString("Location"), WebInspector.UIString("(%d, %d)", this.data["x"], this.data["y"]));

Please add corresponding localizedStrings.
Comment 8 eustas.bug 2012-05-10 01:22:04 PDT
Comment on attachment 140392 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=140392&action=review

>> Source/WebCore/html/HTMLCanvasElement.cpp:232
>> +        InspectorInstrumentation::didInvalidateCanvasRect(this->document(), dirtyRect);
> 
> simply document()

Done.

>> Source/WebCore/inspector/TimelineRecordFactory.cpp:196
>> +PassRefPtr<InspectorObject> TimelineRecordFactory::createInvalidateCanvasRectData(const IntRect& rect)
> 
> This is just a rect data, you should re-use createPaintData.

Did you mean: convert to IntRect to FloatRect and pass it to createPaintData?

>> Source/WebCore/inspector/front-end/TimelinePresentationModel.js:519
>> +                contentHelper._appendTextRow(WebInspector.UIString("Location"), WebInspector.UIString("(%d, %d)", this.data["x"], this.data["y"]));
> 
> Please add corresponding localizedStrings.

Done.
Comment 9 eustas.bug 2012-05-10 01:34:06 PDT
Created attachment 141108 [details]
Patch
Comment 10 Pavel Feldman 2012-05-10 06:30:52 PDT
Could you provide a screenshot with the instrumented data on any of the public sites as an attachment?
Comment 11 eustas.bug 2012-05-10 08:33:52 PDT
Created attachment 141177 [details]
New instrumentation records.
Comment 12 Pavel Feldman 2012-05-11 00:36:53 PDT
@nduca: do you think it makes sense to instrument canvas's invalidation separately or should it be a part of a more generic invalidate instrumentation?
Comment 13 Nat Duca 2012-05-11 08:55:50 PDT
Comment on attachment 141108 [details]
Patch

The challenge here is the amount of invalidation that you can get would easily overwhelm a UI. E.g. what if I do this on a canvas?
  for(var i= 0; i < 1000; i++)
      ctx.fillRect(i,0,1,100);

I think this could would put 1000 different entries in my timeline, each of which was 1 wider than the previous.

An event and call stack on *first* invalidation might be good for canvas, but it often just points at recalc/layout for DOM nodes...

This is a long winded way of me saying "yes, Pavel, it might be good to understand the general problem a bit more." :)
Comment 14 eustas.bug 2012-05-14 02:40:34 PDT
Created attachment 141674 [details]
Patch
Comment 15 eustas.bug 2012-05-14 03:08:29 PDT
Created attachment 141676 [details]
Patch
Comment 16 eustas.bug 2012-05-14 06:27:05 PDT
Fixed: now incalidation record appears only when "clean" canvas becomes "dirty".
Comment 17 Yury Semikhatsky 2012-05-25 03:11:46 PDT
Comment on attachment 141676 [details]
Patch

Clearing r? until we come to an agreement on whether it should be done this way.
Comment 18 Brian Burg 2014-12-12 14:36:00 PST
Closing as invalid, as this bug pertains to the old inspector UI and/or its tests.
Please file a new bug (https://www.webkit.org/new-inspector-bug) if the bug/feature/issue is still relevant to WebKit trunk.