| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 // AttributeConfiguration translates into calls to SetNativeDataProperty() on | 77 // AttributeConfiguration translates into calls to SetNativeDataProperty() on |
| 78 // either the instance or the prototype ObjectTemplate, based on | 78 // either the instance or the prototype ObjectTemplate, based on |
| 79 // |propertyLocationConfiguration|. | 79 // |propertyLocationConfiguration|. |
| 80 struct AttributeConfiguration { | 80 struct AttributeConfiguration { |
| 81 AttributeConfiguration& operator=(const AttributeConfiguration&) = delete; | 81 AttributeConfiguration& operator=(const AttributeConfiguration&) = delete; |
| 82 DISALLOW_NEW(); | 82 DISALLOW_NEW(); |
| 83 const char* const name; | 83 const char* const name; |
| 84 v8::AccessorNameGetterCallback getter; | 84 v8::AccessorNameGetterCallback getter; |
| 85 v8::AccessorNameSetterCallback setter; | 85 v8::AccessorNameSetterCallback setter; |
| 86 v8::AccessorNameGetterCallback getterForMainWorld; | |
| 87 v8::AccessorNameSetterCallback setterForMainWorld; | |
| 88 // TODO(vogelheim): This has to be removed too since it's only used in | 86 // TODO(vogelheim): This has to be removed too since it's only used in |
| 89 // accessors. | 87 // accessors. |
| 90 // The accessor's 'result' is stored in a private property. | 88 // The accessor's 'result' is stored in a private property. |
| 91 CachedAccessorCallback cachedAccessorCallback; | 89 CachedAccessorCallback cachedAccessorCallback; |
| 92 const WrapperTypeInfo* data; | 90 const WrapperTypeInfo* data; |
| 93 // v8::PropertyAttribute | 91 // v8::PropertyAttribute |
| 94 unsigned attribute : 8; | 92 unsigned attribute : 8; |
| 95 // PropertyLocationConfiguration | 93 // PropertyLocationConfiguration |
| 96 unsigned propertyLocationConfiguration : 3; | 94 unsigned propertyLocationConfiguration : 3; |
| 97 // HolderCheckConfiguration | 95 // HolderCheckConfiguration |
| 98 unsigned holderCheckConfiguration : 1; | 96 unsigned holderCheckConfiguration : 1; |
| 97 // WorldConfiguration |
| 98 unsigned worldConfiguration : 2; |
| 99 }; | 99 }; |
| 100 | 100 |
| 101 static void installAttributes(v8::Isolate*, | 101 static void installAttributes(v8::Isolate*, |
| 102 const DOMWrapperWorld&, | 102 const DOMWrapperWorld&, |
| 103 v8::Local<v8::ObjectTemplate> instanceTemplate, | 103 v8::Local<v8::ObjectTemplate> instanceTemplate, |
| 104 v8::Local<v8::ObjectTemplate> prototypeTemplate, | 104 v8::Local<v8::ObjectTemplate> prototypeTemplate, |
| 105 const AttributeConfiguration*, | 105 const AttributeConfiguration*, |
| 106 size_t attributeCount); | 106 size_t attributeCount); |
| 107 | 107 |
| 108 static void installAttribute(v8::Isolate*, | 108 static void installAttribute(v8::Isolate*, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 132 size_t attributeCount); | 132 size_t attributeCount); |
| 133 | 133 |
| 134 // AccessorConfiguration translates into calls to SetAccessorProperty() | 134 // AccessorConfiguration translates into calls to SetAccessorProperty() |
| 135 // on prototype ObjectTemplate. | 135 // on prototype ObjectTemplate. |
| 136 struct AccessorConfiguration { | 136 struct AccessorConfiguration { |
| 137 AccessorConfiguration& operator=(const AccessorConfiguration&) = delete; | 137 AccessorConfiguration& operator=(const AccessorConfiguration&) = delete; |
| 138 DISALLOW_NEW(); | 138 DISALLOW_NEW(); |
| 139 const char* const name; | 139 const char* const name; |
| 140 v8::FunctionCallback getter; | 140 v8::FunctionCallback getter; |
| 141 v8::FunctionCallback setter; | 141 v8::FunctionCallback setter; |
| 142 v8::FunctionCallback getterForMainWorld; | |
| 143 v8::FunctionCallback setterForMainWorld; | |
| 144 // The accessor's 'result' is stored in a private property. | 142 // The accessor's 'result' is stored in a private property. |
| 145 CachedAccessorCallback cachedAccessorCallback; | 143 CachedAccessorCallback cachedAccessorCallback; |
| 146 const WrapperTypeInfo* data; | 144 const WrapperTypeInfo* data; |
| 147 // v8::PropertyAttribute | 145 // v8::PropertyAttribute |
| 148 unsigned attribute : 8; | 146 unsigned attribute : 8; |
| 149 // PropertyLocationConfiguration | 147 // PropertyLocationConfiguration |
| 150 unsigned propertyLocationConfiguration : 3; | 148 unsigned propertyLocationConfiguration : 3; |
| 151 // HolderCheckConfiguration | 149 // HolderCheckConfiguration |
| 152 unsigned holderCheckConfiguration : 1; | 150 unsigned holderCheckConfiguration : 1; |
| 151 // WorldConfiguration |
| 152 unsigned worldConfiguration : 2; |
| 153 }; | 153 }; |
| 154 | 154 |
| 155 static void installAccessors( | 155 static void installAccessors( |
| 156 v8::Isolate*, | 156 v8::Isolate*, |
| 157 const DOMWrapperWorld&, | 157 const DOMWrapperWorld&, |
| 158 v8::Local<v8::ObjectTemplate> instanceTemplate, | 158 v8::Local<v8::ObjectTemplate> instanceTemplate, |
| 159 v8::Local<v8::ObjectTemplate> prototypeTemplate, | 159 v8::Local<v8::ObjectTemplate> prototypeTemplate, |
| 160 v8::Local<v8::FunctionTemplate> interfaceTemplate, | 160 v8::Local<v8::FunctionTemplate> interfaceTemplate, |
| 161 v8::Local<v8::Signature>, | 161 v8::Local<v8::Signature>, |
| 162 const AccessorConfiguration*, | 162 const AccessorConfiguration*, |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 unsigned worldConfiguration : 2; | 256 unsigned worldConfiguration : 2; |
| 257 }; | 257 }; |
| 258 | 258 |
| 259 struct SymbolKeyedMethodConfiguration { | 259 struct SymbolKeyedMethodConfiguration { |
| 260 SymbolKeyedMethodConfiguration& operator=( | 260 SymbolKeyedMethodConfiguration& operator=( |
| 261 const SymbolKeyedMethodConfiguration&) = delete; | 261 const SymbolKeyedMethodConfiguration&) = delete; |
| 262 DISALLOW_NEW(); | 262 DISALLOW_NEW(); |
| 263 v8::Local<v8::Name> methodName(v8::Isolate* isolate) const { | 263 v8::Local<v8::Name> methodName(v8::Isolate* isolate) const { |
| 264 return getSymbol(isolate); | 264 return getSymbol(isolate); |
| 265 } | 265 } |
| 266 v8::FunctionCallback callbackForWorld(const DOMWrapperWorld&) const { | |
| 267 return callback; | |
| 268 } | |
| 269 | 266 |
| 270 v8::Local<v8::Symbol> (*getSymbol)(v8::Isolate*); | 267 v8::Local<v8::Symbol> (*getSymbol)(v8::Isolate*); |
| 271 v8::FunctionCallback callback; | 268 v8::FunctionCallback callback; |
| 272 // SymbolKeyedMethodConfiguration doesn't support per-world bindings. | 269 // SymbolKeyedMethodConfiguration doesn't support per-world bindings. |
| 273 int length; | 270 int length; |
| 274 // v8::PropertyAttribute | 271 // v8::PropertyAttribute |
| 275 unsigned attribute : 8; | 272 unsigned attribute : 8; |
| 276 // PropertyLocationConfiguration | 273 // PropertyLocationConfiguration |
| 277 unsigned propertyLocationConfiguration : 3; | 274 unsigned propertyLocationConfiguration : 3; |
| 278 // HolderCheckConfiguration | 275 // HolderCheckConfiguration |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 // Sets the class string of platform objects, interface prototype objects, | 325 // Sets the class string of platform objects, interface prototype objects, |
| 329 // etc. See also http://heycam.github.io/webidl/#dfn-class-string | 326 // etc. See also http://heycam.github.io/webidl/#dfn-class-string |
| 330 static void setClassString(v8::Isolate*, | 327 static void setClassString(v8::Isolate*, |
| 331 v8::Local<v8::ObjectTemplate>, | 328 v8::Local<v8::ObjectTemplate>, |
| 332 const char* classString); | 329 const char* classString); |
| 333 }; | 330 }; |
| 334 | 331 |
| 335 } // namespace blink | 332 } // namespace blink |
| 336 | 333 |
| 337 #endif // V8DOMConfiguration_h | 334 #endif // V8DOMConfiguration_h |
| OLD | NEW |