| 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 { | 266 { |
| 267 const DOMWrapperWorld& world = DOMWrapperWorld::current(isolate); | 267 const DOMWrapperWorld& world = DOMWrapperWorld::current(isolate); |
| 268 installMethodInternal(isolate, v8::Local<v8::ObjectTemplate>(), prototypeTem
plate, v8::Local<v8::FunctionTemplate>(), signature, attribute, method, world); | 268 installMethodInternal(isolate, v8::Local<v8::ObjectTemplate>(), prototypeTem
plate, v8::Local<v8::FunctionTemplate>(), signature, attribute, method, world); |
| 269 } | 269 } |
| 270 | 270 |
| 271 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, | 271 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, |
| 272 const AttributeConfiguration* attributes, size_t attributeCount, | 272 const AttributeConfiguration* attributes, size_t attributeCount, |
| 273 const AccessorConfiguration* accessors, size_t accessorCount, | 273 const AccessorConfiguration* accessors, size_t accessorCount, |
| 274 const MethodConfiguration* methods, size_t methodCount) | 274 const MethodConfiguration* methods, size_t methodCount) |
| 275 { | 275 { |
| 276 // This defines the constructor function's "name" property. |
| 276 functionDescriptor->SetClassName(v8AtomicString(isolate, interfaceName)); | 277 functionDescriptor->SetClassName(v8AtomicString(isolate, interfaceName)); |
| 277 v8::Local<v8::ObjectTemplate> instanceTemplate = functionDescriptor->Instanc
eTemplate(); | 278 v8::Local<v8::ObjectTemplate> instanceTemplate = functionDescriptor->Instanc
eTemplate(); |
| 278 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionDescriptor->Protot
ypeTemplate(); | 279 v8::Local<v8::ObjectTemplate> prototypeTemplate = functionDescriptor->Protot
ypeTemplate(); |
| 279 instanceTemplate->SetInternalFieldCount(fieldCount); | 280 instanceTemplate->SetInternalFieldCount(fieldCount); |
| 280 if (!parentClass.IsEmpty()) { | 281 if (!parentClass.IsEmpty()) { |
| 281 functionDescriptor->Inherit(parentClass); | 282 functionDescriptor->Inherit(parentClass); |
| 282 // Marks the prototype object as one of native-backed objects. | 283 // Marks the prototype object as one of native-backed objects. |
| 283 // This is needed since bug 110436 asks WebKit to tell native-initiated
prototypes from pure-JS ones. | 284 // This is needed since bug 110436 asks WebKit to tell native-initiated
prototypes from pure-JS ones. |
| 284 // This doesn't mark kinds "root" classes like Node, where setting this
changes prototype chain structure. | 285 // This doesn't mark kinds "root" classes like Node, where setting this
changes prototype chain structure. |
| 285 prototypeTemplate->SetInternalFieldCount(v8PrototypeInternalFieldcount); | 286 prototypeTemplate->SetInternalFieldCount(v8PrototypeInternalFieldcount); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 303 return result; | 304 return result; |
| 304 | 305 |
| 305 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "BuildDOMTemplate"); | 306 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "BuildDOMTemplate"); |
| 306 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons
tructorMode); | 307 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons
tructorMode); |
| 307 configureDOMClassTemplate(result, isolate); | 308 configureDOMClassTemplate(result, isolate); |
| 308 data->setDOMTemplate(wrapperTypeInfo, result); | 309 data->setDOMTemplate(wrapperTypeInfo, result); |
| 309 return result; | 310 return result; |
| 310 } | 311 } |
| 311 | 312 |
| 312 } // namespace blink | 313 } // namespace blink |
| OLD | NEW |