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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); | 270 TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); |
271 } | 271 } |
272 | 272 |
273 } // namespace TestEventTargetV8Internal | 273 } // namespace TestEventTargetV8Internal |
274 | 274 |
275 static const V8DOMConfiguration::MethodConfiguration V8TestEventTargetMethods[]
= { | 275 static const V8DOMConfiguration::MethodConfiguration V8TestEventTargetMethods[]
= { |
276 {"item", TestEventTargetV8Internal::itemMethodCallback, 0, 1}, | 276 {"item", TestEventTargetV8Internal::itemMethodCallback, 0, 1}, |
277 {"namedItem", TestEventTargetV8Internal::namedItemMethodCallback, 0, 1}, | 277 {"namedItem", TestEventTargetV8Internal::namedItemMethodCallback, 0, 1}, |
278 }; | 278 }; |
279 | 279 |
280 static void configureV8TestEventTargetTemplate(v8::Handle<v8::FunctionTemplate>
functionTemplate, v8::Isolate* isolate, WrapperWorldType currentWorldType) | 280 static void configureV8TestEventTargetTemplate(v8::Handle<v8::FunctionTemplate>
functionTemplate, v8::Isolate* isolate) |
281 { | 281 { |
282 functionTemplate->ReadOnlyPrototype(); | 282 functionTemplate->ReadOnlyPrototype(); |
283 | 283 |
284 v8::Local<v8::Signature> defaultSignature; | 284 v8::Local<v8::Signature> defaultSignature; |
285 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestEventTarget", V8EventTarget::domTemplate(isolate, currentWorldType), V
8TestEventTarget::internalFieldCount, | 285 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl
ate, "TestEventTarget", V8EventTarget::domTemplate(isolate), V8TestEventTarget::
internalFieldCount, |
286 0, 0, | 286 0, 0, |
287 0, 0, | 287 0, 0, |
288 V8TestEventTargetMethods, WTF_ARRAY_LENGTH(V8TestEventTargetMethods), | 288 V8TestEventTargetMethods, WTF_ARRAY_LENGTH(V8TestEventTargetMethods), |
289 isolate, currentWorldType); | 289 isolate); |
290 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); | 290 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED instanceTemplate = functionTempla
te->InstanceTemplate(); |
291 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); | 291 v8::Local<v8::ObjectTemplate> ALLOW_UNUSED prototypeTemplate = functionTempl
ate->PrototypeTemplate(); |
292 functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestEventTar
getV8Internal::indexedPropertyGetterCallback, TestEventTargetV8Internal::indexed
PropertySetterCallback, 0, TestEventTargetV8Internal::indexedPropertyDeleterCall
back, indexedPropertyEnumerator<TestEventTarget>); | 292 functionTemplate->InstanceTemplate()->SetIndexedPropertyHandler(TestEventTar
getV8Internal::indexedPropertyGetterCallback, TestEventTargetV8Internal::indexed
PropertySetterCallback, 0, TestEventTargetV8Internal::indexedPropertyDeleterCall
back, indexedPropertyEnumerator<TestEventTarget>); |
293 functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestEventTarge
tV8Internal::namedPropertyGetterCallback, TestEventTargetV8Internal::namedProper
tySetterCallback, TestEventTargetV8Internal::namedPropertyQueryCallback, TestEve
ntTargetV8Internal::namedPropertyDeleterCallback, TestEventTargetV8Internal::nam
edPropertyEnumeratorCallback); | 293 functionTemplate->InstanceTemplate()->SetNamedPropertyHandler(TestEventTarge
tV8Internal::namedPropertyGetterCallback, TestEventTargetV8Internal::namedProper
tySetterCallback, TestEventTargetV8Internal::namedPropertyQueryCallback, TestEve
ntTargetV8Internal::namedPropertyDeleterCallback, TestEventTargetV8Internal::nam
edPropertyEnumeratorCallback); |
294 | 294 |
295 // Custom toString template | 295 // Custom toString template |
296 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); | 296 functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData:
:current()->toStringTemplate()); |
297 } | 297 } |
298 | 298 |
299 v8::Handle<v8::FunctionTemplate> V8TestEventTarget::domTemplate(v8::Isolate* iso
late, WrapperWorldType currentWorldType) | 299 v8::Handle<v8::FunctionTemplate> V8TestEventTarget::domTemplate(v8::Isolate* iso
late) |
300 { | 300 { |
301 V8PerIsolateData* data = V8PerIsolateData::from(isolate); | 301 V8PerIsolateData* data = V8PerIsolateData::from(isolate); |
302 V8PerIsolateData::TemplateMap::iterator result = data->templateMap(currentWo
rldType).find(&wrapperTypeInfo); | 302 V8PerIsolateData::TemplateMap::iterator result = data->templateMap().find(&w
rapperTypeInfo); |
303 if (result != data->templateMap(currentWorldType).end()) | 303 if (result != data->templateMap().end()) |
304 return result->value.newLocal(isolate); | 304 return result->value.newLocal(isolate); |
305 | 305 |
306 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); | 306 TRACE_EVENT_SCOPED_SAMPLING_STATE("Blink", "BuildDOMTemplate"); |
307 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); | 307 v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate, V
8ObjectConstructor::isValidConstructorMode); |
308 configureV8TestEventTargetTemplate(templ, isolate, currentWorldType); | 308 configureV8TestEventTargetTemplate(templ, isolate); |
309 data->templateMap(currentWorldType).add(&wrapperTypeInfo, UnsafePersistent<v
8::FunctionTemplate>(isolate, templ)); | 309 data->templateMap().add(&wrapperTypeInfo, UnsafePersistent<v8::FunctionTempl
ate>(isolate, templ)); |
310 return templ; | 310 return templ; |
311 } | 311 } |
312 | 312 |
313 bool V8TestEventTarget::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate*
isolate) | 313 bool V8TestEventTarget::hasInstance(v8::Handle<v8::Value> jsValue, v8::Isolate*
isolate) |
314 { | 314 { |
315 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); | 315 return V8PerIsolateData::from(isolate)->hasInstance(&wrapperTypeInfo, jsValu
e); |
316 } | 316 } |
317 | 317 |
318 v8::Handle<v8::Object> V8TestEventTarget::findInstanceInPrototypeChain(v8::Handl
e<v8::Value> jsValue, v8::Isolate* isolate) | 318 v8::Handle<v8::Object> V8TestEventTarget::findInstanceInPrototypeChain(v8::Handl
e<v8::Value> jsValue, v8::Isolate* isolate) |
319 { | 319 { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 fromInternalPointer(object)->deref(); | 355 fromInternalPointer(object)->deref(); |
356 } | 356 } |
357 | 357 |
358 template<> | 358 template<> |
359 v8::Handle<v8::Value> toV8NoInline(TestEventTarget* impl, v8::Handle<v8::Object>
creationContext, v8::Isolate* isolate) | 359 v8::Handle<v8::Value> toV8NoInline(TestEventTarget* impl, v8::Handle<v8::Object>
creationContext, v8::Isolate* isolate) |
360 { | 360 { |
361 return toV8(impl, creationContext, isolate); | 361 return toV8(impl, creationContext, isolate); |
362 } | 362 } |
363 | 363 |
364 } // namespace WebCore | 364 } // namespace WebCore |
OLD | NEW |