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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
67 // the instance or the prototype ObjectTemplate, based on |instanceOrPrototy peConfiguration|. | 67 // the instance or the prototype ObjectTemplate, based on |instanceOrPrototy peConfiguration|. |
68 struct AttributeConfiguration { | 68 struct AttributeConfiguration { |
69 AttributeConfiguration& operator=(const AttributeConfiguration&) = delet e; | 69 AttributeConfiguration& operator=(const AttributeConfiguration&) = delet e; |
70 DISALLOW_ALLOCATION(); | 70 DISALLOW_ALLOCATION(); |
71 const char* const name; | 71 const char* const name; |
72 v8::AccessorNameGetterCallback getter; | 72 v8::AccessorNameGetterCallback getter; |
73 v8::AccessorNameSetterCallback setter; | 73 v8::AccessorNameSetterCallback setter; |
74 v8::AccessorNameGetterCallback getterForMainWorld; | 74 v8::AccessorNameGetterCallback getterForMainWorld; |
75 v8::AccessorNameSetterCallback setterForMainWorld; | 75 v8::AccessorNameSetterCallback setterForMainWorld; |
76 const WrapperTypeInfo* data; | 76 const WrapperTypeInfo* data; |
77 v8::AccessControl settings; | 77 unsigned settings : 8; // v8::AccessControl |
haraken
2015/10/02 09:33:40
4 bit looks enough though.
Yuki
2015/10/02 10:36:48
Yes, that's true. But v8.h is out of our (direct)
| |
78 v8::PropertyAttribute attribute; | 78 unsigned attribute : 8; // v8::PropertyAttribute |
79 unsigned exposeConfiguration : 1; // ExposeConfiguration | 79 unsigned exposeConfiguration : 1; // ExposeConfiguration |
80 unsigned propertyLocationConfiguration : 3; // PropertyLocationConfigura tion | 80 unsigned propertyLocationConfiguration : 3; // PropertyLocationConfigura tion |
81 unsigned holderCheckConfiguration : 1; // HolderCheckConfiguration | 81 unsigned holderCheckConfiguration : 1; // HolderCheckConfiguration |
82 }; | 82 }; |
83 | 83 |
84 static void installAttributes(v8::Isolate*, v8::Local<v8::ObjectTemplate> in stanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, const Attribute Configuration*, size_t attributeCount); | 84 static void installAttributes(v8::Isolate*, v8::Local<v8::ObjectTemplate> in stanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, const Attribute Configuration*, size_t attributeCount); |
85 | 85 |
86 static void installAttribute(v8::Isolate*, v8::Local<v8::ObjectTemplate> ins tanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, const AttributeC onfiguration&); | 86 static void installAttribute(v8::Isolate*, v8::Local<v8::ObjectTemplate> ins tanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, const AttributeC onfiguration&); |
87 | 87 |
88 // AccessorConfiguration translates into calls to SetAccessorProperty() | 88 // AccessorConfiguration translates into calls to SetAccessorProperty() |
89 // on prototype ObjectTemplate. | 89 // on prototype ObjectTemplate. |
90 struct AccessorConfiguration { | 90 struct AccessorConfiguration { |
91 AccessorConfiguration& operator=(const AccessorConfiguration&) = delete; | 91 AccessorConfiguration& operator=(const AccessorConfiguration&) = delete; |
92 DISALLOW_ALLOCATION(); | 92 DISALLOW_ALLOCATION(); |
93 const char* const name; | 93 const char* const name; |
94 v8::FunctionCallback getter; | 94 v8::FunctionCallback getter; |
95 v8::FunctionCallback setter; | 95 v8::FunctionCallback setter; |
96 v8::FunctionCallback getterForMainWorld; | 96 v8::FunctionCallback getterForMainWorld; |
97 v8::FunctionCallback setterForMainWorld; | 97 v8::FunctionCallback setterForMainWorld; |
98 const WrapperTypeInfo* data; | 98 const WrapperTypeInfo* data; |
99 v8::AccessControl settings; | 99 unsigned settings : 8; // v8::AccessControl |
100 v8::PropertyAttribute attribute; | 100 unsigned attribute : 8; // v8::PropertyAttribute |
101 unsigned exposeConfiguration : 1; // ExposeConfiguration | 101 unsigned exposeConfiguration : 1; // ExposeConfiguration |
102 unsigned propertyLocationConfiguration : 3; // PropertyLocationConfigura tion | 102 unsigned propertyLocationConfiguration : 3; // PropertyLocationConfigura tion |
103 unsigned holderCheckConfiguration : 1; // HolderCheckConfiguration | 103 unsigned holderCheckConfiguration : 1; // HolderCheckConfiguration |
104 }; | 104 }; |
105 | 105 |
106 static void installAccessors(v8::Isolate*, v8::Local<v8::ObjectTemplate> ins tanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, v8::Local<v8::Fu nctionTemplate> interfaceTemplate, v8::Local<v8::Signature>, const AccessorConfi guration*, size_t accessorCount); | 106 static void installAccessors(v8::Isolate*, v8::Local<v8::ObjectTemplate> ins tanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, v8::Local<v8::Fu nctionTemplate> interfaceTemplate, v8::Local<v8::Signature>, const AccessorConfi guration*, size_t accessorCount); |
107 | 107 |
108 static void installAccessor(v8::Isolate*, v8::Local<v8::ObjectTemplate> inst anceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, v8::Local<v8::Fun ctionTemplate> interfaceTemplate, v8::Local<v8::Signature>, const AccessorConfig uration&); | 108 static void installAccessor(v8::Isolate*, v8::Local<v8::ObjectTemplate> inst anceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, v8::Local<v8::Fun ctionTemplate> interfaceTemplate, v8::Local<v8::Signature>, const AccessorConfig uration&); |
109 | 109 |
110 static void installAccessor(v8::Isolate*, v8::Local<v8::Object> instance, v8 ::Local<v8::Object> prototype, v8::Local<v8::Function> interface, v8::Local<v8:: Signature>, const AccessorConfiguration&); | 110 static void installAccessor(v8::Isolate*, v8::Local<v8::Object> instance, v8 ::Local<v8::Object> prototype, v8::Local<v8::Function> interface, v8::Local<v8:: Signature>, const AccessorConfiguration&); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
153 v8::Local<v8::Name> methodName(v8::Isolate* isolate) const { return v8At omicString(isolate, name); } | 153 v8::Local<v8::Name> methodName(v8::Isolate* isolate) const { return v8At omicString(isolate, name); } |
154 v8::FunctionCallback callbackForWorld(const DOMWrapperWorld& world) cons t | 154 v8::FunctionCallback callbackForWorld(const DOMWrapperWorld& world) cons t |
155 { | 155 { |
156 return world.isMainWorld() && callbackForMainWorld ? callbackForMain World : callback; | 156 return world.isMainWorld() && callbackForMainWorld ? callbackForMain World : callback; |
157 } | 157 } |
158 | 158 |
159 const char* const name; | 159 const char* const name; |
160 v8::FunctionCallback callback; | 160 v8::FunctionCallback callback; |
161 v8::FunctionCallback callbackForMainWorld; | 161 v8::FunctionCallback callbackForMainWorld; |
162 int length; | 162 int length; |
163 unsigned attribute : 8; // v8::PropertyAttribute | |
163 unsigned exposeConfiguration : 1; // ExposeConfiguration | 164 unsigned exposeConfiguration : 1; // ExposeConfiguration |
164 unsigned propertyLocationConfiguration : 3; // PropertyLocationConfigura tion | 165 unsigned propertyLocationConfiguration : 3; // PropertyLocationConfigura tion |
165 }; | 166 }; |
166 | 167 |
167 struct SymbolKeyedMethodConfiguration { | 168 struct SymbolKeyedMethodConfiguration { |
168 SymbolKeyedMethodConfiguration& operator=(const SymbolKeyedMethodConfigu ration&) = delete; | 169 SymbolKeyedMethodConfiguration& operator=(const SymbolKeyedMethodConfigu ration&) = delete; |
169 DISALLOW_ALLOCATION(); | 170 DISALLOW_ALLOCATION(); |
170 v8::Local<v8::Name> methodName(v8::Isolate* isolate) const { return getS ymbol(isolate); } | 171 v8::Local<v8::Name> methodName(v8::Isolate* isolate) const { return getS ymbol(isolate); } |
171 v8::FunctionCallback callbackForWorld(const DOMWrapperWorld&) const | 172 v8::FunctionCallback callbackForWorld(const DOMWrapperWorld&) const |
172 { | 173 { |
173 return callback; | 174 return callback; |
174 } | 175 } |
175 | 176 |
176 v8::Local<v8::Symbol> (*getSymbol)(v8::Isolate*); | 177 v8::Local<v8::Symbol> (*getSymbol)(v8::Isolate*); |
177 v8::FunctionCallback callback; | 178 v8::FunctionCallback callback; |
178 // SymbolKeyedMethodConfiguration doesn't support per-world bindings. | 179 // SymbolKeyedMethodConfiguration doesn't support per-world bindings. |
179 int length; | 180 int length; |
181 unsigned attribute : 8; // v8::PropertyAttribute | |
180 unsigned exposeConfiguration : 1; // ExposeConfiguration | 182 unsigned exposeConfiguration : 1; // ExposeConfiguration |
181 unsigned propertyLocationConfiguration : 3; // PropertyLocationConfigura tion | 183 unsigned propertyLocationConfiguration : 3; // PropertyLocationConfigura tion |
182 }; | 184 }; |
183 | 185 |
184 static void installMethods(v8::Isolate*, v8::Local<v8::ObjectTemplate> insta nceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, v8::Local<v8::Func tionTemplate> interfaceTemplate, v8::Local<v8::Signature>, v8::PropertyAttribute , const MethodConfiguration*, size_t methodCount); | 186 static void installMethods(v8::Isolate*, v8::Local<v8::ObjectTemplate> insta nceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, v8::Local<v8::Func tionTemplate> interfaceTemplate, v8::Local<v8::Signature>, const MethodConfigura tion*, size_t methodCount); |
185 | 187 |
186 static void installMethod(v8::Isolate*, v8::Local<v8::ObjectTemplate> instan ceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, v8::Local<v8::Funct ionTemplate> interfaceTemplate, v8::Local<v8::Signature>, v8::PropertyAttribute, const MethodConfiguration&); | 188 static void installMethod(v8::Isolate*, v8::Local<v8::ObjectTemplate> instan ceTemplate, v8::Local<v8::ObjectTemplate> prototypeTemplate, v8::Local<v8::Funct ionTemplate> interfaceTemplate, v8::Local<v8::Signature>, const MethodConfigurat ion&); |
187 | 189 |
188 static void installMethod(v8::Isolate*, v8::Local<v8::ObjectTemplate>, v8::L ocal<v8::Signature>, v8::PropertyAttribute, const SymbolKeyedMethodConfiguration &); | 190 static void installMethod(v8::Isolate*, v8::Local<v8::Object> instance, v8:: Local<v8::Object> prototype, v8::Local<v8::Function> interface, v8::Local<v8::Si gnature>, const MethodConfiguration&); |
191 | |
192 static void installMethod(v8::Isolate*, v8::Local<v8::ObjectTemplate>, v8::L ocal<v8::Signature>, const SymbolKeyedMethodConfiguration&); | |
189 | 193 |
190 static v8::Local<v8::Signature> installDOMClassTemplate(v8::Isolate*, v8::Lo cal<v8::FunctionTemplate>, const char* interfaceName, v8::Local<v8::FunctionTemp late> parentClass, size_t fieldCount, | 194 static v8::Local<v8::Signature> installDOMClassTemplate(v8::Isolate*, v8::Lo cal<v8::FunctionTemplate>, const char* interfaceName, v8::Local<v8::FunctionTemp late> parentClass, size_t fieldCount, |
191 const AttributeConfiguration*, size_t attributeCount, | 195 const AttributeConfiguration*, size_t attributeCount, |
192 const AccessorConfiguration*, size_t accessorCount, | 196 const AccessorConfiguration*, size_t accessorCount, |
193 const MethodConfiguration*, size_t methodCount); | 197 const MethodConfiguration*, size_t methodCount); |
194 | 198 |
195 static v8::Local<v8::FunctionTemplate> domClassTemplate(v8::Isolate*, Wrappe rTypeInfo*, void (*)(v8::Local<v8::FunctionTemplate>, v8::Isolate*)); | 199 static v8::Local<v8::FunctionTemplate> domClassTemplate(v8::Isolate*, Wrappe rTypeInfo*, void (*)(v8::Local<v8::FunctionTemplate>, v8::Isolate*)); |
196 }; | 200 }; |
197 | 201 |
198 } // namespace blink | 202 } // namespace blink |
199 | 203 |
200 #endif // V8DOMConfiguration_h | 204 #endif // V8DOMConfiguration_h |
OLD | NEW |