dbc6b2d1613991c6ef0883efc4c6665886c037db
[WebKit-https.git] / Source / WebCore / bindings / scripts / test / GObject / WebKitDOMTestJSBuiltinConstructor.cpp
1 /*
2  *  This file is part of the WebKit open source project.
3  *  This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4  *
5  *  This library is free software; you can redistribute it and/or
6  *  modify it under the terms of the GNU Library General Public
7  *  License as published by the Free Software Foundation; either
8  *  version 2 of the License, or (at your option) any later version.
9  *
10  *  This library is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  *  Library General Public License for more details.
14  *
15  *  You should have received a copy of the GNU Library General Public License
16  *  along with this library; see the file COPYING.LIB.  If not, write to
17  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18  *  Boston, MA 02110-1301, USA.
19  */
20
21 #include "config.h"
22 #include "WebKitDOMTestJSBuiltinConstructor.h"
23
24 #include "CSSImportRule.h"
25 #include "DOMObjectCache.h"
26 #include "Document.h"
27 #include "ExceptionCode.h"
28 #include "ExceptionCodeDescription.h"
29 #include "JSMainThreadExecState.h"
30 #include "WebKitDOMPrivate.h"
31 #include "WebKitDOMTestJSBuiltinConstructorPrivate.h"
32 #include "gobject/ConvertToUTF8String.h"
33 #include <wtf/GetPtr.h>
34 #include <wtf/RefPtr.h>
35
36 #define WEBKIT_DOM_TEST_JS_BUILTIN_CONSTRUCTOR_GET_PRIVATE(obj) G_TYPE_INSTANCE_GET_PRIVATE(obj, WEBKIT_DOM_TYPE_TEST_JS_BUILTIN_CONSTRUCTOR, WebKitDOMTestJSBuiltinConstructorPrivate)
37
38 typedef struct _WebKitDOMTestJSBuiltinConstructorPrivate {
39     RefPtr<WebCore::TestJSBuiltinConstructor> coreObject;
40 } WebKitDOMTestJSBuiltinConstructorPrivate;
41
42 namespace WebKit {
43
44 WebKitDOMTestJSBuiltinConstructor* kit(WebCore::TestJSBuiltinConstructor* obj)
45 {
46     if (!obj)
47         return 0;
48
49     if (gpointer ret = DOMObjectCache::get(obj))
50         return WEBKIT_DOM_TEST_JS_BUILTIN_CONSTRUCTOR(ret);
51
52     return wrapTestJSBuiltinConstructor(obj);
53 }
54
55 WebCore::TestJSBuiltinConstructor* core(WebKitDOMTestJSBuiltinConstructor* request)
56 {
57     return request ? static_cast<WebCore::TestJSBuiltinConstructor*>(WEBKIT_DOM_OBJECT(request)->coreObject) : 0;
58 }
59
60 WebKitDOMTestJSBuiltinConstructor* wrapTestJSBuiltinConstructor(WebCore::TestJSBuiltinConstructor* coreObject)
61 {
62     ASSERT(coreObject);
63     return WEBKIT_DOM_TEST_JS_BUILTIN_CONSTRUCTOR(g_object_new(WEBKIT_DOM_TYPE_TEST_JS_BUILTIN_CONSTRUCTOR, "core-object", coreObject, nullptr));
64 }
65
66 } // namespace WebKit
67
68 G_DEFINE_TYPE(WebKitDOMTestJSBuiltinConstructor, webkit_dom_test_js_builtin_constructor, WEBKIT_DOM_TYPE_OBJECT)
69
70 static void webkit_dom_test_js_builtin_constructor_finalize(GObject* object)
71 {
72     WebKitDOMTestJSBuiltinConstructorPrivate* priv = WEBKIT_DOM_TEST_JS_BUILTIN_CONSTRUCTOR_GET_PRIVATE(object);
73
74     WebKit::DOMObjectCache::forget(priv->coreObject.get());
75
76     priv->~WebKitDOMTestJSBuiltinConstructorPrivate();
77     G_OBJECT_CLASS(webkit_dom_test_js_builtin_constructor_parent_class)->finalize(object);
78 }
79
80 static GObject* webkit_dom_test_js_builtin_constructor_constructor(GType type, guint constructPropertiesCount, GObjectConstructParam* constructProperties)
81 {
82     GObject* object = G_OBJECT_CLASS(webkit_dom_test_js_builtin_constructor_parent_class)->constructor(type, constructPropertiesCount, constructProperties);
83
84     WebKitDOMTestJSBuiltinConstructorPrivate* priv = WEBKIT_DOM_TEST_JS_BUILTIN_CONSTRUCTOR_GET_PRIVATE(object);
85     priv->coreObject = static_cast<WebCore::TestJSBuiltinConstructor*>(WEBKIT_DOM_OBJECT(object)->coreObject);
86     WebKit::DOMObjectCache::put(priv->coreObject.get(), object);
87
88     return object;
89 }
90
91 static void webkit_dom_test_js_builtin_constructor_class_init(WebKitDOMTestJSBuiltinConstructorClass* requestClass)
92 {
93     GObjectClass* gobjectClass = G_OBJECT_CLASS(requestClass);
94     g_type_class_add_private(gobjectClass, sizeof(WebKitDOMTestJSBuiltinConstructorPrivate));
95     gobjectClass->constructor = webkit_dom_test_js_builtin_constructor_constructor;
96     gobjectClass->finalize = webkit_dom_test_js_builtin_constructor_finalize;
97 }
98
99 static void webkit_dom_test_js_builtin_constructor_init(WebKitDOMTestJSBuiltinConstructor* request)
100 {
101     WebKitDOMTestJSBuiltinConstructorPrivate* priv = WEBKIT_DOM_TEST_JS_BUILTIN_CONSTRUCTOR_GET_PRIVATE(request);
102     new (priv) WebKitDOMTestJSBuiltinConstructorPrivate();
103 }
104