| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 enum ExposeConfiguration { | 47 enum ExposeConfiguration { |
| 48 ExposedToAllScripts, | 48 ExposedToAllScripts, |
| 49 OnlyExposedToPrivateScript, | 49 OnlyExposedToPrivateScript, |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 enum InstanceOrPrototypeConfiguration { | 52 enum InstanceOrPrototypeConfiguration { |
| 53 OnInstance, | 53 OnInstance, |
| 54 OnPrototype, | 54 OnPrototype, |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 enum HolderCheckConfiguration { |
| 58 CheckHolder, |
| 59 DoNotCheckHolder, |
| 60 }; |
| 61 |
| 57 // AttributeConfiguration translates into calls to SetAccessor() on either | 62 // AttributeConfiguration translates into calls to SetAccessor() on either |
| 58 // the instance or the prototype ObjectTemplate, based on |instanceOrPrototy
peConfiguration|. | 63 // the instance or the prototype ObjectTemplate, based on |instanceOrPrototy
peConfiguration|. |
| 59 struct AttributeConfiguration { | 64 struct AttributeConfiguration { |
| 60 const char* const name; | 65 const char* const name; |
| 61 v8::AccessorNameGetterCallback getter; | 66 v8::AccessorNameGetterCallback getter; |
| 62 v8::AccessorNameSetterCallback setter; | 67 v8::AccessorNameSetterCallback setter; |
| 63 v8::AccessorNameGetterCallback getterForMainWorld; | 68 v8::AccessorNameGetterCallback getterForMainWorld; |
| 64 v8::AccessorNameSetterCallback setterForMainWorld; | 69 v8::AccessorNameSetterCallback setterForMainWorld; |
| 65 const WrapperTypeInfo* data; | 70 const WrapperTypeInfo* data; |
| 66 v8::AccessControl settings; | 71 v8::AccessControl settings; |
| 67 v8::PropertyAttribute attribute; | 72 v8::PropertyAttribute attribute; |
| 68 ExposeConfiguration exposeConfiguration; | 73 unsigned exposeConfiguration : 1; // ExposeConfiguration |
| 69 InstanceOrPrototypeConfiguration instanceOrPrototypeConfiguration; | 74 unsigned instanceOrPrototypeConfiguration : 1; // InstanceOrPrototypeCon
figuration |
| 70 }; | 75 }; |
| 71 | 76 |
| 72 static void installAttributes(v8::Isolate*, v8::Local<v8::ObjectTemplate> in
stanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, const Attribute
Configuration*, size_t attributeCount); | 77 static void installAttributes(v8::Isolate*, v8::Local<v8::ObjectTemplate> in
stanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, const Attribute
Configuration*, size_t attributeCount); |
| 73 | 78 |
| 74 static void installAttribute(v8::Isolate*, v8::Local<v8::ObjectTemplate> ins
tanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, const AttributeC
onfiguration&); | 79 static void installAttribute(v8::Isolate*, v8::Local<v8::ObjectTemplate> ins
tanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, const AttributeC
onfiguration&); |
| 75 | 80 |
| 76 static void installAttribute(v8::Isolate*, v8::Local<v8::Object> instance, v
8::Local<v8::Object> prototype, const AttributeConfiguration&); | 81 static void installAttribute(v8::Isolate*, v8::Local<v8::Object> instance, v
8::Local<v8::Object> prototype, const AttributeConfiguration&); |
| 77 | 82 |
| 78 // AccessorConfiguration translates into calls to SetAccessorProperty() | 83 // AccessorConfiguration translates into calls to SetAccessorProperty() |
| 79 // on prototype ObjectTemplate. | 84 // on prototype ObjectTemplate. |
| 80 struct AccessorConfiguration { | 85 struct AccessorConfiguration { |
| 81 const char* const name; | 86 const char* const name; |
| 82 v8::FunctionCallback getter; | 87 v8::FunctionCallback getter; |
| 83 v8::FunctionCallback setter; | 88 v8::FunctionCallback setter; |
| 84 v8::FunctionCallback getterForMainWorld; | 89 v8::FunctionCallback getterForMainWorld; |
| 85 v8::FunctionCallback setterForMainWorld; | 90 v8::FunctionCallback setterForMainWorld; |
| 86 const WrapperTypeInfo* data; | 91 const WrapperTypeInfo* data; |
| 87 v8::AccessControl settings; | 92 v8::AccessControl settings; |
| 88 v8::PropertyAttribute attribute; | 93 v8::PropertyAttribute attribute; |
| 89 ExposeConfiguration exposeConfiguration; | 94 unsigned exposeConfiguration : 1; // ExposeConfiguration |
| 95 unsigned holderCheckConfiguration : 1; // HolderCheckConfiguration |
| 90 }; | 96 }; |
| 91 | 97 |
| 92 static void installAccessors(v8::Isolate*, v8::Local<v8::ObjectTemplate> pro
totypeTemplate, v8::Local<v8::Signature>, const AccessorConfiguration*, size_t a
ccessorCount); | 98 static void installAccessors(v8::Isolate*, v8::Local<v8::ObjectTemplate> pro
totypeTemplate, v8::Local<v8::Signature>, const AccessorConfiguration*, size_t a
ccessorCount); |
| 93 | 99 |
| 94 static void installAccessor(v8::Isolate*, v8::Local<v8::ObjectTemplate> prot
otypeTemplate, v8::Local<v8::Signature>, const AccessorConfiguration&); | 100 static void installAccessor(v8::Isolate*, v8::Local<v8::ObjectTemplate> prot
otypeTemplate, v8::Local<v8::Signature>, const AccessorConfiguration&); |
| 95 | 101 |
| 96 static void installAccessor(v8::Isolate*, v8::Local<v8::Object> prototype, c
onst AccessorConfiguration&); | 102 static void installAccessor(v8::Isolate*, v8::Local<v8::Object> prototype, c
onst AccessorConfiguration&); |
| 97 | 103 |
| 98 enum ConstantType { | 104 enum ConstantType { |
| 99 ConstantTypeShort, | 105 ConstantTypeShort, |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 const AttributeConfiguration*, size_t attributeCount, | 179 const AttributeConfiguration*, size_t attributeCount, |
| 174 const AccessorConfiguration*, size_t accessorCount, | 180 const AccessorConfiguration*, size_t accessorCount, |
| 175 const MethodConfiguration*, size_t callbackCount); | 181 const MethodConfiguration*, size_t callbackCount); |
| 176 | 182 |
| 177 static v8::Local<v8::FunctionTemplate> domClassTemplate(v8::Isolate*, Wrappe
rTypeInfo*, void (*)(v8::Local<v8::FunctionTemplate>, v8::Isolate*)); | 183 static v8::Local<v8::FunctionTemplate> domClassTemplate(v8::Isolate*, Wrappe
rTypeInfo*, void (*)(v8::Local<v8::FunctionTemplate>, v8::Isolate*)); |
| 178 }; | 184 }; |
| 179 | 185 |
| 180 } // namespace blink | 186 } // namespace blink |
| 181 | 187 |
| 182 #endif // V8DOMConfiguration_h | 188 #endif // V8DOMConfiguration_h |
| OLD | NEW |