Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: Source/bindings/tests/results/V8TestInterface2.cpp

Issue 217053007: Revert of Make DOMWrapperWorld::current() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Revert 213543004 too Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 "V8TestInterface2.h"
9
10 #include "RuntimeEnabledFeatures.h"
11 #include "V8Interface1.h"
12 #include "V8Interface2.h"
13 #include "V8TestInterfaceEmpty.h"
14 #include "bindings/v8/ExceptionState.h"
15 #include "bindings/v8/V8DOMConfiguration.h"
16 #include "bindings/v8/V8GCController.h"
17 #include "bindings/v8/V8HiddenValue.h"
18 #include "bindings/v8/V8ObjectConstructor.h"
19 #include "core/dom/ContextFeatures.h"
20 #include "core/dom/Document.h"
21 #include "core/dom/Element.h"
22 #include "core/frame/DOMWindow.h"
23 #include "platform/TraceEvent.h"
24 #include "wtf/GetPtr.h"
25 #include "wtf/RefPtr.h"
26
27 namespace WebCore {
28
29 static void initializeScriptWrappableForInterface(TestInterface2* object)
30 {
31 if (ScriptWrappable::wrapperCanBeStoredInObject(object))
32 ScriptWrappable::setTypeInfoInObject(object, &V8TestInterface2::wrapperT ypeInfo);
33 else
34 ASSERT_NOT_REACHED();
35 }
36
37 } // namespace WebCore
38
39 void webCoreInitializeScriptWrappableForInterface(WebCore::TestInterface2* objec t)
40 {
41 WebCore::initializeScriptWrappableForInterface(object);
42 }
43
44 namespace WebCore {
45 const WrapperTypeInfo V8TestInterface2::wrapperTypeInfo = { gin::kEmbedderBlink, V8TestInterface2::domTemplate, V8TestInterface2::derefObject, 0, 0, V8TestInter face2::visitDOMWrapper, V8TestInterface2::installPerContextEnabledMethods, 0, Wr apperTypeObjectPrototype, false };
46
47 namespace TestInterface2V8Internal {
48
49 template <typename T> void V8_USE(T) { }
50
51 static void itemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
52 {
53 ExceptionState exceptionState(ExceptionState::ExecutionContext, "item", "Tes tInterface2", info.Holder(), info.GetIsolate());
54 if (UNLIKELY(info.Length() < 1)) {
55 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
56 exceptionState.throwIfNeeded();
57 return;
58 }
59 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
60 V8TRYCATCH_EXCEPTION_VOID(unsigned, index, toUInt32(info[0], exceptionState) , exceptionState);
61 RefPtr<TestInterfaceEmpty> result = impl->item(index, exceptionState);
62 if (exceptionState.throwIfNeeded())
63 return;
64 v8SetReturnValue(info, result.release());
65 }
66
67 static void itemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
68 {
69 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
70 TestInterface2V8Internal::itemMethod(info);
71 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
72 }
73
74 static void setItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
75 {
76 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setItem", " TestInterface2", info.Holder(), info.GetIsolate());
77 if (UNLIKELY(info.Length() < 2)) {
78 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length()));
79 exceptionState.throwIfNeeded();
80 return;
81 }
82 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
83 V8TRYCATCH_EXCEPTION_VOID(unsigned, index, toUInt32(info[0], exceptionState) , exceptionState);
84 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, value, info[1]);
85 String result = impl->setItem(index, value, exceptionState);
86 if (exceptionState.throwIfNeeded())
87 return;
88 v8SetReturnValueString(info, result, info.GetIsolate());
89 }
90
91 static void setItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& inf o)
92 {
93 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
94 TestInterface2V8Internal::setItemMethod(info);
95 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
96 }
97
98 static void deleteItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
99 {
100 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteItem" , "TestInterface2", info.Holder(), info.GetIsolate());
101 if (UNLIKELY(info.Length() < 1)) {
102 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
103 exceptionState.throwIfNeeded();
104 return;
105 }
106 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
107 V8TRYCATCH_EXCEPTION_VOID(unsigned, index, toUInt32(info[0], exceptionState) , exceptionState);
108 bool result = impl->deleteItem(index, exceptionState);
109 if (exceptionState.throwIfNeeded())
110 return;
111 v8SetReturnValueBool(info, result);
112 }
113
114 static void deleteItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
115 {
116 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
117 TestInterface2V8Internal::deleteItemMethod(info);
118 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
119 }
120
121 static void namedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
122 {
123 ExceptionState exceptionState(ExceptionState::ExecutionContext, "namedItem", "TestInterface2", info.Holder(), info.GetIsolate());
124 if (UNLIKELY(info.Length() < 1)) {
125 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
126 exceptionState.throwIfNeeded();
127 return;
128 }
129 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
130 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]);
131 RefPtr<TestInterfaceEmpty> result = impl->namedItem(name, exceptionState);
132 if (exceptionState.throwIfNeeded())
133 return;
134 v8SetReturnValue(info, result.release());
135 }
136
137 static void namedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& i nfo)
138 {
139 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
140 TestInterface2V8Internal::namedItemMethod(info);
141 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
142 }
143
144 static void setNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
145 {
146 ExceptionState exceptionState(ExceptionState::ExecutionContext, "setNamedIte m", "TestInterface2", info.Holder(), info.GetIsolate());
147 if (UNLIKELY(info.Length() < 2)) {
148 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length()));
149 exceptionState.throwIfNeeded();
150 return;
151 }
152 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
153 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]);
154 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, value, info[1]);
155 String result = impl->setNamedItem(name, value, exceptionState);
156 if (exceptionState.throwIfNeeded())
157 return;
158 v8SetReturnValueString(info, result, info.GetIsolate());
159 }
160
161 static void setNamedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Value> & info)
162 {
163 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
164 TestInterface2V8Internal::setNamedItemMethod(info);
165 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
166 }
167
168 static void deleteNamedItemMethod(const v8::FunctionCallbackInfo<v8::Value>& inf o)
169 {
170 ExceptionState exceptionState(ExceptionState::ExecutionContext, "deleteNamed Item", "TestInterface2", info.Holder(), info.GetIsolate());
171 if (UNLIKELY(info.Length() < 1)) {
172 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
173 exceptionState.throwIfNeeded();
174 return;
175 }
176 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
177 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, name, info[0]);
178 bool result = impl->deleteNamedItem(name, exceptionState);
179 if (exceptionState.throwIfNeeded())
180 return;
181 v8SetReturnValueBool(info, result);
182 }
183
184 static void deleteNamedItemMethodCallback(const v8::FunctionCallbackInfo<v8::Val ue>& info)
185 {
186 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
187 TestInterface2V8Internal::deleteNamedItemMethod(info);
188 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
189 }
190
191 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
192 {
193 v8::Isolate* isolate = info.GetIsolate();
194 RefPtr<TestInterface2> impl = TestInterface2::create();
195
196 v8::Handle<v8::Object> wrapper = wrap(impl.get(), info.Holder(), isolate);
197 v8SetReturnValue(info, wrapper);
198 }
199
200 static void indexedPropertyGetter(uint32_t index, const v8::PropertyCallbackInfo <v8::Value>& info)
201 {
202 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
203 ExceptionState exceptionState(ExceptionState::IndexedGetterContext, "TestInt erface2", info.Holder(), info.GetIsolate());
204 RefPtr<TestInterfaceEmpty> result = impl->item(index, exceptionState);
205 if (exceptionState.throwIfNeeded())
206 return;
207 if (!result)
208 return;
209 v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl);
210 }
211
212 static void indexedPropertyGetterCallback(uint32_t index, const v8::PropertyCall backInfo<v8::Value>& info)
213 {
214 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty");
215 TestInterface2V8Internal::indexedPropertyGetter(index, info);
216 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
217 }
218
219 static void indexedPropertySetter(uint32_t index, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
220 {
221 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
222 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyValue, v8Va lue);
223 ExceptionState exceptionState(ExceptionState::IndexedSetterContext, "TestInt erface2", info.Holder(), info.GetIsolate());
224 bool result = impl->setItem(index, propertyValue, exceptionState);
225 if (exceptionState.throwIfNeeded())
226 return;
227 if (!result)
228 return;
229 v8SetReturnValue(info, v8Value);
230 }
231
232 static void indexedPropertySetterCallback(uint32_t index, v8::Local<v8::Value> v 8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
233 {
234 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty");
235 TestInterface2V8Internal::indexedPropertySetter(index, v8Value, info);
236 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
237 }
238
239 static void indexedPropertyDeleter(uint32_t index, const v8::PropertyCallbackInf o<v8::Boolean>& info)
240 {
241 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
242 ExceptionState exceptionState(ExceptionState::IndexedDeletionContext, "TestI nterface2", info.Holder(), info.GetIsolate());
243 DeleteResult result = impl->deleteItem(index, exceptionState);
244 if (exceptionState.throwIfNeeded())
245 return;
246 if (result != DeleteUnknownProperty)
247 return v8SetReturnValueBool(info, result == DeleteSuccess);
248 }
249
250 static void indexedPropertyDeleterCallback(uint32_t index, const v8::PropertyCal lbackInfo<v8::Boolean>& info)
251 {
252 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMIndexedProperty");
253 TestInterface2V8Internal::indexedPropertyDeleter(index, info);
254 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
255 }
256
257 static void namedPropertyGetter(v8::Local<v8::String> name, const v8::PropertyCa llbackInfo<v8::Value>& info)
258 {
259 if (info.Holder()->HasRealNamedProperty(name))
260 return;
261 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
262 return;
263
264 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
265 AtomicString propertyName = toCoreAtomicString(name);
266 v8::String::Utf8Value namedProperty(name);
267 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestInterface2", info.Holder(), info.GetIsolate());
268 RefPtr<TestInterfaceEmpty> result = impl->namedItem(propertyName, exceptionS tate);
269 if (exceptionState.throwIfNeeded())
270 return;
271 if (!result)
272 return;
273 v8SetReturnValueFast(info, WTF::getPtr(result.release()), impl);
274 }
275
276 static void namedPropertyGetterCallback(v8::Local<v8::String> name, const v8::Pr opertyCallbackInfo<v8::Value>& info)
277 {
278 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
279 TestInterface2V8Internal::namedPropertyGetter(name, info);
280 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
281 }
282
283 static void namedPropertySetter(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
284 {
285 if (info.Holder()->HasRealNamedProperty(name))
286 return;
287 if (!info.Holder()->GetRealNamedPropertyInPrototypeChain(name).IsEmpty())
288 return;
289
290 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
291 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyName, name) ;
292 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, propertyValue, v8Va lue);
293 v8::String::Utf8Value namedProperty(name);
294 ExceptionState exceptionState(ExceptionState::SetterContext, *namedProperty, "TestInterface2", info.Holder(), info.GetIsolate());
295 bool result = impl->setNamedItem(propertyName, propertyValue, exceptionState );
296 if (exceptionState.throwIfNeeded())
297 return;
298 if (!result)
299 return;
300 v8SetReturnValue(info, v8Value);
301 }
302
303 static void namedPropertySetterCallback(v8::Local<v8::String> name, v8::Local<v8 ::Value> v8Value, const v8::PropertyCallbackInfo<v8::Value>& info)
304 {
305 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
306 TestInterface2V8Internal::namedPropertySetter(name, v8Value, info);
307 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
308 }
309
310 static void namedPropertyQuery(v8::Local<v8::String> name, const v8::PropertyCal lbackInfo<v8::Integer>& info)
311 {
312 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
313 AtomicString propertyName = toCoreAtomicString(name);
314 v8::String::Utf8Value namedProperty(name);
315 ExceptionState exceptionState(ExceptionState::GetterContext, *namedProperty, "TestInterface2", info.Holder(), info.GetIsolate());
316 bool result = impl->namedPropertyQuery(propertyName, exceptionState);
317 if (exceptionState.throwIfNeeded())
318 return;
319 if (!result)
320 return;
321 v8SetReturnValueInt(info, v8::None);
322 }
323
324 static void namedPropertyQueryCallback(v8::Local<v8::String> name, const v8::Pro pertyCallbackInfo<v8::Integer>& info)
325 {
326 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
327 TestInterface2V8Internal::namedPropertyQuery(name, info);
328 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
329 }
330
331 static void namedPropertyDeleter(v8::Local<v8::String> name, const v8::PropertyC allbackInfo<v8::Boolean>& info)
332 {
333 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
334 AtomicString propertyName = toCoreAtomicString(name);
335 v8::String::Utf8Value namedProperty(name);
336 ExceptionState exceptionState(ExceptionState::DeletionContext, *namedPropert y, "TestInterface2", info.Holder(), info.GetIsolate());
337 DeleteResult result = impl->deleteNamedItem(propertyName, exceptionState);
338 if (exceptionState.throwIfNeeded())
339 return;
340 if (result != DeleteUnknownProperty)
341 return v8SetReturnValueBool(info, result == DeleteSuccess);
342 }
343
344 static void namedPropertyDeleterCallback(v8::Local<v8::String> name, const v8::P ropertyCallbackInfo<v8::Boolean>& info)
345 {
346 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
347 TestInterface2V8Internal::namedPropertyDeleter(name, info);
348 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
349 }
350
351 static void namedPropertyEnumerator(const v8::PropertyCallbackInfo<v8::Array>& i nfo)
352 {
353 TestInterface2* impl = V8TestInterface2::toNative(info.Holder());
354 v8::Isolate* isolate = info.GetIsolate();
355 Vector<String> names;
356 ExceptionState exceptionState(ExceptionState::EnumerationContext, "TestInter face2", info.Holder(), isolate);
357 impl->namedPropertyEnumerator(names, exceptionState);
358 if (exceptionState.throwIfNeeded())
359 return;
360 v8::Handle<v8::Array> v8names = v8::Array::New(isolate, names.size());
361 for (size_t i = 0; i < names.size(); ++i)
362 v8names->Set(v8::Integer::New(isolate, i), v8String(isolate, names[i]));
363 v8SetReturnValue(info, v8names);
364 }
365
366 static void namedPropertyEnumeratorCallback(const v8::PropertyCallbackInfo<v8::A rray>& info)
367 {
368 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMNamedProperty");
369 TestInterface2V8Internal::namedPropertyEnumerator(info);
370 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
371 }
372
373 } // namespace TestInterface2V8Internal
374
375 void V8TestInterface2::visitDOMWrapper(void* object, const v8::Persistent<v8::Ob ject>& wrapper, v8::Isolate* isolate)
376 {
377 TestInterface2* impl = fromInternalPointer(object);
378 // The ownerNode() method may return a reference or a pointer.
379 if (Node* owner = WTF::getPtr(impl->ownerNode())) {
380 Node* root = V8GCController::opaqueRootForGC(owner, isolate);
381 isolate->SetReferenceFromGroup(v8::UniqueId(reinterpret_cast<intptr_t>(r oot)), wrapper);
382 return;
383 }
384 setObjectGroup(object, wrapper, isolate);
385 }
386
387 static const V8DOMConfiguration::MethodConfiguration V8TestInterface2Methods[] = {
388 {"item", TestInterface2V8Internal::itemMethodCallback, 0, 1},
389 {"setItem", TestInterface2V8Internal::setItemMethodCallback, 0, 2},
390 {"deleteItem", TestInterface2V8Internal::deleteItemMethodCallback, 0, 1},
391 {"namedItem", TestInterface2V8Internal::namedItemMethodCallback, 0, 1},
392 {"setNamedItem", TestInterface2V8Internal::setNamedItemMethodCallback, 0, 2} ,
393 {"deleteNamedItem", TestInterface2V8Internal::deleteNamedItemMethodCallback, 0, 1},
394 };
395
396 void V8TestInterface2::constructorCallback(const v8::FunctionCallbackInfo<v8::Va lue>& info)
397 {
398 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "DOMConstructor");
399 if (!info.IsConstructCall()) {
400 throwTypeError(ExceptionMessages::constructorNotCallableAsFunction("Test Interface2"), info.GetIsolate());
401 return;
402 }
403
404 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) {
405 v8SetReturnValue(info, info.Holder());
406 return;
407 }
408
409 TestInterface2V8Internal::constructor(info);
410 }
411
412 static void configureV8TestInterface2Template(v8::Handle<v8::FunctionTemplate> f unctionTemplate, v8::Isolate* isolate)
413 {
414 functionTemplate->ReadOnlyPrototype();
415
416 v8::Local<v8::Signature> defaultSignature;
417 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestInterface2", v8::Local<v8::FunctionTemplate>(), V8TestInterface2::inte rnalFieldCount,
418 0, 0,
419 0, 0,
420 V8TestInterface2Methods, WTF_ARRAY_LENGTH(V8TestInterface2Methods),
421 isolate);
422 functionTemplate->SetCallHandler(V8TestInterface2::constructorCallback);
423 functionTemplate->SetLength(0);
424 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla te->InstanceTemplate();
425 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl ate->PrototypeTemplate();
426 functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestInterfac e2V8Internal::indexedPropertyGetterCallback, TestInterface2V8Internal::indexedPr opertySetterCallback, 0, TestInterface2V8Internal::indexedPropertyDeleterCallbac k, indexedPropertyEnumerator<TestInterface2>);
427 functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestInterface2 V8Internal::namedPropertyGetterCallback, TestInterface2V8Internal::namedProperty SetterCallback, TestInterface2V8Internal::namedPropertyQueryCallback, TestInterf ace2V8Internal::namedPropertyDeleterCallback, TestInterface2V8Internal::namedPro pertyEnumeratorCallback);
428
429 // Custom toString template
430 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData: :current()->toStringTemplate());
431 }
432
433 v8::Handle<v8::FunctionTemplate> V8TestInterface2::domTemplate(v8::Isolate* isol ate)
434 {
435 V8PerIsolateData* data = V8PerIsolateData::from(isolate);
436 v8::Local<v8::FunctionTemplate> result = data->existingDOMTemplate(const_cas t<WrapperTypeInfo*>(&wrapperTypeInfo));
437 if (!result.IsEmpty())
438 return result;
439
440 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate");
441 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons tructorMode);
442 configureV8TestInterface2Template(result, isolate);
443 data->setDOMTemplate(const_cast<WrapperTypeInfo*>(&wrapperTypeInfo), result) ;
444 return result;
445 }
446
447 bool V8TestInterface2::hasInstance(v8::Handle<v8::Value> v8Value, v8::Isolate* i solate)
448 {
449 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, v8Valu e);
450 }
451
452 v8::Handle<v8::Object> V8TestInterface2::findInstanceInPrototypeChain(v8::Handle <v8::Value> v8Value, v8::Isolate* isolate)
453 {
454 return V8PerIsolateData::from(isolate)->findInstanceInPrototypeChain(&wrappe rTypeInfo, v8Value);
455 }
456
457 TestInterface2* V8TestInterface2::toNativeWithTypeCheck(v8::Isolate* isolate, v8 ::Handle<v8::Value> value)
458 {
459 return hasInstance(value, isolate) ? fromInternalPointer(v8::Handle<v8::Obje ct>::Cast(value)->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)) : 0;
460 }
461
462 v8::Handle<v8::Object> wrap(TestInterface2* impl, v8::Handle<v8::Object> creatio nContext, v8::Isolate* isolate)
463 {
464 ASSERT(impl);
465 if (impl->isInterface1())
466 return wrap(toInterface1(impl), creationContext, isolate);
467 if (impl->isInterface2())
468 return wrap(toInterface2(impl), creationContext, isolate);
469 v8::Handle<v8::Object> wrapper = V8TestInterface2::createWrapper(impl, creat ionContext, isolate);
470 return wrapper;
471 }
472
473 v8::Handle<v8::Object> V8TestInterface2::createWrapper(PassRefPtr<TestInterface2 > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
474 {
475 ASSERT(impl);
476 ASSERT(!DOMDataStore::containsWrapper<V8TestInterface2>(impl.get(), isolate) );
477 if (ScriptWrappable::wrapperCanBeStoredInObject(impl.get())) {
478 const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObje ct(impl.get());
479 // Might be a XXXConstructor::wrapperTypeInfo instead of an XXX::wrapper TypeInfo. These will both have
480 // the same object de-ref functions, though, so use that as the basis of the check.
481 RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == wrapperTypeInfo.derefObjectFunction);
482 }
483
484 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext , &wrapperTypeInfo, toInternalPointer(impl.get()), isolate);
485 if (UNLIKELY(wrapper.IsEmpty()))
486 return wrapper;
487
488 installPerContextEnabledProperties(wrapper, impl.get(), isolate);
489 V8DOMWrapper::associateObjectWithWrapper<V8TestInterface2>(impl, &wrapperTyp eInfo, wrapper, isolate, WrapperConfiguration::Dependent);
490 return wrapper;
491 }
492
493 void V8TestInterface2::derefObject(void* object)
494 {
495 fromInternalPointer(object)->deref();
496 }
497
498 template<>
499 v8::Handle<v8::Value> toV8NoInline(TestInterface2* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
500 {
501 return toV8(impl, creationContext, isolate);
502 }
503
504 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestInterface2.h ('k') | Source/bindings/tests/results/V8TestInterface3.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698