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 "WebKitDOMTestCustomNamedGetter.h" 23 24#include "CSSImportRule.h" 25#include "DOMObjectCache.h" 26#include "Document.h" 27#include "ExceptionCode.h" 28#include "JSMainThreadExecState.h" 29#include "WebKitDOMPrivate.h" 30#include "WebKitDOMTestCustomNamedGetterPrivate.h" 31#include "gobject/ConvertToUTF8String.h" 32#include <wtf/GetPtr.h> 33#include <wtf/RefPtr.h> 34 35#define WEBKIT_DOM_TEST_CUSTOM_NAMED_GETTER_GET_PRIVATE(obj) G_TYPE_INSTANCE_GET_PRIVATE(obj, WEBKIT_DOM_TYPE_TEST_CUSTOM_NAMED_GETTER, WebKitDOMTestCustomNamedGetterPrivate) 36 37typedef struct _WebKitDOMTestCustomNamedGetterPrivate { 38 RefPtr<WebCore::TestCustomNamedGetter> coreObject; 39} WebKitDOMTestCustomNamedGetterPrivate; 40 41namespace WebKit { 42 43WebKitDOMTestCustomNamedGetter* kit(WebCore::TestCustomNamedGetter* obj) 44{ 45 if (!obj) 46 return 0; 47 48 if (gpointer ret = DOMObjectCache::get(obj)) 49 return WEBKIT_DOM_TEST_CUSTOM_NAMED_GETTER(ret); 50 51 return wrapTestCustomNamedGetter(obj); 52} 53 54WebCore::TestCustomNamedGetter* core(WebKitDOMTestCustomNamedGetter* request) 55{ 56 return request ? static_cast<WebCore::TestCustomNamedGetter*>(WEBKIT_DOM_OBJECT(request)->coreObject) : 0; 57} 58 59WebKitDOMTestCustomNamedGetter* wrapTestCustomNamedGetter(WebCore::TestCustomNamedGetter* coreObject) 60{ 61 ASSERT(coreObject); 62 return WEBKIT_DOM_TEST_CUSTOM_NAMED_GETTER(g_object_new(WEBKIT_DOM_TYPE_TEST_CUSTOM_NAMED_GETTER, "core-object", coreObject, nullptr)); 63} 64 65} // namespace WebKit 66 67G_DEFINE_TYPE(WebKitDOMTestCustomNamedGetter, webkit_dom_test_custom_named_getter, WEBKIT_DOM_TYPE_OBJECT) 68 69static void webkit_dom_test_custom_named_getter_finalize(GObject* object) 70{ 71 WebKitDOMTestCustomNamedGetterPrivate* priv = WEBKIT_DOM_TEST_CUSTOM_NAMED_GETTER_GET_PRIVATE(object); 72 73 WebKit::DOMObjectCache::forget(priv->coreObject.get()); 74 75 priv->~WebKitDOMTestCustomNamedGetterPrivate(); 76 G_OBJECT_CLASS(webkit_dom_test_custom_named_getter_parent_class)->finalize(object); 77} 78 79static GObject* webkit_dom_test_custom_named_getter_constructor(GType type, guint constructPropertiesCount, GObjectConstructParam* constructProperties) 80{ 81 GObject* object = G_OBJECT_CLASS(webkit_dom_test_custom_named_getter_parent_class)->constructor(type, constructPropertiesCount, constructProperties); 82 83 WebKitDOMTestCustomNamedGetterPrivate* priv = WEBKIT_DOM_TEST_CUSTOM_NAMED_GETTER_GET_PRIVATE(object); 84 priv->coreObject = static_cast<WebCore::TestCustomNamedGetter*>(WEBKIT_DOM_OBJECT(object)->coreObject); 85 WebKit::DOMObjectCache::put(priv->coreObject.get(), object); 86 87 return object; 88} 89 90static void webkit_dom_test_custom_named_getter_class_init(WebKitDOMTestCustomNamedGetterClass* requestClass) 91{ 92 GObjectClass* gobjectClass = G_OBJECT_CLASS(requestClass); 93 g_type_class_add_private(gobjectClass, sizeof(WebKitDOMTestCustomNamedGetterPrivate)); 94 gobjectClass->constructor = webkit_dom_test_custom_named_getter_constructor; 95 gobjectClass->finalize = webkit_dom_test_custom_named_getter_finalize; 96} 97 98static void webkit_dom_test_custom_named_getter_init(WebKitDOMTestCustomNamedGetter* request) 99{ 100 WebKitDOMTestCustomNamedGetterPrivate* priv = WEBKIT_DOM_TEST_CUSTOM_NAMED_GETTER_GET_PRIVATE(request); 101 new (priv) WebKitDOMTestCustomNamedGetterPrivate(); 102} 103 104void webkit_dom_test_custom_named_getter_another_function(WebKitDOMTestCustomNamedGetter* self, const gchar* str) 105{ 106 WebCore::JSMainThreadNullState state; 107 g_return_if_fail(WEBKIT_DOM_IS_TEST_CUSTOM_NAMED_GETTER(self)); 108 g_return_if_fail(str); 109 WebCore::TestCustomNamedGetter* item = WebKit::core(self); 110 WTF::String convertedStr = WTF::String::fromUTF8(str); 111 item->anotherFunction(convertedStr); 112} 113 114