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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 installMethod(prototype, signature, attributes, callbacks[i], isolate); | 123 installMethod(prototype, signature, attributes, callbacks[i], isolate); |
124 } | 124 } |
125 | 125 |
126 v8::Handle<v8::FunctionTemplate> V8DOMConfiguration::functionTemplateForCallback
(v8::Isolate* isolate, v8::Handle<v8::Signature> signature, v8::FunctionCallback
callback, int length) | 126 v8::Handle<v8::FunctionTemplate> V8DOMConfiguration::functionTemplateForCallback
(v8::Isolate* isolate, v8::Handle<v8::Signature> signature, v8::FunctionCallback
callback, int length) |
127 { | 127 { |
128 v8::Local<v8::FunctionTemplate> functionTemplate = v8::FunctionTemplate::New
(isolate, callback, v8Undefined(), signature, length); | 128 v8::Local<v8::FunctionTemplate> functionTemplate = v8::FunctionTemplate::New
(isolate, callback, v8Undefined(), signature, length); |
129 functionTemplate->RemovePrototype(); | 129 functionTemplate->RemovePrototype(); |
130 return functionTemplate; | 130 return functionTemplate; |
131 } | 131 } |
132 | 132 |
133 v8::Local<v8::Signature> V8DOMConfiguration::installDOMClassTemplate(v8::Handle<
v8::FunctionTemplate> functionDescriptor, const char* interfaceName, v8::Handle<
v8::FunctionTemplate> parentClass, size_t fieldCount, | 133 v8::Local<v8::Signature> V8DOMConfiguration::installDOMClassTemplate(v8::Isolate
* isolate, v8::Handle<v8::FunctionTemplate> functionDescriptor, const char* inte
rfaceName, v8::Handle<v8::FunctionTemplate> parentClass, size_t fieldCount, |
134 const AttributeConfiguration* attributes, size_t attributeCount, | 134 const AttributeConfiguration* attributes, size_t attributeCount, |
135 const AccessorConfiguration* accessors, size_t accessorCount, | 135 const AccessorConfiguration* accessors, size_t accessorCount, |
136 const MethodConfiguration* callbacks, size_t callbackCount, | 136 const MethodConfiguration* callbacks, size_t callbackCount) |
137 v8::Isolate* isolate) | |
138 { | 137 { |
139 functionDescriptor->SetClassName(v8AtomicString(isolate, interfaceName)); | 138 functionDescriptor->SetClassName(v8AtomicString(isolate, interfaceName)); |
140 v8::Local<v8::ObjectTemplate> instanceTemplate = functionDescriptor->Instanc
eTemplate(); | 139 v8::Local<v8::ObjectTemplate> instanceTemplate = functionDescriptor->Instanc
eTemplate(); |
141 instanceTemplate->SetInternalFieldCount(fieldCount); | 140 instanceTemplate->SetInternalFieldCount(fieldCount); |
142 if (!parentClass.IsEmpty()) { | 141 if (!parentClass.IsEmpty()) { |
143 functionDescriptor->Inherit(parentClass); | 142 functionDescriptor->Inherit(parentClass); |
144 // Marks the prototype object as one of native-backed objects. | 143 // Marks the prototype object as one of native-backed objects. |
145 // This is needed since bug 110436 asks WebKit to tell native-initiated
prototypes from pure-JS ones. | 144 // This is needed since bug 110436 asks WebKit to tell native-initiated
prototypes from pure-JS ones. |
146 // This doesn't mark kinds "root" classes like Node, where setting this
changes prototype chain structure. | 145 // This doesn't mark kinds "root" classes like Node, where setting this
changes prototype chain structure. |
147 v8::Local<v8::ObjectTemplate> prototype = functionDescriptor->PrototypeT
emplate(); | 146 v8::Local<v8::ObjectTemplate> prototype = functionDescriptor->PrototypeT
emplate(); |
(...skipping 18 matching lines...) Expand all Loading... |
166 return result; | 165 return result; |
167 | 166 |
168 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "BuildDOMTemplate"); | 167 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "BuildDOMTemplate"); |
169 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons
tructorMode); | 168 result = v8::FunctionTemplate::New(isolate, V8ObjectConstructor::isValidCons
tructorMode); |
170 configureDOMClassTemplate(result, isolate); | 169 configureDOMClassTemplate(result, isolate); |
171 data->setDOMTemplate(wrapperTypeInfo, result); | 170 data->setDOMTemplate(wrapperTypeInfo, result); |
172 return result; | 171 return result; |
173 } | 172 } |
174 | 173 |
175 } // namespace blink | 174 } // namespace blink |
OLD | NEW |