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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 { | 249 { |
250 const DOMWrapperWorld& world = DOMWrapperWorld::current(isolate); | 250 const DOMWrapperWorld& world = DOMWrapperWorld::current(isolate); |
251 installMethodInternal(isolate, prototypeTemplate, signature, attribute, call
back, world); | 251 installMethodInternal(isolate, prototypeTemplate, signature, attribute, call
back, world); |
252 } | 252 } |
253 | 253 |
254 v8::Local<v8::Signature> V8DOMConfiguration::installDOMClassTemplate(v8::Isolate
* isolate, v8::Local<v8::FunctionTemplate> functionDescriptor, const char* inter
faceName, v8::Local<v8::FunctionTemplate> parentClass, size_t fieldCount, | 254 v8::Local<v8::Signature> V8DOMConfiguration::installDOMClassTemplate(v8::Isolate
* isolate, v8::Local<v8::FunctionTemplate> functionDescriptor, const char* inter
faceName, v8::Local<v8::FunctionTemplate> parentClass, size_t fieldCount, |
255 const AttributeConfiguration* attributes, size_t attributeCount, | 255 const AttributeConfiguration* attributes, size_t attributeCount, |
256 const AccessorConfiguration* accessors, size_t accessorCount, | 256 const AccessorConfiguration* accessors, size_t accessorCount, |
257 const MethodConfiguration* callbacks, size_t callbackCount) | 257 const MethodConfiguration* callbacks, size_t callbackCount) |
258 { | 258 { |
| 259 // This defines the constructor function's "name" property. |
259 functionDescriptor->SetClassName(v8AtomicString(isolate, interfaceName)); | 260 functionDescriptor->SetClassName(v8AtomicString(isolate, interfaceName)); |
260 v8::Local<v8::ObjectTemplate> instanceTemplate = functionDescriptor->Instanc
eTemplate(); | 261 v8::Local<v8::ObjectTemplate> instanceTemplate = functionDescriptor->Instanc
eTemplate(); |
261 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionDescriptor->Protot
ypeTemplate(); | 262 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionDescriptor->Protot
ypeTemplate(); |
262 instanceTemplate->SetInternalFieldCount(fieldCount); | 263 instanceTemplate->SetInternalFieldCount(fieldCount); |
263 if (!parentClass.IsEmpty()) { | 264 if (!parentClass.IsEmpty()) { |
264 functionDescriptor->Inherit(parentClass); | 265 functionDescriptor->Inherit(parentClass); |
265 // Marks the prototype object as one of native-backed objects. | 266 // Marks the prototype object as one of native-backed objects. |
266 // This is needed since bug 110436 asks WebKit to tell native-initiated
prototypes from pure-JS ones. | 267 // This is needed since bug 110436 asks WebKit to tell native-initiated
prototypes from pure-JS ones. |
267 // This doesn't mark kinds "root" classes like Node, where setting this
changes prototype chain structure. | 268 // This doesn't mark kinds "root" classes like Node, where setting this
changes prototype chain structure. |
268 prototypeTemplate->SetInternalFieldCount(v8PrototypeInternalFieldcount); | 269 prototypeTemplate->SetInternalFieldCount(v8PrototypeInternalFieldcount); |
(...skipping 17 matching lines...) Expand all Loading... |
286 return result; | 287 return result; |
287 | 288 |
288 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "BuildDOMTemplate"); | 289 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "BuildDOMTemplate"); |
289 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons
tructorMode); | 290 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons
tructorMode); |
290 configureDOMClassTemplate(result, isolate); | 291 configureDOMClassTemplate(result, isolate); |
291 data->setDOMTemplate(wrapperTypeInfo, result); | 292 data->setDOMTemplate(wrapperTypeInfo, result); |
292 return result; | 293 return result; |
293 } | 294 } |
294 | 295 |
295 } // namespace blink | 296 } // namespace blink |
OLD | NEW |