| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(isolate, signature, callback.callbackForWorld(world), callback.length); | 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::Isolate*, v8::Handle<v8::ObjectTemplate>, v
8::Handle<v8::Signature>, const AccessorConfiguration*, size_t accessorCount); | 178 static void installAccessors(v8::Isolate*, v8::Handle<v8::ObjectTemplate>, v
8::Handle<v8::Signature>, const AccessorConfiguration*, size_t accessorCount); |
| 179 | 179 |
| 180 static v8::Local<v8::Signature> installDOMClassTemplate(v8::Isolate*, v8::Ha
ndle<v8::FunctionTemplate>, const char* interfaceName, v8::Handle<v8::FunctionTe
mplate> parentClass, size_t fieldCount, | 180 static v8::Local<v8::Signature> installDOMClassTemplate(v8::Isolate*, v8::Lo
cal<v8::FunctionTemplate>, const char* interfaceName, v8::Handle<v8::FunctionTem
plate> parentClass, 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 | 184 |
| 185 static v8::Handle<v8::FunctionTemplate> domClassTemplate(v8::Isolate*, Wrapp
erTypeInfo*, void (*)(v8::Handle<v8::FunctionTemplate>, v8::Isolate*)); | 185 static v8::Handle<v8::FunctionTemplate> domClassTemplate(v8::Isolate*, Wrapp
erTypeInfo*, void (*)(v8::Local<v8::FunctionTemplate>, v8::Isolate*)); |
| 186 | 186 |
| 187 private: | 187 private: |
| 188 static void setMethod(v8::Handle<v8::Object> target, v8::Handle<v8::Name> na
me, v8::Handle<v8::FunctionTemplate> functionTemplate, v8::PropertyAttribute att
ribute) | 188 static void setMethod(v8::Handle<v8::Object> target, v8::Handle<v8::Name> na
me, v8::Handle<v8::FunctionTemplate> functionTemplate, v8::PropertyAttribute att
ribute) |
| 189 { | 189 { |
| 190 target->Set(name, functionTemplate->GetFunction()); | 190 target->Set(name, functionTemplate->GetFunction()); |
| 191 } | 191 } |
| 192 static void setMethod(v8::Handle<v8::FunctionTemplate> target, v8::Handle<v8
::Name> name, v8::Handle<v8::FunctionTemplate> functionTemplate, v8::PropertyAtt
ribute attribute) | 192 static void setMethod(v8::Handle<v8::FunctionTemplate> target, v8::Handle<v8
::Name> name, v8::Handle<v8::FunctionTemplate> functionTemplate, v8::PropertyAtt
ribute attribute) |
| 193 { | 193 { |
| 194 target->Set(name, functionTemplate, attribute); | 194 target->Set(name, functionTemplate, attribute); |
| 195 } | 195 } |
| 196 static void setMethod(v8::Handle<v8::ObjectTemplate> target, v8::Handle<v8::
Name> name, v8::Handle<v8::FunctionTemplate> functionTemplate, v8::PropertyAttri
bute attribute) | 196 static void setMethod(v8::Handle<v8::ObjectTemplate> target, v8::Handle<v8::
Name> name, v8::Handle<v8::FunctionTemplate> functionTemplate, v8::PropertyAttri
bute attribute) |
| 197 { | 197 { |
| 198 target->Set(name, functionTemplate, attribute); | 198 target->Set(name, functionTemplate, attribute); |
| 199 } | 199 } |
| 200 | 200 |
| 201 static v8::Handle<v8::FunctionTemplate> functionTemplateForCallback(v8::Isol
ate*, v8::Handle<v8::Signature>, v8::FunctionCallback, int length); | 201 static v8::Handle<v8::FunctionTemplate> functionTemplateForCallback(v8::Isol
ate*, v8::Handle<v8::Signature>, v8::FunctionCallback, int length); |
| 202 }; | 202 }; |
| 203 | 203 |
| 204 } // namespace blink | 204 } // namespace blink |
| 205 | 205 |
| 206 #endif // V8DOMConfiguration_h | 206 #endif // V8DOMConfiguration_h |
| OLD | NEW |