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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 164 |
165 static void installMethods(v8::Handle<v8::ObjectTemplate>, v8::Handle<v8::Si
gnature>, v8::PropertyAttribute, const MethodConfiguration*, size_t callbackCoun
t, v8::Isolate*); | 165 static void installMethods(v8::Handle<v8::ObjectTemplate>, v8::Handle<v8::Si
gnature>, v8::PropertyAttribute, const MethodConfiguration*, size_t callbackCoun
t, v8::Isolate*); |
166 | 166 |
167 template <class ObjectOrTemplate, class Configuration> | 167 template <class ObjectOrTemplate, class Configuration> |
168 static void installMethod(v8::Handle<ObjectOrTemplate> objectOrTemplate, v8:
:Handle<v8::Signature> signature, v8::PropertyAttribute attribute, const Configu
ration& callback, v8::Isolate* isolate) | 168 static void installMethod(v8::Handle<ObjectOrTemplate> objectOrTemplate, v8:
:Handle<v8::Signature> signature, v8::PropertyAttribute attribute, const Configu
ration& callback, v8::Isolate* isolate) |
169 { | 169 { |
170 DOMWrapperWorld& world = DOMWrapperWorld::current(isolate); | 170 DOMWrapperWorld& world = DOMWrapperWorld::current(isolate); |
171 if (callback.exposeConfiguration == OnlyExposedToPrivateScript && !world
.isPrivateScriptIsolatedWorld()) | 171 if (callback.exposeConfiguration == OnlyExposedToPrivateScript && !world
.isPrivateScriptIsolatedWorld()) |
172 return; | 172 return; |
173 | 173 |
174 v8::Local<v8::FunctionTemplate> functionTemplate = functionTemplateForCa
llback(signature, callback.callbackForWorld(world), callback.length, isolate); | 174 v8::Local<v8::FunctionTemplate> functionTemplate = functionTemplateForCa
llback(isolate, signature, callback.callbackForWorld(world), callback.length); |
175 setMethod(objectOrTemplate, callback.methodName(isolate), functionTempla
te, attribute); | 175 setMethod(objectOrTemplate, callback.methodName(isolate), functionTempla
te, attribute); |
176 } | 176 } |
177 | 177 |
178 static void installAccessors(v8::Handle<v8::ObjectTemplate>, v8::Handle<v8::
Signature>, const AccessorConfiguration*, size_t accessorCount, v8::Isolate*); | 178 static void installAccessors(v8::Handle<v8::ObjectTemplate>, v8::Handle<v8::
Signature>, const AccessorConfiguration*, size_t accessorCount, v8::Isolate*); |
179 | 179 |
180 static v8::Local<v8::Signature> installDOMClassTemplate(v8::Handle<v8::Funct
ionTemplate>, const char* interfaceName, v8::Handle<v8::FunctionTemplate> parent
Class, size_t fieldCount, | 180 static v8::Local<v8::Signature> installDOMClassTemplate(v8::Handle<v8::Funct
ionTemplate>, const char* interfaceName, v8::Handle<v8::FunctionTemplate> parent
Class, size_t fieldCount, |
181 const AttributeConfiguration*, size_t attributeCount, | 181 const AttributeConfiguration*, size_t attributeCount, |
182 const AccessorConfiguration*, size_t accessorCount, | 182 const AccessorConfiguration*, size_t accessorCount, |
183 const MethodConfiguration*, size_t callbackCount, | 183 const MethodConfiguration*, size_t callbackCount, |
184 v8::Isolate*); | 184 v8::Isolate*); |
185 | 185 |
186 static v8::Handle<v8::FunctionTemplate> domClassTemplate(v8::Isolate*, Wrapp
erTypeInfo*, void (*)(v8::Handle<v8::FunctionTemplate>, v8::Isolate*)); | 186 static v8::Handle<v8::FunctionTemplate> domClassTemplate(v8::Isolate*, Wrapp
erTypeInfo*, void (*)(v8::Handle<v8::FunctionTemplate>, v8::Isolate*)); |
187 | 187 |
188 private: | 188 private: |
189 static void setMethod(v8::Handle<v8::Object> target, v8::Handle<v8::Name> na
me, v8::Handle<v8::FunctionTemplate> functionTemplate, v8::PropertyAttribute att
ribute) | 189 static void setMethod(v8::Handle<v8::Object> target, v8::Handle<v8::Name> na
me, v8::Handle<v8::FunctionTemplate> functionTemplate, v8::PropertyAttribute att
ribute) |
190 { | 190 { |
191 target->Set(name, functionTemplate->GetFunction()); | 191 target->Set(name, functionTemplate->GetFunction()); |
192 } | 192 } |
193 static void setMethod(v8::Handle<v8::FunctionTemplate> target, v8::Handle<v8
::Name> name, v8::Handle<v8::FunctionTemplate> functionTemplate, v8::PropertyAtt
ribute attribute) | 193 static void setMethod(v8::Handle<v8::FunctionTemplate> target, v8::Handle<v8
::Name> name, v8::Handle<v8::FunctionTemplate> functionTemplate, v8::PropertyAtt
ribute attribute) |
194 { | 194 { |
195 target->Set(name, functionTemplate, attribute); | 195 target->Set(name, functionTemplate, attribute); |
196 } | 196 } |
197 static void setMethod(v8::Handle<v8::ObjectTemplate> target, v8::Handle<v8::
Name> name, v8::Handle<v8::FunctionTemplate> functionTemplate, v8::PropertyAttri
bute attribute) | 197 static void setMethod(v8::Handle<v8::ObjectTemplate> target, v8::Handle<v8::
Name> name, v8::Handle<v8::FunctionTemplate> functionTemplate, v8::PropertyAttri
bute attribute) |
198 { | 198 { |
199 target->Set(name, functionTemplate, attribute); | 199 target->Set(name, functionTemplate, attribute); |
200 } | 200 } |
201 | 201 |
202 static v8::Handle<v8::FunctionTemplate> functionTemplateForCallback(v8::Hand
le<v8::Signature>, v8::FunctionCallback, int length, v8::Isolate*); | 202 static v8::Handle<v8::FunctionTemplate> functionTemplateForCallback(v8::Isol
ate*, v8::Handle<v8::Signature>, v8::FunctionCallback, int length); |
203 }; | 203 }; |
204 | 204 |
205 } // namespace blink | 205 } // namespace blink |
206 | 206 |
207 #endif // V8DOMConfiguration_h | 207 #endif // V8DOMConfiguration_h |
OLD | NEW |