Title: [201541] trunk/Source/WebCore
Revision
201541
Author
commit-qu...@webkit.org
Date
2016-05-31 17:45:59 -0700 (Tue, 31 May 2016)

Log 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 <pecor...@apple.com> 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.

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (201540 => 201541)


--- trunk/Source/WebCore/ChangeLog	2016-06-01 00:31:13 UTC (rev 201540)
+++ trunk/Source/WebCore/ChangeLog	2016-06-01 00:45:59 UTC (rev 201541)
@@ -1,3 +1,65 @@
+2016-05-31  Joseph Pecoraro  <pecor...@apple.com>
+
+        Web Inspector: ReportExtraMemoryCost IDL attribute should also be used to generate estimatedSize method
+        https://bugs.webkit.org/show_bug.cgi?id=158144
+
+        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.
+
 2016-05-31  Alex Christensen  <achristen...@webkit.org>
 
         Fix assertion after r201447

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (201540 => 201541)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-06-01 00:31:13 UTC (rev 201540)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-06-01 00:45:59 UTC (rev 201541)
@@ -735,6 +735,12 @@
         || IsJSBuiltinConstructor($interface)
 }
 
+sub InstanceNeedsEstimatedSize
+{
+    my $interface = shift;
+    return $interface->extendedAttributes->{"ReportExtraMemoryCost"};
+}
+
 sub GetImplClassName
 {
     my $name = shift;
@@ -1318,6 +1324,10 @@
         push(@headerContent, "\n");
     }
 
+    if (InstanceNeedsEstimatedSize($interface)) {
+        push(@headerContent, "    static size_t estimatedSize(JSCell*);\n");
+    }
+
     if ($numCustomAttributes > 0) {
         push(@headerContent, "\n    // Custom attributes\n");
 
@@ -3261,6 +3271,14 @@
         push(@implContent, "}\n\n");
     }
 
+    if (InstanceNeedsEstimatedSize($interface)) {
+        push(@implContent, "size_t ${className}::estimatedSize(JSCell* cell)\n");
+        push(@implContent, "{\n");
+        push(@implContent, "    auto* thisObject = jsCast<${className}*>(cell);\n");
+        push(@implContent, "    return Base::estimatedSize(thisObject) + thisObject->wrapped().memoryCost();\n");
+        push(@implContent, "}\n\n");
+    }
+
     # Cached attributes are indeed allowed when there is a custom mark/visitChildren function.
     # The custom function must make sure to account for the cached attribute.
     # Uncomment the below line to temporarily enforce generated mark functions when cached attributes are present.

Added: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMInterfaceName.cpp (0 => 201541)


--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMInterfaceName.cpp	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMInterfaceName.cpp	2016-06-01 00:45:59 UTC (rev 201541)
@@ -0,0 +1,104 @@
+/*
+ *  This file is part of the WebKit open source project.
+ *  This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public License
+ *  along with this library; see the file COPYING.LIB.  If not, write to
+ *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+#include "WebKitDOMInterfaceName.h"
+
+#include "CSSImportRule.h"
+#include "DOMObjectCache.h"
+#include "Document.h"
+#include "ExceptionCode.h"
+#include "ExceptionCodeDescription.h"
+#include "JSMainThreadExecState.h"
+#include "WebKitDOMInterfaceNamePrivate.h"
+#include "WebKitDOMPrivate.h"
+#include "gobject/ConvertToUTF8String.h"
+#include <wtf/GetPtr.h>
+#include <wtf/RefPtr.h>
+
+#define WEBKIT_DOM_INTERFACE_NAME_GET_PRIVATE(obj) G_TYPE_INSTANCE_GET_PRIVATE(obj, WEBKIT_DOM_TYPE_INTERFACE_NAME, WebKitDOMInterfaceNamePrivate)
+
+typedef struct _WebKitDOMInterfaceNamePrivate {
+    RefPtr<WebCore::InterfaceName> coreObject;
+} WebKitDOMInterfaceNamePrivate;
+
+namespace WebKit {
+
+WebKitDOMInterfaceName* kit(WebCore::InterfaceName* obj)
+{
+    if (!obj)
+        return 0;
+
+    if (gpointer ret = DOMObjectCache::get(obj))
+        return WEBKIT_DOM_INTERFACE_NAME(ret);
+
+    return wrapInterfaceName(obj);
+}
+
+WebCore::InterfaceName* core(WebKitDOMInterfaceName* request)
+{
+    return request ? static_cast<WebCore::InterfaceName*>(WEBKIT_DOM_OBJECT(request)->coreObject) : 0;
+}
+
+WebKitDOMInterfaceName* wrapInterfaceName(WebCore::InterfaceName* coreObject)
+{
+    ASSERT(coreObject);
+    return WEBKIT_DOM_INTERFACE_NAME(g_object_new(WEBKIT_DOM_TYPE_INTERFACE_NAME, "core-object", coreObject, nullptr));
+}
+
+} // namespace WebKit
+
+G_DEFINE_TYPE(WebKitDOMInterfaceName, webkit_dom_interface_name, WEBKIT_DOM_TYPE_OBJECT)
+
+static void webkit_dom_interface_name_finalize(GObject* object)
+{
+    WebKitDOMInterfaceNamePrivate* priv = WEBKIT_DOM_INTERFACE_NAME_GET_PRIVATE(object);
+
+    WebKit::DOMObjectCache::forget(priv->coreObject.get());
+
+    priv->~WebKitDOMInterfaceNamePrivate();
+    G_OBJECT_CLASS(webkit_dom_interface_name_parent_class)->finalize(object);
+}
+
+static GObject* webkit_dom_interface_name_constructor(GType type, guint constructPropertiesCount, GObjectConstructParam* constructProperties)
+{
+    GObject* object = G_OBJECT_CLASS(webkit_dom_interface_name_parent_class)->constructor(type, constructPropertiesCount, constructProperties);
+
+    WebKitDOMInterfaceNamePrivate* priv = WEBKIT_DOM_INTERFACE_NAME_GET_PRIVATE(object);
+    priv->coreObject = static_cast<WebCore::InterfaceName*>(WEBKIT_DOM_OBJECT(object)->coreObject);
+    WebKit::DOMObjectCache::put(priv->coreObject.get(), object);
+
+    return object;
+}
+
+static void webkit_dom_interface_name_class_init(WebKitDOMInterfaceNameClass* requestClass)
+{
+    GObjectClass* gobjectClass = G_OBJECT_CLASS(requestClass);
+    g_type_class_add_private(gobjectClass, sizeof(WebKitDOMInterfaceNamePrivate));
+    gobjectClass->constructor = webkit_dom_interface_name_constructor;
+    gobjectClass->finalize = webkit_dom_interface_name_finalize;
+}
+
+static void webkit_dom_interface_name_init(WebKitDOMInterfaceName* request)
+{
+    WebKitDOMInterfaceNamePrivate* priv = WEBKIT_DOM_INTERFACE_NAME_GET_PRIVATE(request);
+    new (priv) WebKitDOMInterfaceNamePrivate();
+}
+

Added: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMInterfaceName.h (0 => 201541)


--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMInterfaceName.h	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMInterfaceName.h	2016-06-01 00:45:59 UTC (rev 201541)
@@ -0,0 +1,53 @@
+/*
+ *  This file is part of the WebKit open source project.
+ *  This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public License
+ *  along with this library; see the file COPYING.LIB.  If not, write to
+ *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebKitDOMInterfaceName_h
+#define WebKitDOMInterfaceName_h
+
+#ifdef WEBKIT_DOM_USE_UNSTABLE_API
+
+#include <glib-object.h>
+#include <webkitdom/WebKitDOMObject.h>
+#include <webkitdom/webkitdomdefines-unstable.h>
+
+G_BEGIN_DECLS
+
+#define WEBKIT_DOM_TYPE_INTERFACE_NAME            (webkit_dom_interface_name_get_type())
+#define WEBKIT_DOM_INTERFACE_NAME(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_DOM_TYPE_INTERFACE_NAME, WebKitDOMInterfaceName))
+#define WEBKIT_DOM_INTERFACE_NAME_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),  WEBKIT_DOM_TYPE_INTERFACE_NAME, WebKitDOMInterfaceNameClass)
+#define WEBKIT_DOM_IS_INTERFACE_NAME(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_DOM_TYPE_INTERFACE_NAME))
+#define WEBKIT_DOM_IS_INTERFACE_NAME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),  WEBKIT_DOM_TYPE_INTERFACE_NAME))
+#define WEBKIT_DOM_INTERFACE_NAME_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj),  WEBKIT_DOM_TYPE_INTERFACE_NAME, WebKitDOMInterfaceNameClass))
+
+struct _WebKitDOMInterfaceName {
+    WebKitDOMObject parent_instance;
+};
+
+struct _WebKitDOMInterfaceNameClass {
+    WebKitDOMObjectClass parent_class;
+};
+
+WEBKIT_API GType
+webkit_dom_interface_name_get_type(void);
+
+G_END_DECLS
+
+#endif /* WEBKIT_DOM_USE_UNSTABLE_API */
+#endif /* WebKitDOMInterfaceName_h */

Added: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMInterfaceNamePrivate.h (0 => 201541)


--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMInterfaceNamePrivate.h	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMInterfaceNamePrivate.h	2016-06-01 00:45:59 UTC (rev 201541)
@@ -0,0 +1,33 @@
+/*
+ *  This file is part of the WebKit open source project.
+ *  This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public License
+ *  along with this library; see the file COPYING.LIB.  If not, write to
+ *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ */
+
+#ifndef WebKitDOMInterfaceNamePrivate_h
+#define WebKitDOMInterfaceNamePrivate_h
+
+#include "InterfaceName.h"
+#include <webkitdom/WebKitDOMInterfaceName.h>
+
+namespace WebKit {
+WebKitDOMInterfaceName* wrapInterfaceName(WebCore::InterfaceName*);
+WebKitDOMInterfaceName* kit(WebCore::InterfaceName*);
+WebCore::InterfaceName* core(WebKitDOMInterfaceName*);
+} // namespace WebKit
+
+#endif /* WebKitDOMInterfaceNamePrivate_h */

Added: trunk/Source/WebCore/bindings/scripts/test/JS/JSInterfaceName.cpp (0 => 201541)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSInterfaceName.cpp	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSInterfaceName.cpp	2016-06-01 00:45:59 UTC (rev 201541)
@@ -0,0 +1,217 @@
+/*
+    This file is part of the WebKit open source project.
+    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#include "config.h"
+#include "JSInterfaceName.h"
+
+#include "JSDOMBinding.h"
+#include "JSDOMConstructor.h"
+#include <runtime/FunctionPrototype.h>
+#include <wtf/GetPtr.h>
+
+using namespace JSC;
+
+namespace WebCore {
+
+// Attributes
+
+JSC::EncodedJSValue jsInterfaceNameConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName, JSC::JSObject*);
+bool setJSInterfaceNameConstructor(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
+
+class JSInterfaceNamePrototype : public JSC::JSNonFinalObject {
+public:
+    typedef JSC::JSNonFinalObject Base;
+    static JSInterfaceNamePrototype* create(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::Structure* structure)
+    {
+        JSInterfaceNamePrototype* ptr = new (NotNull, JSC::allocateCell<JSInterfaceNamePrototype>(vm.heap)) JSInterfaceNamePrototype(vm, globalObject, structure);
+        ptr->finishCreation(vm);
+        return ptr;
+    }
+
+    DECLARE_INFO;
+    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
+    {
+        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
+    }
+
+private:
+    JSInterfaceNamePrototype(JSC::VM& vm, JSC::JSGlobalObject*, JSC::Structure* structure)
+        : JSC::JSNonFinalObject(vm, structure)
+    {
+    }
+
+    void finishCreation(JSC::VM&);
+};
+
+typedef JSDOMConstructorNotConstructable<JSInterfaceName> JSInterfaceNameConstructor;
+
+template<> JSValue JSInterfaceNameConstructor::prototypeForStructure(JSC::VM& vm, const JSDOMGlobalObject& globalObject)
+{
+    UNUSED_PARAM(vm);
+    return globalObject.functionPrototype();
+}
+
+template<> void JSInterfaceNameConstructor::initializeProperties(VM& vm, JSDOMGlobalObject& globalObject)
+{
+    putDirect(vm, vm.propertyNames->prototype, JSInterfaceName::prototype(vm, &globalObject), DontDelete | ReadOnly | DontEnum);
+    putDirect(vm, vm.propertyNames->name, jsNontrivialString(&vm, String(ASCIILiteral("InterfaceName"))), ReadOnly | DontEnum);
+    putDirect(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
+}
+
+template<> const ClassInfo JSInterfaceNameConstructor::s_info = { "InterfaceName", &Base::s_info, 0, CREATE_METHOD_TABLE(JSInterfaceNameConstructor) };
+
+/* Hash table for prototype */
+
+static const HashTableValue JSInterfaceNamePrototypeTableValues[] =
+{
+    { "constructor", DontEnum, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsInterfaceNameConstructor), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSInterfaceNameConstructor) } },
+};
+
+const ClassInfo JSInterfaceNamePrototype::s_info = { "InterfaceNamePrototype", &Base::s_info, 0, CREATE_METHOD_TABLE(JSInterfaceNamePrototype) };
+
+void JSInterfaceNamePrototype::finishCreation(VM& vm)
+{
+    Base::finishCreation(vm);
+    reifyStaticProperties(vm, JSInterfaceNamePrototypeTableValues, *this);
+}
+
+const ClassInfo JSInterfaceName::s_info = { "InterfaceName", &Base::s_info, 0, CREATE_METHOD_TABLE(JSInterfaceName) };
+
+JSInterfaceName::JSInterfaceName(Structure* structure, JSDOMGlobalObject& globalObject, Ref<InterfaceName>&& impl)
+    : JSDOMWrapper<InterfaceName>(structure, globalObject, WTFMove(impl))
+{
+}
+
+JSObject* JSInterfaceName::createPrototype(VM& vm, JSGlobalObject* globalObject)
+{
+    return JSInterfaceNamePrototype::create(vm, globalObject, JSInterfaceNamePrototype::createStructure(vm, globalObject, globalObject->objectPrototype()));
+}
+
+JSObject* JSInterfaceName::prototype(VM& vm, JSGlobalObject* globalObject)
+{
+    return getDOMPrototype<JSInterfaceName>(vm, globalObject);
+}
+
+void JSInterfaceName::destroy(JSC::JSCell* cell)
+{
+    JSInterfaceName* thisObject = static_cast<JSInterfaceName*>(cell);
+    thisObject->JSInterfaceName::~JSInterfaceName();
+}
+
+EncodedJSValue jsInterfaceNameConstructor(ExecState* state, EncodedJSValue thisValue, PropertyName, JSObject*)
+{
+    JSInterfaceNamePrototype* domObject = jsDynamicCast<JSInterfaceNamePrototype*>(JSValue::decode(thisValue));
+    if (UNLIKELY(!domObject))
+        return throwVMTypeError(state);
+    return JSValue::encode(JSInterfaceName::getConstructor(state->vm(), domObject->globalObject()));
+}
+
+bool setJSInterfaceNameConstructor(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
+{
+    JSValue value = JSValue::decode(encodedValue);
+    JSInterfaceNamePrototype* domObject = jsDynamicCast<JSInterfaceNamePrototype*>(JSValue::decode(thisValue));
+    if (UNLIKELY(!domObject)) {
+        throwVMTypeError(state);
+        return false;
+    }
+    // Shadowing a built-in constructor
+    return domObject->putDirect(state->vm(), state->propertyNames().constructor, value);
+}
+
+JSValue JSInterfaceName::getConstructor(VM& vm, const JSGlobalObject* globalObject)
+{
+    return getDOMConstructor<JSInterfaceNameConstructor>(vm, *jsCast<const JSDOMGlobalObject*>(globalObject));
+}
+
+void JSInterfaceName::visitChildren(JSCell* cell, SlotVisitor& visitor)
+{
+    auto* thisObject = jsCast<JSInterfaceName*>(cell);
+    ASSERT_GC_OBJECT_INHERITS(thisObject, info());
+    Base::visitChildren(thisObject, visitor);
+    visitor.reportExtraMemoryVisited(thisObject->wrapped().memoryCost());
+}
+
+size_t JSInterfaceName::estimatedSize(JSCell* cell)
+{
+    auto* thisObject = jsCast<JSInterfaceName*>(cell);
+    return Base::estimatedSize(thisObject) + thisObject->wrapped().memoryCost();
+}
+
+bool JSInterfaceNameOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
+{
+    UNUSED_PARAM(handle);
+    UNUSED_PARAM(visitor);
+    return false;
+}
+
+void JSInterfaceNameOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
+{
+    auto* jsInterfaceName = jsCast<JSInterfaceName*>(handle.slot()->asCell());
+    auto& world = *static_cast<DOMWrapperWorld*>(context);
+    uncacheWrapper(world, &jsInterfaceName->wrapped(), jsInterfaceName);
+}
+
+#if ENABLE(BINDING_INTEGRITY)
+#if PLATFORM(WIN)
+#pragma warning(disable: 4483)
+extern "C" { extern void (*const __identifier("??_7InterfaceName@WebCore@@6B@")[])(); }
+#else
+extern "C" { extern void* _ZTVN7WebCore13InterfaceNameE[]; }
+#endif
+#endif
+
+JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject* globalObject, Ref<InterfaceName>&& impl)
+{
+
+#if ENABLE(BINDING_INTEGRITY)
+    void* actualVTablePointer = *(reinterpret_cast<void**>(impl.ptr()));
+#if PLATFORM(WIN)
+    void* expectedVTablePointer = reinterpret_cast<void*>(__identifier("??_7InterfaceName@WebCore@@6B@"));
+#else
+    void* expectedVTablePointer = &_ZTVN7WebCore13InterfaceNameE[2];
+#if COMPILER(CLANG)
+    // If this fails InterfaceName does not have a vtable, so you need to add the
+    // ImplementationLacksVTable attribute to the interface definition
+    static_assert(__is_polymorphic(InterfaceName), "InterfaceName is not polymorphic");
+#endif
+#endif
+    // If you hit this assertion you either have a use after free bug, or
+    // InterfaceName has subclasses. If InterfaceName has subclasses that get passed
+    // to toJS() we currently require InterfaceName you to opt out of binding hardening
+    // by adding the SkipVTableValidation attribute to the interface IDL definition
+    RELEASE_ASSERT(actualVTablePointer == expectedVTablePointer);
+#endif
+    globalObject->vm().heap.reportExtraMemoryAllocated(impl->memoryCost());
+    return createWrapper<JSInterfaceName, InterfaceName>(globalObject, WTFMove(impl));
+}
+
+JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, InterfaceName& impl)
+{
+    return wrap(state, globalObject, impl);
+}
+
+InterfaceName* JSInterfaceName::toWrapped(JSC::JSValue value)
+{
+    if (auto* wrapper = jsDynamicCast<JSInterfaceName*>(value))
+        return &wrapper->wrapped();
+    return nullptr;
+}
+
+}

Added: trunk/Source/WebCore/bindings/scripts/test/JS/JSInterfaceName.h (0 => 201541)


--- trunk/Source/WebCore/bindings/scripts/test/JS/JSInterfaceName.h	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSInterfaceName.h	2016-06-01 00:45:59 UTC (rev 201541)
@@ -0,0 +1,91 @@
+/*
+    This file is part of the WebKit open source project.
+    This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#pragma once
+
+#include "InterfaceName.h"
+#include "JSDOMWrapper.h"
+#include <wtf/NeverDestroyed.h>
+
+namespace WebCore {
+
+class JSInterfaceName : public JSDOMWrapper<InterfaceName> {
+public:
+    typedef JSDOMWrapper<InterfaceName> Base;
+    static JSInterfaceName* create(JSC::Structure* structure, JSDOMGlobalObject* globalObject, Ref<InterfaceName>&& impl)
+    {
+        JSInterfaceName* ptr = new (NotNull, JSC::allocateCell<JSInterfaceName>(globalObject->vm().heap)) JSInterfaceName(structure, *globalObject, WTFMove(impl));
+        ptr->finishCreation(globalObject->vm());
+        return ptr;
+    }
+
+    static const bool hasStaticPropertyTable = false;
+
+    static JSC::JSObject* createPrototype(JSC::VM&, JSC::JSGlobalObject*);
+    static JSC::JSObject* prototype(JSC::VM&, JSC::JSGlobalObject*);
+    static InterfaceName* toWrapped(JSC::JSValue);
+    static void destroy(JSC::JSCell*);
+
+    DECLARE_INFO;
+
+    static JSC::Structure* createStructure(JSC::VM& vm, JSC::JSGlobalObject* globalObject, JSC::JSValue prototype)
+    {
+        return JSC::Structure::create(vm, globalObject, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), info());
+    }
+
+    static JSC::JSValue getConstructor(JSC::VM&, const JSC::JSGlobalObject*);
+    static void visitChildren(JSCell*, JSC::SlotVisitor&);
+
+    static size_t estimatedSize(JSCell*);
+protected:
+    JSInterfaceName(JSC::Structure*, JSDOMGlobalObject&, Ref<InterfaceName>&&);
+
+    void finishCreation(JSC::VM& vm)
+    {
+        Base::finishCreation(vm);
+        ASSERT(inherits(info()));
+    }
+
+};
+
+class JSInterfaceNameOwner : public JSC::WeakHandleOwner {
+public:
+    virtual bool isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown>, void* context, JSC::SlotVisitor&);
+    virtual void finalize(JSC::Handle<JSC::Unknown>, void* context);
+};
+
+inline JSC::WeakHandleOwner* wrapperOwner(DOMWrapperWorld&, InterfaceName*)
+{
+    static NeverDestroyed<JSInterfaceNameOwner> owner;
+    return &owner.get();
+}
+
+inline void* wrapperKey(InterfaceName* wrappableObject)
+{
+    return wrappableObject;
+}
+
+JSC::JSValue toJS(JSC::ExecState*, JSDOMGlobalObject*, InterfaceName&);
+inline JSC::JSValue toJS(JSC::ExecState* state, JSDOMGlobalObject* globalObject, InterfaceName* impl) { return impl ? toJS(state, globalObject, *impl) : JSC::jsNull(); }
+JSC::JSValue toJSNewlyCreated(JSC::ExecState*, JSDOMGlobalObject*, Ref<InterfaceName>&&);
+inline JSC::JSValue toJSNewlyCreated(JSC::ExecState* state, JSDOMGlobalObject* globalObject, RefPtr<InterfaceName>&& impl) { return impl ? toJSNewlyCreated(state, globalObject, impl.releaseNonNull()) : JSC::jsNull(); }
+
+
+} // namespace WebCore

Added: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMInterfaceName.h (0 => 201541)


--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMInterfaceName.h	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMInterfaceName.h	2016-06-01 00:45:59 UTC (rev 201541)
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Samuel Weinig <sam.wei...@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#import <WebCore/DOMObject.h>
+
+WEBKIT_CLASS_AVAILABLE_MAC(9876_5)
+WEBCORE_EXPORT @interface DOMInterfaceName : DOMObject
+@end

Added: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMInterfaceName.mm (0 => 201541)


--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMInterfaceName.mm	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMInterfaceName.mm	2016-06-01 00:45:59 UTC (rev 201541)
@@ -0,0 +1,75 @@
+/*
+ * This file is part of the WebKit open source project.
+ * This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#import "config.h"
+#import "DOMInternal.h"
+
+#import "DOMInterfaceName.h"
+
+#import "DOMInterfaceNameInternal.h"
+#import "DOMNodeInternal.h"
+#import "ExceptionHandlers.h"
+#import "InterfaceName.h"
+#import "JSMainThreadExecState.h"
+#import "ThreadCheck.h"
+#import "WebCoreObjCExtras.h"
+#import "WebScriptObjectPrivate.h"
+#import <wtf/GetPtr.h>
+
+#define IMPL reinterpret_cast<WebCore::InterfaceName*>(_internal)
+
+@implementation DOMInterfaceName
+
+- (void)dealloc
+{
+    if (WebCoreObjCScheduleDeallocateOnMainThread([DOMInterfaceName class], self))
+        return;
+
+    if (_internal)
+        IMPL->deref();
+    [super dealloc];
+}
+
+@end
+
+WebCore::InterfaceName* core(DOMInterfaceName *wrapper)
+{
+    return wrapper ? reinterpret_cast<WebCore::InterfaceName*>(wrapper->_internal) : 0;
+}
+
+DOMInterfaceName *kit(WebCore::InterfaceName* value)
+{
+    WebCoreThreadViolationCheckRoundOne();
+    if (!value)
+        return nil;
+    if (DOMInterfaceName *wrapper = getDOMWrapper(value))
+        return [[wrapper retain] autorelease];
+    DOMInterfaceName *wrapper = [[DOMInterfaceName alloc] _init];
+    wrapper->_internal = reinterpret_cast<DOMObjectInternal*>(value);
+    value->ref();
+    addDOMWrapper(wrapper, value);
+    return [wrapper autorelease];
+}

Added: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMInterfaceNameInternal.h (0 => 201541)


--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMInterfaceNameInternal.h	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMInterfaceNameInternal.h	2016-06-01 00:45:59 UTC (rev 201541)
@@ -0,0 +1,34 @@
+/*
+ * This file is part of the WebKit open source project.
+ * This file has been generated by generate-bindings.pl. DO NOT MODIFY!
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#import <WebCore/DOMInterfaceName.h>
+
+namespace WebCore {
+class InterfaceName;
+}
+
+WEBCORE_EXPORT WebCore::InterfaceName* core(DOMInterfaceName *);
+WEBCORE_EXPORT DOMInterfaceName *kit(WebCore::InterfaceName*);

Added: trunk/Source/WebCore/bindings/scripts/test/TestReportExtraMemoryCost.idl (0 => 201541)


--- trunk/Source/WebCore/bindings/scripts/test/TestReportExtraMemoryCost.idl	                        (rev 0)
+++ trunk/Source/WebCore/bindings/scripts/test/TestReportExtraMemoryCost.idl	2016-06-01 00:45:59 UTC (rev 201541)
@@ -0,0 +1,30 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    ReportExtraMemoryCost,
+] interface InterfaceName {
+};
+
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to