Bug 150987 - Web Inspector: Dashboard weight/size should show transferred size not total resources size
Summary: Web Inspector: Dashboard weight/size should show transferred size not total r...
Status: ASSIGNED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Nikita Vasilyev
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-11-06 17:11 PST by Joseph Pecoraro
Modified: 2016-12-13 15:40 PST (History)
3 users (show)

See Also:


Attachments
patch (31.60 KB, patch)
2015-11-12 15:33 PST, João Oliveira
no flags Details | Formatted Diff | Diff
patch (31.60 KB, patch)
2015-11-12 15:36 PST, João Oliveira
no flags Details | Formatted Diff | Diff
patch (31.37 KB, patch)
2015-11-17 19:29 PST, João Oliveira
joepeck: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2015-11-06 17:11:10 PST
* SUMMARY
Dashboard weight/size should show transferred size not total resources size.

This would be more useful for performance analysis.
Comment 1 João Oliveira 2015-11-12 15:33:01 PST
Created attachment 265440 [details]
patch
Comment 2 Radar WebKit Bug Importer 2015-11-12 15:33:17 PST
<rdar://problem/23525542>
Comment 3 João Oliveira 2015-11-12 15:36:51 PST
Created attachment 265442 [details]
patch
Comment 4 Joseph Pecoraro 2015-11-12 16:21:39 PST
Comment on attachment 265442 [details]
patch

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

Looks good. As mentioned on IRC, I'd like to see some tests for WebInspector.Resource.size/transferSize. Like, do we handle transferSize of dataURLs correctly as 0 for non-main resources?

> Source/WebInspectorUI/ChangeLog:9
> +        show transferred size on Dashboard weight
> +        show resources size on Dashboard weight tooltip

Nit: Use full sentences starting with a capital and ending with a period. This is meant to be a paragraph describing the patch.

> Source/WebInspectorUI/UserInterface/Models/DefaultDashboard.js:154
> +        if (!event.target.mainResource.cached && event.target.mainResource.size)
> +            this.transferredSize = event.target.mainResource.size;

Why are we resorting to using event.target.mainResource.size here instead of mainResource's transferSize? Are we running into an issue where the main resource's transfer size is not correct?

r- until we get an answer to this question!

> Source/WebInspectorUI/UserInterface/Views/DefaultDashboardView.js:93
> +
> +        } else {
> +            sizeItem.text = "\u2014";
> +        }

Style: No need for the blank line.
Style: No braces for single statement if/else, so remove the braces for the else block.
Comment 5 João Oliveira 2015-11-17 19:29:57 PST
Created attachment 265728 [details]
patch
Comment 6 Joseph Pecoraro 2015-11-18 10:56:53 PST
Comment on attachment 265728 [details]
patch

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

> Source/WebInspectorUI/UserInterface/Models/DefaultDashboard.js:153
> +        if (!event.target.mainResource.cached && event.target.mainResource.transferSize)
> +            this.transferredSize = event.target.mainResource.transferSize;

This still needs an explanation. Why not include the transferSize of the main resource when cached? At the least, I suspect we do a "if modified since" check on the main resource.
Comment 7 Joseph Pecoraro 2015-11-18 11:00:05 PST
Comment on attachment 265728 [details]
patch

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

>> Source/WebInspectorUI/UserInterface/Models/DefaultDashboard.js:153
>> +            this.transferredSize = event.target.mainResource.transferSize;
> 
> This still needs an explanation. Why not include the transferSize of the main resource when cached? At the least, I suspect we do a "if modified since" check on the main resource.

As was mentioned previous, r- until we get an answer to this question.

Also, I know you are working on a test for WebInspector.Resource. I think that is important for this patch so we can better guarantee `transferSize` is what we want it to be and that this feature won't regress in the future!
Comment 8 Timothy Hatcher 2015-12-12 19:13:20 PST
It would be great to finish this up and get it landed.
Comment 9 Timothy Hatcher 2015-12-12 19:14:01 PST
<rdar://problem/23443930>
Comment 10 Nikita Vasilyev 2016-03-25 23:41:35 PDT
I can take a look at this.

(In reply to comment #7)
> ...
> Also, I know you are working on a test for WebInspector.Resource. I think
> that is important for this patch so we can better guarantee `transferSize`
> is what we want it to be and that this feature won't regress in the future!

Do we have any tests for WebInspector.Resource?
Where would the new tests go?
Comment 11 Timothy Hatcher 2016-03-28 10:07:56 PDT
We have LayoutTests/inspector/page/main-frame-resource.html
Comment 12 Joseph Pecoraro 2016-03-28 15:40:34 PDT
> Do we have any tests for WebInspector.Resource?
> Where would the new tests go?

A test for a model object like this would likely go here:

    LayoutTests/inspector/unit-tests/resource.html

We have a bunch of tests for Model/Controller objects in inspector/unit-tests.