Changeset 201541 in webkit


Ignore:
Timestamp:
May 31, 2016 5:45:59 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: ReportExtraMemoryCost IDL attribute should also be used to generate estimatedSize method
https://bugs.webkit.org/show_bug.cgi?id=158144

Patch by Joseph Pecoraro <Joseph Pecoraro> on 2016-05-31
Reviewed by Darin Adler.

  • bindings/scripts/CodeGeneratorJS.pm:

(InstanceNeedsEstimatedSize):
(GenerateHeader):
(GenerateImplementation):
When an interface includes ReportExtraMemoryCost, generate an estimatedSize
method which includes the Base::estimatedSize and the memoryCost().

  • bindings/scripts/test/GObject/WebKitDOMInterfaceName.cpp: Added.

(WebKit::kit):
(WebKit::core):
(WebKit::wrapInterfaceName):
(webkit_dom_interface_name_finalize):
(webkit_dom_interface_name_constructor):
(webkit_dom_interface_name_class_init):
(webkit_dom_interface_name_init):

  • bindings/scripts/test/GObject/WebKitDOMInterfaceName.h: Added.
  • bindings/scripts/test/GObject/WebKitDOMInterfaceNamePrivate.h: Added.
  • bindings/scripts/test/JS/JSInterfaceName.cpp: Added.

(WebCore::JSInterfaceNamePrototype::create):
(WebCore::JSInterfaceNamePrototype::createStructure):
(WebCore::JSInterfaceNamePrototype::JSInterfaceNamePrototype):
(WebCore::JSInterfaceNameConstructor::prototypeForStructure):
(WebCore::JSInterfaceNameConstructor::initializeProperties):
(WebCore::JSInterfaceNamePrototype::finishCreation):
(WebCore::JSInterfaceName::JSInterfaceName):
(WebCore::JSInterfaceName::createPrototype):
(WebCore::JSInterfaceName::prototype):
(WebCore::JSInterfaceName::destroy):
(WebCore::jsInterfaceNameConstructor):
(WebCore::setJSInterfaceNameConstructor):
(WebCore::JSInterfaceName::getConstructor):
(WebCore::JSInterfaceName::visitChildren):
(WebCore::JSInterfaceName::estimatedSize):
(WebCore::JSInterfaceNameOwner::isReachableFromOpaqueRoots):
(WebCore::JSInterfaceNameOwner::finalize):
(WebCore::toJSNewlyCreated):
(WebCore::toJS):
(WebCore::JSInterfaceName::toWrapped):

  • bindings/scripts/test/JS/JSInterfaceName.h: Added.

(WebCore::JSInterfaceName::create):
(WebCore::JSInterfaceName::createStructure):
(WebCore::JSInterfaceName::finishCreation):
(WebCore::wrapperOwner):
(WebCore::wrapperKey):
(WebCore::toJS):
(WebCore::toJSNewlyCreated):

  • bindings/scripts/test/ObjC/DOMInterfaceName.h: Added.
  • bindings/scripts/test/ObjC/DOMInterfaceName.mm: Added.

(-[DOMInterfaceName dealloc]):
(core):
(kit):

  • bindings/scripts/test/ObjC/DOMInterfaceNameInternal.h: Added.
  • bindings/scripts/test/TestReportExtraMemoryCost.idl: Added.

Include a test for the ReportExtraMemoryCost attribute.

Location:
trunk/Source/WebCore
Files:
9 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r201539 r201541  
     12016-05-31  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: ReportExtraMemoryCost IDL attribute should also be used to generate estimatedSize method
     4        https://bugs.webkit.org/show_bug.cgi?id=158144
     5
     6        Reviewed by Darin Adler.
     7
     8        * bindings/scripts/CodeGeneratorJS.pm:
     9        (InstanceNeedsEstimatedSize):
     10        (GenerateHeader):
     11        (GenerateImplementation):
     12        When an interface includes ReportExtraMemoryCost, generate an estimatedSize
     13        method which includes the Base::estimatedSize and the memoryCost().
     14
     15        * bindings/scripts/test/GObject/WebKitDOMInterfaceName.cpp: Added.
     16        (WebKit::kit):
     17        (WebKit::core):
     18        (WebKit::wrapInterfaceName):
     19        (webkit_dom_interface_name_finalize):
     20        (webkit_dom_interface_name_constructor):
     21        (webkit_dom_interface_name_class_init):
     22        (webkit_dom_interface_name_init):
     23        * bindings/scripts/test/GObject/WebKitDOMInterfaceName.h: Added.
     24        * bindings/scripts/test/GObject/WebKitDOMInterfaceNamePrivate.h: Added.
     25        * bindings/scripts/test/JS/JSInterfaceName.cpp: Added.
     26        (WebCore::JSInterfaceNamePrototype::create):
     27        (WebCore::JSInterfaceNamePrototype::createStructure):
     28        (WebCore::JSInterfaceNamePrototype::JSInterfaceNamePrototype):
     29        (WebCore::JSInterfaceNameConstructor::prototypeForStructure):
     30        (WebCore::JSInterfaceNameConstructor::initializeProperties):
     31        (WebCore::JSInterfaceNamePrototype::finishCreation):
     32        (WebCore::JSInterfaceName::JSInterfaceName):
     33        (WebCore::JSInterfaceName::createPrototype):
     34        (WebCore::JSInterfaceName::prototype):
     35        (WebCore::JSInterfaceName::destroy):
     36        (WebCore::jsInterfaceNameConstructor):
     37        (WebCore::setJSInterfaceNameConstructor):
     38        (WebCore::JSInterfaceName::getConstructor):
     39        (WebCore::JSInterfaceName::visitChildren):
     40        (WebCore::JSInterfaceName::estimatedSize):
     41        (WebCore::JSInterfaceNameOwner::isReachableFromOpaqueRoots):
     42        (WebCore::JSInterfaceNameOwner::finalize):
     43        (WebCore::toJSNewlyCreated):
     44        (WebCore::toJS):
     45        (WebCore::JSInterfaceName::toWrapped):
     46        * bindings/scripts/test/JS/JSInterfaceName.h: Added.
     47        (WebCore::JSInterfaceName::create):
     48        (WebCore::JSInterfaceName::createStructure):
     49        (WebCore::JSInterfaceName::finishCreation):
     50        (WebCore::wrapperOwner):
     51        (WebCore::wrapperKey):
     52        (WebCore::toJS):
     53        (WebCore::toJSNewlyCreated):
     54        * bindings/scripts/test/ObjC/DOMInterfaceName.h: Added.
     55        * bindings/scripts/test/ObjC/DOMInterfaceName.mm: Added.
     56        (-[DOMInterfaceName dealloc]):
     57        (core):
     58        (kit):
     59        * bindings/scripts/test/ObjC/DOMInterfaceNameInternal.h: Added.
     60        * bindings/scripts/test/TestReportExtraMemoryCost.idl: Added.
     61        Include a test for the ReportExtraMemoryCost attribute.
     62
    1632016-05-31  Alex Christensen  <achristensen@webkit.org>
    264
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r201428 r201541  
    734734        || $interface->extendedAttributes->{"ReportExtraMemoryCost"}
    735735        || IsJSBuiltinConstructor($interface)
     736}
     737
     738sub InstanceNeedsEstimatedSize
     739{
     740    my $interface = shift;
     741    return $interface->extendedAttributes->{"ReportExtraMemoryCost"};
    736742}
    737743
     
    13171323        push(@headerContent, "    void visitAdditionalChildren(JSC::SlotVisitor&);\n") if $interface->extendedAttributes->{"JSCustomMarkFunction"};
    13181324        push(@headerContent, "\n");
     1325    }
     1326
     1327    if (InstanceNeedsEstimatedSize($interface)) {
     1328        push(@headerContent, "    static size_t estimatedSize(JSCell*);\n");
    13191329    }
    13201330
     
    32623272    }
    32633273
     3274    if (InstanceNeedsEstimatedSize($interface)) {
     3275        push(@implContent, "size_t ${className}::estimatedSize(JSCell* cell)\n");
     3276        push(@implContent, "{\n");
     3277        push(@implContent, "    auto* thisObject = jsCast<${className}*>(cell);\n");
     3278        push(@implContent, "    return Base::estimatedSize(thisObject) + thisObject->wrapped().memoryCost();\n");
     3279        push(@implContent, "}\n\n");
     3280    }
     3281
    32643282    # Cached attributes are indeed allowed when there is a custom mark/visitChildren function.
    32653283    # The custom function must make sure to account for the cached attribute.
Note: See TracChangeset for help on using the changeset viewer.