| 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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 } | 359 } |
| 360 | 360 |
| 361 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { | 361 if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) { |
| 362 v8SetReturnValue(info, info.Holder()); | 362 v8SetReturnValue(info, info.Holder()); |
| 363 return; | 363 return; |
| 364 } | 364 } |
| 365 | 365 |
| 366 TestInterfaceEventConstructorV8Internal::constructor(info); | 366 TestInterfaceEventConstructorV8Internal::constructor(info); |
| 367 } | 367 } |
| 368 | 368 |
| 369 static v8::Handle<v8::FunctionTemplate> ConfigureV8TestInterfaceEventConstructor
Template(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate
, WrapperWorldType currentWorldType) | 369 static void configureV8TestInterfaceEventConstructorTemplate(v8::Handle<v8::Func
tionTemplate> functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWo
rldType) |
| 370 { | 370 { |
| 371 functionTemplate->ReadOnlyPrototype(); | 371 functionTemplate->ReadOnlyPrototype(); |
| 372 | 372 |
| 373 v8::Local<v8::Signature> defaultSignature; | 373 v8::Local<v8::Signature> defaultSignature; |
| 374 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceEventConstructor", V8Event::domTemplate(isolate, currentWorld
Type), V8TestInterfaceEventConstructor::internalFieldCount, | 374 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestInterfaceEventConstructor", V8Event::domTemplate(isolate, currentWorld
Type), V8TestInterfaceEventConstructor::internalFieldCount, |
| 375 V8TestInterfaceEventConstructorAttributes, WTF_ARRAY_LENGTH(V8TestInterf
aceEventConstructorAttributes), | 375 V8TestInterfaceEventConstructorAttributes, WTF_ARRAY_LENGTH(V8TestInterf
aceEventConstructorAttributes), |
| 376 0, 0, | 376 0, 0, |
| 377 0, 0, | 377 0, 0, |
| 378 isolate, currentWorldType); | 378 isolate, currentWorldType); |
| 379 functionTemplate->SetCallHandler(V8TestInterfaceEventConstructor::constructo
rCallback); | 379 functionTemplate->SetCallHandler(V8TestInterfaceEventConstructor::constructo
rCallback); |
| 380 functionTemplate->SetLength(1); | 380 functionTemplate->SetLength(1); |
| 381 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | 381 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
| 382 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | 382 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
| 383 | 383 |
| 384 // Custom toString template | 384 // Custom toString template |
| 385 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); | 385 functionTemplate->Set(v8::String::NewFromUtf8(isolate, "toString", v8::Strin
g::kInternalizedString), V8PerIsolateData::current()->toStringTemplate()); |
| 386 return functionTemplate; | |
| 387 } | 386 } |
| 388 | 387 |
| 389 v8::Handle<v8::FunctionTemplate> V8TestInterfaceEventConstructor::domTemplate(v8
::Isolate* isolate, WrapperWorldType currentWorldType) | 388 v8::Handle<v8::FunctionTemplate> V8TestInterfaceEventConstructor::domTemplate(v8
::Isolate* isolate, WrapperWorldType currentWorldType) |
| 390 { | 389 { |
| 391 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 390 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
| 392 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 391 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); |
| 393 if (result != data->templateMap(currentWorldType).end()) | 392 if (result != data->templateMap(currentWorldType).end()) |
| 394 return result->value.newLocal(isolate); | 393 return result->value.newLocal(isolate); |
| 395 | 394 |
| 396 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 395 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
| 397 v8::EscapableHandleScope handleScope(isolate); | 396 v8::EscapableHandleScope handleScope(isolate); |
| 398 v8::Local<v8::FunctionTemplate> templ = | 397 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
| 399 ConfigureV8TestInterfaceEventConstructorTemplate(data->rawDOMTemplate(&w
rapperTypeInfo, currentWorldType), isolate, currentWorldType); | 398 configureV8TestInterfaceEventConstructorTemplate(templ, isolate, currentWorl
dType); |
| 400 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 399 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); |
| 401 return handleScope.Escape(templ); | 400 return handleScope.Escape(templ); |
| 402 } | 401 } |
| 403 | 402 |
| 404 bool V8TestInterfaceEventConstructor::hasInstance(v8::Handle<v8::Value> jsValue,
v8::Isolate* isolate, WrapperWorldType currentWorldType) | 403 bool V8TestInterfaceEventConstructor::hasInstance(v8::Handle<v8::Value> jsValue,
v8::Isolate* isolate, WrapperWorldType currentWorldType) |
| 405 { | 404 { |
| 406 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); | 405 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e, currentWorldType); |
| 407 } | 406 } |
| 408 | 407 |
| 409 bool V8TestInterfaceEventConstructor::hasInstanceInAnyWorld(v8::Handle<v8::Value
> jsValue, v8::Isolate* isolate) | 408 bool V8TestInterfaceEventConstructor::hasInstanceInAnyWorld(v8::Handle<v8::Value
> jsValue, v8::Isolate* isolate) |
| (...skipping 28 matching lines...) Expand all Loading... |
| 438 fromInternalPointer(object)->deref(); | 437 fromInternalPointer(object)->deref(); |
| 439 } | 438 } |
| 440 | 439 |
| 441 template<> | 440 template<> |
| 442 v8::Handle<v8::Value> toV8NoInline(TestInterfaceEventConstructor* impl, v8::Hand
le<v8::Object> creationContext, v8::Isolate* isolate) | 441 v8::Handle<v8::Value> toV8NoInline(TestInterfaceEventConstructor* impl, v8::Hand
le<v8::Object> creationContext, v8::Isolate* isolate) |
| 443 { | 442 { |
| 444 return toV8(impl, creationContext, isolate); | 443 return toV8(impl, creationContext, isolate); |
| 445 } | 444 } |
| 446 | 445 |
| 447 } // namespace WebCore | 446 } // namespace WebCore |
| OLD | NEW |