initial import
[vuplus_webkit] / Source / WebCore / bindings / scripts / test / V8 / V8TestSerializedScriptValueInterface.cpp
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., 59 Temple Place - Suite 330,
18     Boston, MA 02111-1307, USA.
19 */
20
21 #include "config.h"
22 #include "V8TestSerializedScriptValueInterface.h"
23
24 #if ENABLE(Condition1) || ENABLE(Condition2)
25
26 #include "RuntimeEnabledFeatures.h"
27 #include "SerializedScriptValue.h"
28 #include "V8Binding.h"
29 #include "V8BindingState.h"
30 #include "V8DOMWrapper.h"
31 #include "V8IsolatedContext.h"
32 #include "V8Proxy.h"
33 #include <wtf/UnusedParam.h>
34
35 namespace WebCore {
36
37 WrapperTypeInfo V8TestSerializedScriptValueInterface::info = { V8TestSerializedScriptValueInterface::GetTemplate, V8TestSerializedScriptValueInterface::derefObject, 0, 0 };
38
39 namespace TestSerializedScriptValueInterfaceInternal {
40
41 template <typename T> void V8_USE(T) { }
42
43 } // namespace TestSerializedScriptValueInterfaceInternal
44
45 static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestSerializedScriptValueInterfaceTemplate(v8::Persistent<v8::FunctionTemplate> desc)
46 {
47     desc->ReadOnlyPrototype();
48
49     v8::Local<v8::Signature> defaultSignature = configureTemplate(desc, "TestSerializedScriptValueInterface", v8::Persistent<v8::FunctionTemplate>(), V8TestSerializedScriptValueInterface::internalFieldCount,
50         0, 0,
51         0, 0);
52     UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
53     
54
55     // Custom toString template
56     desc->Set(getToStringName(), getToStringTemplate());
57     return desc;
58 }
59
60 v8::Persistent<v8::FunctionTemplate> V8TestSerializedScriptValueInterface::GetRawTemplate()
61 {
62     V8BindingPerIsolateData* data = V8BindingPerIsolateData::current();
63     V8BindingPerIsolateData::TemplateMap::iterator result = data->rawTemplateMap().find(&info);
64     if (result != data->rawTemplateMap().end())
65         return result->second;
66
67     v8::HandleScope handleScope;
68     v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate();
69     data->rawTemplateMap().add(&info, templ);
70     return templ;
71 }
72
73 v8::Persistent<v8::FunctionTemplate> V8TestSerializedScriptValueInterface::GetTemplate()
74 {
75     V8BindingPerIsolateData* data = V8BindingPerIsolateData::current();
76     V8BindingPerIsolateData::TemplateMap::iterator result = data->templateMap().find(&info);
77     if (result != data->templateMap().end())
78         return result->second;
79
80     v8::HandleScope handleScope;
81     v8::Persistent<v8::FunctionTemplate> templ =
82         ConfigureV8TestSerializedScriptValueInterfaceTemplate(GetRawTemplate());
83     data->templateMap().add(&info, templ);
84     return templ;
85 }
86
87 bool V8TestSerializedScriptValueInterface::HasInstance(v8::Handle<v8::Value> value)
88 {
89     return GetRawTemplate()->HasInstance(value);
90 }
91
92
93 v8::Handle<v8::Object> V8TestSerializedScriptValueInterface::wrapSlow(TestSerializedScriptValueInterface* impl)
94 {
95     v8::Handle<v8::Object> wrapper;
96     V8Proxy* proxy = 0;
97     wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl);
98     if (wrapper.IsEmpty())
99         return wrapper;
100
101     impl->ref();
102     SerializedScriptValue::deserializeAndSetProperty(wrapper, "value", static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly), impl->value());
103     v8::Persistent<v8::Object> wrapperHandle = v8::Persistent<v8::Object>::New(wrapper);
104
105     if (!hasDependentLifetime)
106         wrapperHandle.MarkIndependent();
107     getDOMObjectMap().set(impl, wrapperHandle);
108     return wrapper;
109 }
110
111 void V8TestSerializedScriptValueInterface::derefObject(void* object)
112 {
113     static_cast<TestSerializedScriptValueInterface*>(object)->deref();
114 }
115
116 } // namespace WebCore
117
118 #endif // ENABLE(Condition1) || ENABLE(Condition2)