| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 enum HolderCheckConfiguration { | 60 enum HolderCheckConfiguration { |
| 61 CheckHolder, | 61 CheckHolder, |
| 62 DoNotCheckHolder, | 62 DoNotCheckHolder, |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 typedef v8::experimental::FastAccessorBuilder* (*FastAccessorBuilderCallback
)(v8::Isolate*, | 65 typedef v8::experimental::FastAccessorBuilder* (*FastAccessorBuilderCallback
)(v8::Isolate*, |
| 66 v8::FunctionCallback); // Default (slow) callback. | 66 v8::FunctionCallback); // Default (slow) callback. |
| 67 | 67 |
| 68 typedef v8::Local<v8::Private> (*PrivatePropertyCallback)(v8::Isolate*); |
| 69 |
| 68 // AttributeConfiguration translates into calls to SetNativeDataProperty() o
n either | 70 // AttributeConfiguration translates into calls to SetNativeDataProperty() o
n either |
| 69 // the instance or the prototype ObjectTemplate, based on |instanceOrPrototy
peConfiguration|. | 71 // the instance or the prototype ObjectTemplate, based on |instanceOrPrototy
peConfiguration|. |
| 70 struct AttributeConfiguration { | 72 struct AttributeConfiguration { |
| 71 AttributeConfiguration& operator=(const AttributeConfiguration&) = delet
e; | 73 AttributeConfiguration& operator=(const AttributeConfiguration&) = delet
e; |
| 72 DISALLOW_NEW(); | 74 DISALLOW_NEW(); |
| 73 const char* const name; | 75 const char* const name; |
| 74 v8::AccessorNameGetterCallback getter; | 76 v8::AccessorNameGetterCallback getter; |
| 75 v8::AccessorNameSetterCallback setter; | 77 v8::AccessorNameSetterCallback setter; |
| 76 v8::AccessorNameGetterCallback getterForMainWorld; | 78 v8::AccessorNameGetterCallback getterForMainWorld; |
| 77 v8::AccessorNameSetterCallback setterForMainWorld; | 79 v8::AccessorNameSetterCallback setterForMainWorld; |
| 78 // TODO(vogelheim): Figure out how to remove this. | 80 |
| 81 // TODO(peterssen|vogelheim): Figure out how to remove this. |
| 79 FastAccessorBuilderCallback fastGetter; | 82 FastAccessorBuilderCallback fastGetter; |
| 83 // TODO(peterssen|vogelheim): This has to be removed too since it's only
used in accessors. |
| 84 PrivatePropertyCallback surrogatePropertyCallback; // The accessor's 're
sult' is stored in a private property. |
| 85 |
| 80 const WrapperTypeInfo* data; | 86 const WrapperTypeInfo* data; |
| 81 unsigned settings : 8; // v8::AccessControl | 87 unsigned settings : 8; // v8::AccessControl |
| 82 unsigned attribute : 8; // v8::PropertyAttribute | 88 unsigned attribute : 8; // v8::PropertyAttribute |
| 83 unsigned exposeConfiguration : 1; // ExposeConfiguration | 89 unsigned exposeConfiguration : 1; // ExposeConfiguration |
| 84 unsigned propertyLocationConfiguration : 3; // PropertyLocationConfigura
tion | 90 unsigned propertyLocationConfiguration : 3; // PropertyLocationConfigura
tion |
| 85 unsigned holderCheckConfiguration : 1; // HolderCheckConfiguration | 91 unsigned holderCheckConfiguration : 1; // HolderCheckConfiguration |
| 86 }; | 92 }; |
| 87 | 93 |
| 88 static void installAttributes(v8::Isolate*, const DOMWrapperWorld&, v8::Loca
l<v8::ObjectTemplate> instanceTemplate, v8::Local<v8::ObjectTemplate> prototypeT
emplate, const AttributeConfiguration*, size_t attributeCount); | 94 static void installAttributes(v8::Isolate*, const DOMWrapperWorld&, v8::Loca
l<v8::ObjectTemplate> instanceTemplate, v8::Local<v8::ObjectTemplate> prototypeT
emplate, const AttributeConfiguration*, size_t attributeCount); |
| 89 | 95 |
| 90 static void installAttribute(v8::Isolate*, const DOMWrapperWorld&, v8::Local
<v8::ObjectTemplate> instanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTe
mplate, const AttributeConfiguration&); | 96 static void installAttribute(v8::Isolate*, const DOMWrapperWorld&, v8::Local
<v8::ObjectTemplate> instanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTe
mplate, const AttributeConfiguration&); |
| 91 | 97 |
| 92 static void installAttribute(v8::Isolate*, const DOMWrapperWorld&, v8::Local
<v8::Object> instance, v8::Local<v8::Object> prototype, const AttributeConfigura
tion&); | 98 static void installAttribute(v8::Isolate*, const DOMWrapperWorld&, v8::Local
<v8::Object> instance, v8::Local<v8::Object> prototype, const AttributeConfigura
tion&); |
| 93 | 99 |
| 94 // AccessorConfiguration translates into calls to SetAccessorProperty() | 100 // AccessorConfiguration translates into calls to SetAccessorProperty() |
| 95 // on prototype ObjectTemplate. | 101 // on prototype ObjectTemplate. |
| 96 struct AccessorConfiguration { | 102 struct AccessorConfiguration { |
| 97 AccessorConfiguration& operator=(const AccessorConfiguration&) = delete; | 103 AccessorConfiguration& operator=(const AccessorConfiguration&) = delete; |
| 98 DISALLOW_NEW(); | 104 DISALLOW_NEW(); |
| 99 const char* const name; | 105 const char* const name; |
| 100 v8::FunctionCallback getter; | 106 v8::FunctionCallback getter; |
| 101 v8::FunctionCallback setter; | 107 v8::FunctionCallback setter; |
| 102 v8::FunctionCallback getterForMainWorld; | 108 v8::FunctionCallback getterForMainWorld; |
| 103 v8::FunctionCallback setterForMainWorld; | 109 v8::FunctionCallback setterForMainWorld; |
| 104 FastAccessorBuilderCallback fastGetter; | 110 FastAccessorBuilderCallback fastGetter; |
| 111 PrivatePropertyCallback surrogatePropertyCallback; // The accessor's 're
sult' is stored in a private property. |
| 105 const WrapperTypeInfo* data; | 112 const WrapperTypeInfo* data; |
| 106 unsigned settings : 8; // v8::AccessControl | 113 unsigned settings : 8; // v8::AccessControl |
| 107 unsigned attribute : 8; // v8::PropertyAttribute | 114 unsigned attribute : 8; // v8::PropertyAttribute |
| 108 unsigned exposeConfiguration : 1; // ExposeConfiguration | 115 unsigned exposeConfiguration : 1; // ExposeConfiguration |
| 109 unsigned propertyLocationConfiguration : 3; // PropertyLocationConfigura
tion | 116 unsigned propertyLocationConfiguration : 3; // PropertyLocationConfigura
tion |
| 110 unsigned holderCheckConfiguration : 1; // HolderCheckConfiguration | 117 unsigned holderCheckConfiguration : 1; // HolderCheckConfiguration |
| 111 }; | 118 }; |
| 112 | 119 |
| 113 static void installAccessors(v8::Isolate*, const DOMWrapperWorld&, v8::Local
<v8::ObjectTemplate> instanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTe
mplate, v8::Local<v8::FunctionTemplate> interfaceTemplate, v8::Local<v8::Signatu
re>, const AccessorConfiguration*, size_t accessorCount); | 120 static void installAccessors(v8::Isolate*, const DOMWrapperWorld&, v8::Local
<v8::ObjectTemplate> instanceTemplate, v8::Local<v8::ObjectTemplate> prototypeTe
mplate, v8::Local<v8::FunctionTemplate> interfaceTemplate, v8::Local<v8::Signatu
re>, const AccessorConfiguration*, size_t accessorCount); |
| 114 | 121 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 static v8::Local<v8::FunctionTemplate> domClassTemplate(v8::Isolate*, const
DOMWrapperWorld&, WrapperTypeInfo*, InstallTemplateFunction); | 212 static v8::Local<v8::FunctionTemplate> domClassTemplate(v8::Isolate*, const
DOMWrapperWorld&, WrapperTypeInfo*, InstallTemplateFunction); |
| 206 | 213 |
| 207 // Sets the class string of platform objects, interface prototype objects, e
tc. | 214 // Sets the class string of platform objects, interface prototype objects, e
tc. |
| 208 // See also http://heycam.github.io/webidl/#dfn-class-string | 215 // See also http://heycam.github.io/webidl/#dfn-class-string |
| 209 static void setClassString(v8::Isolate*, v8::Local<v8::ObjectTemplate>, cons
t char* classString); | 216 static void setClassString(v8::Isolate*, v8::Local<v8::ObjectTemplate>, cons
t char* classString); |
| 210 }; | 217 }; |
| 211 | 218 |
| 212 } // namespace blink | 219 } // namespace blink |
| 213 | 220 |
| 214 #endif // V8DOMConfiguration_h | 221 #endif // V8DOMConfiguration_h |
| OLD | NEW |