OLD | NEW |
| (Empty) |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! | |
6 | |
7 #include "config.h" | |
8 #include "V8TestSpecialOperationsInt.h" | |
9 | |
10 #include "RuntimeEnabledFeatures.h" | |
11 #include "bindings/v8/ExceptionState.h" | |
12 #include "bindings/v8/V8DOMConfiguration.h" | |
13 #include "bindings/v8/V8HiddenValue.h" | |
14 #include "bindings/v8/V8ObjectConstructor.h" | |
15 #include "core/dom/ContextFeatures.h" | |
16 #include "core/dom/Document.h" | |
17 #include "platform/TraceEvent.h" | |
18 #include "wtf/GetPtr.h" | |
19 #include "wtf/RefPtr.h" | |
20 | |
21 namespace WebCore { | |
22 | |
23 static void initializeScriptWrappableForInterface(TestSpecialOperationsInt* obje
ct) | |
24 { | |
25 if (ScriptWrappable::wrapperCanBeStoredInObject(object)) | |
26 ScriptWrappable::setTypeInfoInObject(object, &V8TestSpecialOperationsInt
::wrapperTypeInfo); | |
27 else | |
28 ASSERT_NOT_REACHED(); | |
29 } | |
30 | |
31 } // namespace WebCore | |
32 | |
33 void webCoreInitializeScriptWrappableForInterface(WebCore::TestSpecialOperations
Int* object) | |
34 { | |
35 WebCore::initializeScriptWrappableForInterface(object); | |
36 } | |
37 | |
38 namespace WebCore { | |
39 const WrapperTypeInfo V8TestSpecialOperationsInt::wrapperTypeInfo = { gin::kEmbe
dderBlink, V8TestSpecialOperationsInt::domTemplate, V8TestSpecialOperationsInt::
derefObject, 0, 0, 0, V8TestSpecialOperationsInt::installPerContextEnabledMethod
s, 0, WrapperTypeObjectPrototype, false }; | |
40 | |
41 namespace TestSpecialOperationsIntV8Internal { | |
42 | |
43 template <typename T> void V8_USE(T) { } | |
44 | |
45 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo
<v8::Value>& info) | |
46 { | |
47 TestSpecialOperationsInt* impl = V8TestSpecialOperationsInt::toNative(info.H
older()); | |
48 int result = impl->anonymousIndexedGetter(index); | |
49 if () | |
50 return; | |
51 v8SetReturnValueInt(info, result); | |
52 } | |
53 | |
54 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCall
backInfo<v8::Value>& info) | |
55 { | |
56 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); | |
57 TestSpecialOperationsIntV8Internal::indexedPropertyGetter(index, info); | |
58 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
59 } | |
60 | |
61 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value,
const v8::PropertyCallbackInfo<v8::Value>& info) | |
62 { | |
63 TestSpecialOperationsInt* impl = V8TestSpecialOperationsInt::toNative(info.H
older()); | |
64 V8TRYCATCH_EXCEPTION_VOID(unsigned, propertyValue, toUInt32(v8Value, excepti
onState), exceptionState); | |
65 ExceptionState exceptionState(ExceptionState::IndexedSetterContext, "TestSpe
cialOperationsInt", info.Holder(), info.GetIsolate()); | |
66 bool result = impl->anonymousIndexedSetter(index, propertyValue); | |
67 if (!result) | |
68 return; | |
69 v8SetReturnValue(info, v8Value); | |
70 } | |
71 | |
72 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v
8Value, const v8::PropertyCallbackInfo<v8::Value>& info) | |
73 { | |
74 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty"); | |
75 TestSpecialOperationsIntV8Internal::indexedPropertySetter(index, v8Value, in
fo); | |
76 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
77 } | |
78 | |
79 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa
llbackInfo<v8::Value>& info) | |
80 { | |
81 if (info.Holder()->HasRealNamedProperty(name)) | |
82 return; | |
83 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) | |
84 return; | |
85 | |
86 TestSpecialOperationsInt* impl = V8TestSpecialOperationsInt::toNative(info.H
older()); | |
87 AtomicString propertyName = toCoreAtomicString(name); | |
88 int result = impl->anonymousNamedGetter(propertyName); | |
89 if () | |
90 return; | |
91 v8SetReturnValueInt(info, result); | |
92 } | |
93 | |
94 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr
opertyCallbackInfo<v8::Value>& info) | |
95 { | |
96 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | |
97 TestSpecialOperationsIntV8Internal::namedPropertyGetter(name, info); | |
98 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
99 } | |
100 | |
101 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value>
v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) | |
102 { | |
103 if (info.Holder()->HasRealNamedProperty(name)) | |
104 return; | |
105 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty()) | |
106 return; | |
107 | |
108 TestSpecialOperationsInt* impl = V8TestSpecialOperationsInt::toNative(info.H
older()); | |
109 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name)
; | |
110 V8TRYCATCH_EXCEPTION_VOID(unsigned, propertyValue, toUInt32(v8Value, excepti
onState), exceptionState); | |
111 v8::String::Utf8Value namedProperty(name); | |
112 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty,
"TestSpecialOperationsInt", info.Holder(), info.GetIsolate()); | |
113 bool result = impl->anonymousNamedSetter(propertyName, propertyValue); | |
114 if (!result) | |
115 return; | |
116 v8SetReturnValue(info, v8Value); | |
117 } | |
118 | |
119 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8
::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info) | |
120 { | |
121 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | |
122 TestSpecialOperationsIntV8Internal::namedPropertySetter(name, v8Value, info)
; | |
123 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
124 } | |
125 | |
126 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal
lbackInfo<v8::Integer>& info) | |
127 { | |
128 TestSpecialOperationsInt* impl = V8TestSpecialOperationsInt::toNative(info.H
older()); | |
129 AtomicString propertyName = toCoreAtomicString(name); | |
130 v8::String::Utf8Value namedProperty(name); | |
131 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty,
"TestSpecialOperationsInt", info.Holder(), info.GetIsolate()); | |
132 bool result = impl->namedPropertyQuery(propertyName, exceptionState); | |
133 if (exceptionState.throwIfNeeded()) | |
134 return; | |
135 if (!result) | |
136 return; | |
137 v8SetReturnValueInt(info, v8::None); | |
138 } | |
139 | |
140 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro
pertyCallbackInfo<v8::Integer>& info) | |
141 { | |
142 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | |
143 TestSpecialOperationsIntV8Internal::namedPropertyQuery(name, info); | |
144 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
145 } | |
146 | |
147 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i
nfo) | |
148 { | |
149 TestSpecialOperationsInt* impl = V8TestSpecialOperationsInt::toNative(info.H
older()); | |
150 v8::Isolate* isolate = info.GetIsolate(); | |
151 Vector<String> names; | |
152 ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestSpeci
alOperationsInt", info.Holder(), isolate); | |
153 impl->namedPropertyEnumerator(names, exceptionState); | |
154 if (exceptionState.throwIfNeeded()) | |
155 return; | |
156 v8::Handle<v8::Array> v8names = v8::Array::New(isolate, names.size()); | |
157 for (size_t i = 0; i < names.size(); ++i) | |
158 v8names->Set(v8::Integer::New(isolate, i), v8String(isolate, names[i])); | |
159 v8SetReturnValue(info, v8names); | |
160 } | |
161 | |
162 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A
rray>& info) | |
163 { | |
164 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty"); | |
165 TestSpecialOperationsIntV8Internal::namedPropertyEnumerator(info); | |
166 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | |
167 } | |
168 | |
169 } // namespace TestSpecialOperationsIntV8Internal | |
170 | |
171 static void configureV8TestSpecialOperationsIntTemplate(v8::Handle<v8::FunctionT
emplate> functionTemplate, v8::Isolate* isolate) | |
172 { | |
173 functionTemplate->ReadOnlyPrototype(); | |
174 | |
175 v8::Local<v8::Signature> defaultSignature; | |
176 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestSpecialOperationsInt", v8::Local<v8::FunctionTemplate>(), V8TestSpecia
lOperationsInt::internalFieldCount, | |
177 0, 0, | |
178 0, 0, | |
179 0, 0, | |
180 isolate); | |
181 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | |
182 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | |
183 functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestSpecialO
perationsIntV8Internal::indexedPropertyGetterCallback, TestSpecialOperationsIntV
8Internal::indexedPropertySetterCallback, 0, 0, indexedPropertyEnumerator<TestSp
ecialOperationsInt>); | |
184 functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestSpecialOpe
rationsIntV8Internal::namedPropertyGetterCallback, TestSpecialOperationsIntV8Int
ernal::namedPropertySetterCallback, TestSpecialOperationsIntV8Internal::namedPro
pertyQueryCallback, 0, TestSpecialOperationsIntV8Internal::namedPropertyEnumerat
orCallback); | |
185 | |
186 // Custom toString template | |
187 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | |
188 } | |
189 | |
190 v8::Handle<v8::FunctionTemplate> V8TestSpecialOperationsInt::domTemplate(v8::Iso
late* isolate) | |
191 { | |
192 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | |
193 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(const_cas
t<WrapperTypeInfo*>(&wrapperTypeInfo)); | |
194 if (!result.IsEmpty()) | |
195 return result; | |
196 | |
197 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | |
198 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons
tructorMode); | |
199 configureV8TestSpecialOperationsIntTemplate(result, isolate); | |
200 data->setDOMTemplate(const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), result)
; | |
201 return result; | |
202 } | |
203 | |
204 bool V8TestSpecialOperationsInt::hasInstance(v8::Handle<v8::Value> v8Value, v8::
Isolate* isolate) | |
205 { | |
206 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu
e); | |
207 } | |
208 | |
209 v8::Handle<v8::Object> V8TestSpecialOperationsInt::findInstanceInPrototypeChain(
v8::Handle<v8::Value> v8Value, v8::Isolate* isolate) | |
210 { | |
211 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe
rTypeInfo, v8Value); | |
212 } | |
213 | |
214 TestSpecialOperationsInt* V8TestSpecialOperationsInt::toNativeWithTypeCheck(v8::
Isolate* isolate, v8::Handle<v8::Value> value) | |
215 { | |
216 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje
ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) :
0; | |
217 } | |
218 | |
219 v8::Handle<v8::Object> V8TestSpecialOperationsInt::createWrapper(PassRefPtr<Test
SpecialOperationsInt> impl, v8::Handle<v8::Object> creationContext, v8::Isolate*
isolate) | |
220 { | |
221 ASSERT(impl); | |
222 ASSERT(!DOMDataStore::containsWrapper<V8TestSpecialOperationsInt>(impl.get()
, isolate)); | |
223 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) { | |
224 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje
ct(impl.get()); | |
225 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper
TypeInfo. These will both have | |
226 // the same object de-ref functions, though, so use that as the basis of
the check. | |
227 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction
== wrapperTypeInfo.derefObjectFunction); | |
228 } | |
229 | |
230 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext
, &wrapperTypeInfo, toInternalPointer(impl.get()), isolate); | |
231 if (UNLIKELY(wrapper.IsEmpty())) | |
232 return wrapper; | |
233 | |
234 installPerContextEnabledProperties(wrapper, impl.get(), isolate); | |
235 V8DOMWrapper::associateObjectWithWrapper<V8TestSpecialOperationsInt>(impl, &
wrapperTypeInfo, wrapper, isolate, WrapperConfiguration::Independent); | |
236 return wrapper; | |
237 } | |
238 | |
239 void V8TestSpecialOperationsInt::derefObject(void* object) | |
240 { | |
241 fromInternalPointer(object)->deref(); | |
242 } | |
243 | |
244 template<> | |
245 v8::Handle<v8::Value> toV8NoInline(TestSpecialOperationsInt* impl, v8::Handle<v8
::Object> creationContext, v8::Isolate* isolate) | |
246 { | |
247 return toV8(impl, creationContext, isolate); | |
248 } | |
249 | |
250 } // namespace WebCore | |
OLD | NEW |