Home | History | Annotate | Download | only in GObject
      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 "SerializedScriptValue.h"
     32 #include "TestSerializedScriptValueInterface.h"
     33 #include "WebKitDOMBinding.h"
     34 #include "gobject/ConvertToUTF8String.h"
     35 #include "webkit/WebKitDOMSerializedScriptValue.h"
     36 #include "webkit/WebKitDOMSerializedScriptValuePrivate.h"
     37 #include "webkit/WebKitDOMTestSerializedScriptValueInterface.h"
     38 #include "webkit/WebKitDOMTestSerializedScriptValueInterfacePrivate.h"
     39 #include "webkitdefines.h"
     40 #include "webkitglobalsprivate.h"
     41 #include "webkitmarshal.h"
     42 
     43 namespace WebKit {
     44 
     45 WebKitDOMTestSerializedScriptValueInterface* kit(WebCore::TestSerializedScriptValueInterface* obj)
     46 {
     47     g_return_val_if_fail(obj, 0);
     48 
     49     if (gpointer ret = DOMObjectCache::get(obj))
     50         return static_cast<WebKitDOMTestSerializedScriptValueInterface*>(ret);
     51 
     52     return static_cast<WebKitDOMTestSerializedScriptValueInterface*>(DOMObjectCache::put(obj, WebKit::wrapTestSerializedScriptValueInterface(obj)));
     53 }
     54 
     55 } // namespace WebKit //
     56 
     57 WebKitDOMSerializedScriptValue*
     58 webkit_dom_test_serialized_script_value_interface_get_value(WebKitDOMTestSerializedScriptValueInterface* self)
     59 {
     60     g_return_val_if_fail(self, 0);
     61     WebCore::JSMainThreadNullState state;
     62     WebCore::TestSerializedScriptValueInterface * item = WebKit::core(self);
     63     PassRefPtr<WebCore::SerializedScriptValue> g_res = WTF::getPtr(item->value());
     64     WebKitDOMSerializedScriptValue* res = WebKit::kit(g_res.get());
     65     return res;
     66 }
     67 
     68 
     69 G_DEFINE_TYPE(WebKitDOMTestSerializedScriptValueInterface, webkit_dom_test_serialized_script_value_interface, WEBKIT_TYPE_DOM_OBJECT)
     70 
     71 namespace WebKit {
     72 
     73 WebCore::TestSerializedScriptValueInterface* core(WebKitDOMTestSerializedScriptValueInterface* request)
     74 {
     75     g_return_val_if_fail(request, 0);
     76 
     77     WebCore::TestSerializedScriptValueInterface* coreObject = static_cast<WebCore::TestSerializedScriptValueInterface*>(WEBKIT_DOM_OBJECT(request)->coreObject);
     78     g_return_val_if_fail(coreObject, 0);
     79 
     80     return coreObject;
     81 }
     82 
     83 } // namespace WebKit
     84 enum {
     85     PROP_0,
     86     PROP_VALUE,
     87 };
     88 
     89 
     90 static void webkit_dom_test_serialized_script_value_interface_finalize(GObject* object)
     91 {
     92     WebKitDOMObject* dom_object = WEBKIT_DOM_OBJECT(object);
     93 
     94     if (dom_object->coreObject) {
     95         WebCore::TestSerializedScriptValueInterface* coreObject = static_cast<WebCore::TestSerializedScriptValueInterface *>(dom_object->coreObject);
     96 
     97         WebKit::DOMObjectCache::forget(coreObject);
     98         coreObject->deref();
     99 
    100         dom_object->coreObject = NULL;
    101     }
    102 
    103     G_OBJECT_CLASS(webkit_dom_test_serialized_script_value_interface_parent_class)->finalize(object);
    104 }
    105 
    106 static void webkit_dom_test_serialized_script_value_interface_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec)
    107 {
    108     WebCore::JSMainThreadNullState state;
    109     switch (prop_id) {
    110     default:
    111         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
    112         break;
    113     }
    114 }
    115 
    116 
    117 static void webkit_dom_test_serialized_script_value_interface_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec)
    118 {
    119     WebCore::JSMainThreadNullState state;
    120     WebKitDOMTestSerializedScriptValueInterface* self = WEBKIT_DOM_TEST_SERIALIZED_SCRIPT_VALUE_INTERFACE(object);
    121     WebCore::TestSerializedScriptValueInterface* coreSelf = WebKit::core(self);
    122     switch (prop_id) {
    123     case PROP_VALUE:
    124     {
    125         RefPtr<WebCore::SerializedScriptValue> ptr = coreSelf->value();
    126         g_value_set_object(value, WebKit::kit(ptr.get()));
    127         break;
    128     }
    129     default:
    130         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
    131         break;
    132     }
    133 }
    134 
    135 
    136 static void webkit_dom_test_serialized_script_value_interface_constructed(GObject* object)
    137 {
    138 
    139     if (G_OBJECT_CLASS(webkit_dom_test_serialized_script_value_interface_parent_class)->constructed)
    140         G_OBJECT_CLASS(webkit_dom_test_serialized_script_value_interface_parent_class)->constructed(object);
    141 }
    142 
    143 static void webkit_dom_test_serialized_script_value_interface_class_init(WebKitDOMTestSerializedScriptValueInterfaceClass* requestClass)
    144 {
    145     GObjectClass *gobjectClass = G_OBJECT_CLASS(requestClass);
    146     gobjectClass->finalize = webkit_dom_test_serialized_script_value_interface_finalize;
    147     gobjectClass->set_property = webkit_dom_test_serialized_script_value_interface_set_property;
    148     gobjectClass->get_property = webkit_dom_test_serialized_script_value_interface_get_property;
    149     gobjectClass->constructed = webkit_dom_test_serialized_script_value_interface_constructed;
    150 
    151     g_object_class_install_property(gobjectClass,
    152                                     PROP_VALUE,
    153                                     g_param_spec_object("value", /* name */
    154                                                            "test_serialized_script_value_interface_value", /* short description */
    155                                                            "read-only  WebKitDOMSerializedScriptValue* TestSerializedScriptValueInterface.value", /* longer - could do with some extra doc stuff here */
    156                                                            WEBKIT_TYPE_DOM_SERIALIZED_SCRIPT_VALUE, /* gobject type */
    157                                                            WEBKIT_PARAM_READABLE));
    158 
    159 
    160 }
    161 
    162 static void webkit_dom_test_serialized_script_value_interface_init(WebKitDOMTestSerializedScriptValueInterface* request)
    163 {
    164 }
    165 
    166 namespace WebKit {
    167 WebKitDOMTestSerializedScriptValueInterface* wrapTestSerializedScriptValueInterface(WebCore::TestSerializedScriptValueInterface* coreObject)
    168 {
    169     g_return_val_if_fail(coreObject, 0);
    170 
    171     /* We call ref() rather than using a C++ smart pointer because we can't store a C++ object
    172      * in a C-allocated GObject structure.  See the finalize() code for the
    173      * matching deref().
    174      */
    175     coreObject->ref();
    176 
    177     return  WEBKIT_DOM_TEST_SERIALIZED_SCRIPT_VALUE_INTERFACE(g_object_new(WEBKIT_TYPE_DOM_TEST_SERIALIZED_SCRIPT_VALUE_INTERFACE,
    178                                                "core-object", coreObject, NULL));
    179 }
    180 } // namespace WebKit
    181 #endif /* ENABLE(Condition1) || ENABLE(Condition2) */
    182