OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 } | 361 } |
362 | 362 |
363 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { | 363 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { |
364 v8SetReturnValue(info, info.Holder()); | 364 v8SetReturnValue(info, info.Holder()); |
365 return; | 365 return; |
366 } | 366 } |
367 | 367 |
368 TestInterfaceEventConstructorV8Internal::constructor(info); | 368 TestInterfaceEventConstructorV8Internal::constructor(info); |
369 } | 369 } |
370 | 370 |
371 static void configureV8TestInterfaceEventConstructorTemplate(v8::Handle<v8::Func
tionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWo
rldType) | 371 static void configureV8TestInterfaceEventConstructorTemplate(v8::Handle<v8::Func
tionTemplate> functionTemplate, v8::Isolate* isolate) |
372 { | 372 { |
373 functionTemplate->ReadOnlyPrototype(); | 373 functionTemplate->ReadOnlyPrototype(); |
374 | 374 |
375 v8::Local<v8::Signature> defaultSignature; | 375 v8::Local<v8::Signature> defaultSignature; |
376 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceEventConstructor", V8Event::domTemplate(isolate, currentWorld
Type), V8TestInterfaceEventConstructor::internalFieldCount, | 376 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceEventConstructor", V8Event::domTemplate(isolate), V8TestInter
faceEventConstructor::internalFieldCount, |
377 V8TestInterfaceEventConstructorAttributes, WTF_ARRAY_LENGTH(V8TestInterf
aceEventConstructorAttributes), | 377 V8TestInterfaceEventConstructorAttributes, WTF_ARRAY_LENGTH(V8TestInterf
aceEventConstructorAttributes), |
378 0, 0, | 378 0, 0, |
379 0, 0, | 379 0, 0, |
380 isolate, currentWorldType); | 380 isolate); |
381 functionTemplate->SetCallHandler(V8TestInterfaceEventConstructor::constructo
rCallback); | 381 functionTemplate->SetCallHandler(V8TestInterfaceEventConstructor::constructo
rCallback); |
382 functionTemplate->SetLength(1); | 382 functionTemplate->SetLength(1); |
383 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | 383 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
384 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | 384 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
385 | 385 |
386 // Custom toString template | 386 // Custom toString template |
387 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | 387 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); |
388 } | 388 } |
389 | 389 |
390 v8::Handle<v8::FunctionTemplate> V8TestInterfaceEventConstructor::domTemplate(v8
::Isolate* isolate, WrapperWorldType currentWorldType) | 390 v8::Handle<v8::FunctionTemplate> V8TestInterfaceEventConstructor::domTemplate(v8
::Isolate* isolate) |
391 { | 391 { |
392 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 392 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
393 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 393 V8PerIsolateData::TemplateMap::iterator result = data->templateMap().find(&w
rapperTypeInfo); |
394 if (result != data->templateMap(currentWorldType).end()) | 394 if (result != data->templateMap().end()) |
395 return result->value.newLocal(isolate); | 395 return result->value.newLocal(isolate); |
396 | 396 |
397 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 397 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
398 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); | 398 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
399 configureV8TestInterfaceEventConstructorTemplate(templ, isolate, currentWorl
dType); | 399 configureV8TestInterfaceEventConstructorTemplate(templ, isolate); |
400 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 400 data->templateMap().add(&wrapperTypeInfo, UnsafePersistent<v8::FunctionTempl
ate>(isolate, templ)); |
401 return templ; | 401 return templ; |
402 } | 402 } |
403 | 403 |
404 bool V8TestInterfaceEventConstructor::hasInstance(v8::Handle<v8::Value> jsValue,
v8::Isolate* isolate) | 404 bool V8TestInterfaceEventConstructor::hasInstance(v8::Handle<v8::Value> jsValue,
v8::Isolate* isolate) |
405 { | 405 { |
406 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); | 406 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); |
407 } | 407 } |
408 | 408 |
409 v8::Handle<v8::Object> V8TestInterfaceEventConstructor::findInstanceInPrototypeC
hain(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate) | 409 v8::Handle<v8::Object> V8TestInterfaceEventConstructor::findInstanceInPrototypeC
hain(v8::Handle<v8::Value> jsValue, v8::Isolate* isolate) |
410 { | 410 { |
(...skipping 30 matching lines...) Expand all Loading... |
441 fromInternalPointer(object)->deref(); | 441 fromInternalPointer(object)->deref(); |
442 } | 442 } |
443 | 443 |
444 template<> | 444 template<> |
445 v8::Handle<v8::Value> toV8NoInline(TestInterfaceEventConstructor* impl, v8::Hand
le<v8::Object> creationContext, v8::Isolate* isolate) | 445 v8::Handle<v8::Value> toV8NoInline(TestInterfaceEventConstructor* impl, v8::Hand
le<v8::Object> creationContext, v8::Isolate* isolate) |
446 { | 446 { |
447 return toV8(impl, creationContext, isolate); | 447 return toV8(impl, creationContext, isolate); |
448 } | 448 } |
449 | 449 |
450 } // namespace WebCore | 450 } // namespace WebCore |
OLD | NEW |