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 "WebKitDOMTestCallback.h" 23 24#include "CSSImportRule.h" 25#include "DOMObjectCache.h" 26#include "Document.h" 27#include "ExceptionCode.h" 28#include "JSMainThreadExecState.h" 29#include "WebKitDOMDOMStringListPrivate.h" 30#include "WebKitDOMFloat32ArrayPrivate.h" 31#include "WebKitDOMPrivate.h" 32#include "WebKitDOMSerializedScriptValuePrivate.h" 33#include "WebKitDOMTestCallbackPrivate.h" 34#include "WebKitDOMTestNodePrivate.h" 35#include "gobject/ConvertToUTF8String.h" 36#include <wtf/GetPtr.h> 37#include <wtf/RefPtr.h> 38 39#define WEBKIT_DOM_TEST_CALLBACK_GET_PRIVATE(obj) G_TYPE_INSTANCE_GET_PRIVATE(obj, WEBKIT_DOM_TYPE_TEST_CALLBACK, WebKitDOMTestCallbackPrivate) 40 41typedef struct _WebKitDOMTestCallbackPrivate { 42#if ENABLE(SQL_DATABASE) 43 RefPtr<WebCore::TestCallback> coreObject; 44#endif // ENABLE(SQL_DATABASE) 45} WebKitDOMTestCallbackPrivate; 46 47#if ENABLE(SQL_DATABASE) 48 49namespace WebKit { 50 51WebKitDOMTestCallback* kit(WebCore::TestCallback* obj) 52{ 53 if (!obj) 54 return 0; 55 56 if (gpointer ret = DOMObjectCache::get(obj)) 57 return WEBKIT_DOM_TEST_CALLBACK(ret); 58 59 return wrapTestCallback(obj); 60} 61 62WebCore::TestCallback* core(WebKitDOMTestCallback* request) 63{ 64 return request ? static_cast<WebCore::TestCallback*>(WEBKIT_DOM_OBJECT(request)->coreObject) : 0; 65} 66 67WebKitDOMTestCallback* wrapTestCallback(WebCore::TestCallback* coreObject) 68{ 69 ASSERT(coreObject); 70 return WEBKIT_DOM_TEST_CALLBACK(g_object_new(WEBKIT_DOM_TYPE_TEST_CALLBACK, "core-object", coreObject, nullptr)); 71} 72 73} // namespace WebKit 74 75#endif // ENABLE(SQL_DATABASE) 76 77G_DEFINE_TYPE(WebKitDOMTestCallback, webkit_dom_test_callback, WEBKIT_DOM_TYPE_OBJECT) 78 79static void webkit_dom_test_callback_finalize(GObject* object) 80{ 81 WebKitDOMTestCallbackPrivate* priv = WEBKIT_DOM_TEST_CALLBACK_GET_PRIVATE(object); 82#if ENABLE(SQL_DATABASE) 83 WebKit::DOMObjectCache::forget(priv->coreObject.get()); 84#endif // ENABLE(SQL_DATABASE) 85 priv->~WebKitDOMTestCallbackPrivate(); 86 G_OBJECT_CLASS(webkit_dom_test_callback_parent_class)->finalize(object); 87} 88 89static GObject* webkit_dom_test_callback_constructor(GType type, guint constructPropertiesCount, GObjectConstructParam* constructProperties) 90{ 91 GObject* object = G_OBJECT_CLASS(webkit_dom_test_callback_parent_class)->constructor(type, constructPropertiesCount, constructProperties); 92#if ENABLE(SQL_DATABASE) 93 WebKitDOMTestCallbackPrivate* priv = WEBKIT_DOM_TEST_CALLBACK_GET_PRIVATE(object); 94 priv->coreObject = static_cast<WebCore::TestCallback*>(WEBKIT_DOM_OBJECT(object)->coreObject); 95 WebKit::DOMObjectCache::put(priv->coreObject.get(), object); 96#endif // ENABLE(SQL_DATABASE) 97 return object; 98} 99 100static void webkit_dom_test_callback_class_init(WebKitDOMTestCallbackClass* requestClass) 101{ 102 GObjectClass* gobjectClass = G_OBJECT_CLASS(requestClass); 103 g_type_class_add_private(gobjectClass, sizeof(WebKitDOMTestCallbackPrivate)); 104 gobjectClass->constructor = webkit_dom_test_callback_constructor; 105 gobjectClass->finalize = webkit_dom_test_callback_finalize; 106} 107 108static void webkit_dom_test_callback_init(WebKitDOMTestCallback* request) 109{ 110 WebKitDOMTestCallbackPrivate* priv = WEBKIT_DOM_TEST_CALLBACK_GET_PRIVATE(request); 111 new (priv) WebKitDOMTestCallbackPrivate(); 112} 113 114gboolean webkit_dom_test_callback_callback_with_no_param(WebKitDOMTestCallback* self) 115{ 116#if ENABLE(SQL_DATABASE) 117 WebCore::JSMainThreadNullState state; 118 g_return_val_if_fail(WEBKIT_DOM_IS_TEST_CALLBACK(self), FALSE); 119 WebCore::TestCallback* item = WebKit::core(self); 120 gboolean result = item->callbackWithNoParam(); 121 return result; 122#else 123 UNUSED_PARAM(self); 124 WEBKIT_WARN_FEATURE_NOT_PRESENT("SQL Database") 125 return static_cast<gboolean>(0); 126#endif /* ENABLE(SQL_DATABASE) */ 127} 128 129gboolean webkit_dom_test_callback_callback_with_array_param(WebKitDOMTestCallback* self, WebKitDOMFloat32Array* arrayParam) 130{ 131#if ENABLE(SQL_DATABASE) 132 WebCore::JSMainThreadNullState state; 133 g_return_val_if_fail(WEBKIT_DOM_IS_TEST_CALLBACK(self), FALSE); 134 g_return_val_if_fail(WEBKIT_DOM_IS_FLOAT32ARRAY(arrayParam), FALSE); 135 WebCore::TestCallback* item = WebKit::core(self); 136 WebCore::Float32Array* convertedArrayParam = WebKit::core(arrayParam); 137 gboolean result = item->callbackWithArrayParam(convertedArrayParam); 138 return result; 139#else 140 UNUSED_PARAM(self); 141 UNUSED_PARAM(arrayParam); 142 WEBKIT_WARN_FEATURE_NOT_PRESENT("SQL Database") 143 return static_cast<gboolean>(0); 144#endif /* ENABLE(SQL_DATABASE) */ 145} 146 147gboolean webkit_dom_test_callback_callback_with_serialized_script_value_param(WebKitDOMTestCallback* self, WebKitDOMSerializedScriptValue* srzParam, const gchar* strArg) 148{ 149#if ENABLE(SQL_DATABASE) 150 WebCore::JSMainThreadNullState state; 151 g_return_val_if_fail(WEBKIT_DOM_IS_TEST_CALLBACK(self), FALSE); 152 g_return_val_if_fail(WEBKIT_DOM_IS_SERIALIZED_SCRIPT_VALUE(srzParam), FALSE); 153 g_return_val_if_fail(strArg, FALSE); 154 WebCore::TestCallback* item = WebKit::core(self); 155 WebCore::SerializedScriptValue* convertedSrzParam = WebKit::core(srzParam); 156 WTF::String convertedStrArg = WTF::String::fromUTF8(strArg); 157 gboolean result = item->callbackWithSerializedScriptValueParam(convertedSrzParam, convertedStrArg); 158 return result; 159#else 160 UNUSED_PARAM(self); 161 UNUSED_PARAM(srzParam); 162 UNUSED_PARAM(strArg); 163 WEBKIT_WARN_FEATURE_NOT_PRESENT("SQL Database") 164 return static_cast<gboolean>(0); 165#endif /* ENABLE(SQL_DATABASE) */ 166} 167 168glong webkit_dom_test_callback_callback_with_non_bool_return_type(WebKitDOMTestCallback* self, const gchar* strArg) 169{ 170#if ENABLE(SQL_DATABASE) 171 WebCore::JSMainThreadNullState state; 172 g_return_val_if_fail(WEBKIT_DOM_IS_TEST_CALLBACK(self), 0); 173 g_return_val_if_fail(strArg, 0); 174 WebCore::TestCallback* item = WebKit::core(self); 175 WTF::String convertedStrArg = WTF::String::fromUTF8(strArg); 176 glong result = item->callbackWithNonBoolReturnType(convertedStrArg); 177 return result; 178#else 179 UNUSED_PARAM(self); 180 UNUSED_PARAM(strArg); 181 WEBKIT_WARN_FEATURE_NOT_PRESENT("SQL Database") 182 return static_cast<glong>(0); 183#endif /* ENABLE(SQL_DATABASE) */ 184} 185 186gboolean webkit_dom_test_callback_callback_with_string_list(WebKitDOMTestCallback* self, WebKitDOMDOMStringList* listParam) 187{ 188#if ENABLE(SQL_DATABASE) 189 WebCore::JSMainThreadNullState state; 190 g_return_val_if_fail(WEBKIT_DOM_IS_TEST_CALLBACK(self), FALSE); 191 g_return_val_if_fail(WEBKIT_DOM_IS_DOM_STRING_LIST(listParam), FALSE); 192 WebCore::TestCallback* item = WebKit::core(self); 193 WebCore::DOMStringList* convertedListParam = WebKit::core(listParam); 194 gboolean result = item->callbackWithStringList(convertedListParam); 195 return result; 196#else 197 UNUSED_PARAM(self); 198 UNUSED_PARAM(listParam); 199 WEBKIT_WARN_FEATURE_NOT_PRESENT("SQL Database") 200 return static_cast<gboolean>(0); 201#endif /* ENABLE(SQL_DATABASE) */ 202} 203 204gboolean webkit_dom_test_callback_callback_with_boolean(WebKitDOMTestCallback* self, gboolean boolParam) 205{ 206#if ENABLE(SQL_DATABASE) 207 WebCore::JSMainThreadNullState state; 208 g_return_val_if_fail(WEBKIT_DOM_IS_TEST_CALLBACK(self), FALSE); 209 WebCore::TestCallback* item = WebKit::core(self); 210 gboolean result = item->callbackWithBoolean(boolParam); 211 return result; 212#else 213 UNUSED_PARAM(self); 214 UNUSED_PARAM(boolParam); 215 WEBKIT_WARN_FEATURE_NOT_PRESENT("SQL Database") 216 return static_cast<gboolean>(0); 217#endif /* ENABLE(SQL_DATABASE) */ 218} 219 220gboolean webkit_dom_test_callback_callback_requires_this_to_pass(WebKitDOMTestCallback* self, glong longParam, WebKitDOMTestNode* testNodeParam) 221{ 222#if ENABLE(SQL_DATABASE) 223 WebCore::JSMainThreadNullState state; 224 g_return_val_if_fail(WEBKIT_DOM_IS_TEST_CALLBACK(self), FALSE); 225 g_return_val_if_fail(WEBKIT_DOM_IS_TEST_NODE(testNodeParam), FALSE); 226 WebCore::TestCallback* item = WebKit::core(self); 227 WebCore::TestNode* convertedTestNodeParam = WebKit::core(testNodeParam); 228 gboolean result = item->callbackRequiresThisToPass(longParam, convertedTestNodeParam); 229 return result; 230#else 231 UNUSED_PARAM(self); 232 UNUSED_PARAM(longParam); 233 UNUSED_PARAM(testNodeParam); 234 WEBKIT_WARN_FEATURE_NOT_PRESENT("SQL Database") 235 return static_cast<gboolean>(0); 236#endif /* ENABLE(SQL_DATABASE) */ 237} 238 239