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 <glib-object.h>
22#include "config.h"
23
24#if ENABLE(Condition1) || ENABLE(Condition2)
25
26#include <wtf/GetPtr.h>
27#include <wtf/RefPtr.h>
28#include "DOMObjectCache.h"
29#include "ExceptionCode.h"
30#include "JSMainThreadExecState.h"
31#include "TestInterface.h"
32#include "WebKitDOMBinding.h"
33#include "gobject/ConvertToUTF8String.h"
34#include "webkit/WebKitDOMTestInterface.h"
35#include "webkit/WebKitDOMTestInterfacePrivate.h"
36#include "webkitdefines.h"
37#include "webkitglobalsprivate.h"
38#include "webkitmarshal.h"
39
40namespace WebKit {
41
42WebKitDOMTestInterface* kit(WebCore::TestInterface* obj)
43{
44    g_return_val_if_fail(obj, 0);
45
46    if (gpointer ret = DOMObjectCache::get(obj))
47        return static_cast<WebKitDOMTestInterface*>(ret);
48
49    return static_cast<WebKitDOMTestInterface*>(DOMObjectCache::put(obj, WebKit::wrapTestInterface(obj)));
50}
51
52} // namespace WebKit //
53
54
55G_DEFINE_TYPE(WebKitDOMTestInterface, webkit_dom_test_interface, WEBKIT_TYPE_DOM_OBJECT)
56
57namespace WebKit {
58
59WebCore::TestInterface* core(WebKitDOMTestInterface* request)
60{
61    g_return_val_if_fail(request, 0);
62
63    WebCore::TestInterface* coreObject = static_cast<WebCore::TestInterface*>(WEBKIT_DOM_OBJECT(request)->coreObject);
64    g_return_val_if_fail(coreObject, 0);
65
66    return coreObject;
67}
68
69} // namespace WebKit
70enum {
71    PROP_0,
72};
73
74
75static void webkit_dom_test_interface_finalize(GObject* object)
76{
77    WebKitDOMObject* dom_object = WEBKIT_DOM_OBJECT(object);
78
79    if (dom_object->coreObject) {
80        WebCore::TestInterface* coreObject = static_cast<WebCore::TestInterface *>(dom_object->coreObject);
81
82        WebKit::DOMObjectCache::forget(coreObject);
83        coreObject->deref();
84
85        dom_object->coreObject = NULL;
86    }
87
88    G_OBJECT_CLASS(webkit_dom_test_interface_parent_class)->finalize(object);
89}
90
91static void webkit_dom_test_interface_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec)
92{
93    WebCore::JSMainThreadNullState state;
94    switch (prop_id) {
95    default:
96        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
97        break;
98    }
99}
100
101
102static void webkit_dom_test_interface_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec)
103{
104    WebCore::JSMainThreadNullState state;
105    switch (prop_id) {
106    default:
107        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
108        break;
109    }
110}
111
112
113static void webkit_dom_test_interface_constructed(GObject* object)
114{
115
116    if (G_OBJECT_CLASS(webkit_dom_test_interface_parent_class)->constructed)
117        G_OBJECT_CLASS(webkit_dom_test_interface_parent_class)->constructed(object);
118}
119
120static void webkit_dom_test_interface_class_init(WebKitDOMTestInterfaceClass* requestClass)
121{
122    GObjectClass *gobjectClass = G_OBJECT_CLASS(requestClass);
123    gobjectClass->finalize = webkit_dom_test_interface_finalize;
124    gobjectClass->set_property = webkit_dom_test_interface_set_property;
125    gobjectClass->get_property = webkit_dom_test_interface_get_property;
126    gobjectClass->constructed = webkit_dom_test_interface_constructed;
127
128
129
130}
131
132static void webkit_dom_test_interface_init(WebKitDOMTestInterface* request)
133{
134}
135
136namespace WebKit {
137WebKitDOMTestInterface* wrapTestInterface(WebCore::TestInterface* coreObject)
138{
139    g_return_val_if_fail(coreObject, 0);
140
141    /* We call ref() rather than using a C++ smart pointer because we can't store a C++ object
142     * in a C-allocated GObject structure.  See the finalize() code for the
143     * matching deref().
144     */
145    coreObject->ref();
146
147    return  WEBKIT_DOM_TEST_INTERFACE(g_object_new(WEBKIT_TYPE_DOM_TEST_INTERFACE,
148                                               "core-object", coreObject, NULL));
149}
150} // namespace WebKit
151#endif /* ENABLE(Condition1) || ENABLE(Condition2) */
152