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 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#import "config.h"
28
29#if ENABLE(Condition1) || ENABLE(Condition2)
30
31#import "DOMInternal.h"
32
33#import "DOMTestSerializedScriptValueInterface.h"
34
35#import "DOMNodeInternal.h"
36#import "DOMTestSerializedScriptValueInterfaceInternal.h"
37#import "ExceptionHandlers.h"
38#import "JSMainThreadExecState.h"
39#import "SerializedScriptValue.h"
40#import "TestSerializedScriptValueInterface.h"
41#import "ThreadCheck.h"
42#import "WebCoreObjCExtras.h"
43#import "WebScriptObjectPrivate.h"
44#import <wtf/GetPtr.h>
45
46#define IMPL reinterpret_cast<WebCore::TestSerializedScriptValueInterface*>(_internal)
47
48@implementation DOMTestSerializedScriptValueInterface
49
50- (void)dealloc
51{
52    if (WebCoreObjCScheduleDeallocateOnMainThread([DOMTestSerializedScriptValueInterface class], self))
53        return;
54
55    if (_internal)
56        IMPL->deref();
57    [super dealloc];
58}
59
60- (void)finalize
61{
62    if (_internal)
63        IMPL->deref();
64    [super finalize];
65}
66
67- (NSString *)value
68{
69    WebCore::JSMainThreadNullState state;
70    return IMPL->value()->toString();
71}
72
73- (void)setValue:(NSString *)newValue
74{
75    WebCore::JSMainThreadNullState state;
76    ASSERT(newValue);
77
78    IMPL->setValue(WebCore::SerializedScriptValue::create(WTF::String(newValue)));
79}
80
81- (NSString *)readonlyValue
82{
83    WebCore::JSMainThreadNullState state;
84    return IMPL->readonlyValue()->toString();
85}
86
87- (NSString *)cachedValue
88{
89    WebCore::JSMainThreadNullState state;
90    return IMPL->cachedValue()->toString();
91}
92
93- (void)setCachedValue:(NSString *)newCachedValue
94{
95    WebCore::JSMainThreadNullState state;
96    ASSERT(newCachedValue);
97
98    IMPL->setCachedValue(WebCore::SerializedScriptValue::create(WTF::String(newCachedValue)));
99}
100
101- (NSString *)cachedReadonlyValue
102{
103    WebCore::JSMainThreadNullState state;
104    return IMPL->cachedReadonlyValue()->toString();
105}
106
107@end
108
109WebCore::TestSerializedScriptValueInterface* core(DOMTestSerializedScriptValueInterface *wrapper)
110{
111    return wrapper ? reinterpret_cast<WebCore::TestSerializedScriptValueInterface*>(wrapper->_internal) : 0;
112}
113
114DOMTestSerializedScriptValueInterface *kit(WebCore::TestSerializedScriptValueInterface* value)
115{
116    { DOM_ASSERT_MAIN_THREAD(); WebCoreThreadViolationCheckRoundOne(); };
117    if (!value)
118        return nil;
119    if (DOMTestSerializedScriptValueInterface *wrapper = getDOMWrapper(value))
120        return [[wrapper retain] autorelease];
121    DOMTestSerializedScriptValueInterface *wrapper = [[DOMTestSerializedScriptValueInterface alloc] _init];
122    wrapper->_internal = reinterpret_cast<DOMObjectInternal*>(value);
123    value->ref();
124    addDOMWrapper(wrapper, value);
125    return [wrapper autorelease];
126}
127
128#endif // ENABLE(Condition1) || ENABLE(Condition2)
129