Bug 158144 - Web Inspector: ReportExtraMemoryCost IDL attribute should also be used to generate estimatedSize method
Summary: Web Inspector: ReportExtraMemoryCost IDL attribute should also be used to gen...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-05-26 20:09 PDT by Joseph Pecoraro
Modified: 2016-05-31 20:53 PDT (History)
14 users (show)

See Also:


Attachments
[PATCH] Proposed Fix (35.52 KB, patch)
2016-05-26 20:15 PDT, Joseph Pecoraro
darin: review+
bburg: commit-queue-
Details | Formatted Diff | Diff
[PATCH] For Landing (34.28 KB, patch)
2016-05-31 16:50 PDT, Joseph Pecoraro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2016-05-26 20:09:41 PDT
* SUMMARY
ReportExtraMemoryCost IDL attribute should also be used to generate estimatedSize method.

The pattern for including the JSCell estimatedSize() method is "if a cell reports extra memory to the Heap, it should also include that in its estimated size". We were missing this for WebCore objects (of which there are only a few). The existing ReportExtraMemoryCost IDL attribute already handles reporting extra memory to the Heap using wrapper().memoryCost(). The exact same thing can be used in estimatedSize().
Comment 1 Radar WebKit Bug Importer 2016-05-26 20:11:24 PDT
<rdar://problem/26510790>
Comment 2 Joseph Pecoraro 2016-05-26 20:15:41 PDT
Created attachment 279942 [details]
[PATCH] Proposed Fix
Comment 3 Darin Adler 2016-05-28 21:19:04 PDT
Comment on attachment 279942 [details]
[PATCH] Proposed Fix

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

> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:1049
> +    my $needsEstimatedSize = InstanceNeedsEstimatedSize($interface);

Seems better to just call this the one place it’s used instead of putting it into a local variable.

> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:2012
> +    my $needsEstimatedSize = InstanceNeedsEstimatedSize($interface);

Seems better to just call this the one place it’s used instead of putting it into a local variable.

> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:3276
> +        push(@implContent, "    ASSERT_GC_OBJECT_INHERITS(thisObject, info());\n");

It seems peculiar to do this assertion after the jsCast. Doesn’t the JSCast do this check already? If it doesn’t then I’d suggest asserting first.

> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:3278
> +        push(@implContent, "    size_t extraSize = thisObject->wrapped().memoryCost();\n");
> +        push(@implContent, "    return Base::estimatedSize(thisObject) + extraSize;\n");

This would read better without the local variable, I think.
Comment 4 Joseph Pecoraro 2016-05-31 16:50:34 PDT
Created attachment 280199 [details]
[PATCH] For Landing
Comment 5 WebKit Commit Bot 2016-05-31 17:44:42 PDT
Comment on attachment 280199 [details]
[PATCH] For Landing

Clearing flags on attachment: 280199

Committed r201541: <http://trac.webkit.org/changeset/201541>