OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 { | 237 { |
238 const DOMWrapperWorld& world = DOMWrapperWorld::current(isolate); | 238 const DOMWrapperWorld& world = DOMWrapperWorld::current(isolate); |
239 installMethodInternal(isolate, prototypeTemplate, signature, attribute, call
back, world); | 239 installMethodInternal(isolate, prototypeTemplate, signature, attribute, call
back, world); |
240 } | 240 } |
241 | 241 |
242 v8::Local<v8::Signature> V8DOMConfiguration::installDOMClassTemplate(v8::Isolate
* isolate, v8::Local<v8::FunctionTemplate> functionDescriptor, const char* inter
faceName, v8::Handle<v8::FunctionTemplate> parentClass, size_t fieldCount, | 242 v8::Local<v8::Signature> V8DOMConfiguration::installDOMClassTemplate(v8::Isolate
* isolate, v8::Local<v8::FunctionTemplate> functionDescriptor, const char* inter
faceName, v8::Handle<v8::FunctionTemplate> parentClass, size_t fieldCount, |
243 const AttributeConfiguration* attributes, size_t attributeCount, | 243 const AttributeConfiguration* attributes, size_t attributeCount, |
244 const AccessorConfiguration* accessors, size_t accessorCount, | 244 const AccessorConfiguration* accessors, size_t accessorCount, |
245 const MethodConfiguration* callbacks, size_t callbackCount) | 245 const MethodConfiguration* callbacks, size_t callbackCount) |
246 { | 246 { |
| 247 // This defines the constructor function's "name" property. |
247 functionDescriptor->SetClassName(v8AtomicString(isolate, interfaceName)); | 248 functionDescriptor->SetClassName(v8AtomicString(isolate, interfaceName)); |
248 v8::Local<v8::ObjectTemplate> instanceTemplate = functionDescriptor->Instanc
eTemplate(); | 249 v8::Local<v8::ObjectTemplate> instanceTemplate = functionDescriptor->Instanc
eTemplate(); |
249 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionDescriptor->Protot
ypeTemplate(); | 250 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionDescriptor->Protot
ypeTemplate(); |
250 instanceTemplate->SetInternalFieldCount(fieldCount); | 251 instanceTemplate->SetInternalFieldCount(fieldCount); |
251 if (!parentClass.IsEmpty()) { | 252 if (!parentClass.IsEmpty()) { |
252 functionDescriptor->Inherit(parentClass); | 253 functionDescriptor->Inherit(parentClass); |
253 // Marks the prototype object as one of native-backed objects. | 254 // Marks the prototype object as one of native-backed objects. |
254 // This is needed since bug 110436 asks WebKit to tell native-initiated
prototypes from pure-JS ones. | 255 // This is needed since bug 110436 asks WebKit to tell native-initiated
prototypes from pure-JS ones. |
255 // This doesn't mark kinds "root" classes like Node, where setting this
changes prototype chain structure. | 256 // This doesn't mark kinds "root" classes like Node, where setting this
changes prototype chain structure. |
256 prototypeTemplate->SetInternalFieldCount(v8PrototypeInternalFieldcount); | 257 prototypeTemplate->SetInternalFieldCount(v8PrototypeInternalFieldcount); |
(...skipping 17 matching lines...) Expand all Loading... |
274 return result; | 275 return result; |
275 | 276 |
276 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "BuildDOMTemplate"); | 277 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "BuildDOMTemplate"); |
277 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons
tructorMode); | 278 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons
tructorMode); |
278 configureDOMClassTemplate(result, isolate); | 279 configureDOMClassTemplate(result, isolate); |
279 data->setDOMTemplate(wrapperTypeInfo, result); | 280 data->setDOMTemplate(wrapperTypeInfo, result); |
280 return result; | 281 return result; |
281 } | 282 } |
282 | 283 |
283 } // namespace blink | 284 } // namespace blink |
OLD | NEW |