OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** \mainpage V8 API Reference Guide | 5 /** \mainpage V8 API Reference Guide |
6 * | 6 * |
7 * V8 is Google's open source JavaScript engine. | 7 * V8 is Google's open source JavaScript engine. |
8 * | 8 * |
9 * This set of documents provides reference material generated from the | 9 * This set of documents provides reference material generated from the |
10 * V8 header file, include/v8.h. | 10 * V8 header file, include/v8.h. |
(...skipping 4708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4719 * isolate, receiver, return value, or whether running in `'use strict'` mode. | 4719 * isolate, receiver, return value, or whether running in `'use strict'` mode. |
4720 * See `PropertyCallbackInfo`. | 4720 * See `PropertyCallbackInfo`. |
4721 * | 4721 * |
4722 * See also `ObjectTemplate::SetNamedPropertyHandler`. | 4722 * See also `ObjectTemplate::SetNamedPropertyHandler`. |
4723 */ | 4723 */ |
4724 typedef void (*GenericNamedPropertyDefinerCallback)( | 4724 typedef void (*GenericNamedPropertyDefinerCallback)( |
4725 Local<Name> key, const PropertyDescriptor& desc, | 4725 Local<Name> key, const PropertyDescriptor& desc, |
4726 const PropertyCallbackInfo<Value>& info); | 4726 const PropertyCallbackInfo<Value>& info); |
4727 | 4727 |
4728 /** | 4728 /** |
| 4729 * Interceptor for getOwnPropertyDescriptor requests on an object. |
| 4730 * |
| 4731 * Use `info.GetReturnValue().Set()` to set the return value of the |
| 4732 * intercepted request. The return value must be an object that |
| 4733 * can be converted to a PropertyDescriptor, e.g., a `v8::value` returned from |
| 4734 * `v8::Object::getOwnPropertyDescriptor`. |
| 4735 * |
| 4736 * \param property The name of the property for which the request was |
| 4737 * intercepted. |
| 4738 * \info Information about the intercepted request, such as |
| 4739 * isolate, receiver, return value, or whether running in `'use strict'` mode. |
| 4740 * See `PropertyCallbackInfo`. |
| 4741 * |
| 4742 * \note If GetOwnPropertyDescriptor is intercepted, it will |
| 4743 * always return true, i.e., indicate that the property was found. |
| 4744 * |
| 4745 * See also `ObjectTemplate::SetNamedPropertyHandler`. |
| 4746 */ |
| 4747 typedef void (*GenericNamedPropertyDescriptorCallback)( |
| 4748 Local<Name> property, const PropertyCallbackInfo<Value>& info); |
| 4749 |
| 4750 /** |
4729 * Returns the value of the property if the getter intercepts the | 4751 * Returns the value of the property if the getter intercepts the |
4730 * request. Otherwise, returns an empty handle. | 4752 * request. Otherwise, returns an empty handle. |
4731 */ | 4753 */ |
4732 typedef void (*IndexedPropertyGetterCallback)( | 4754 typedef void (*IndexedPropertyGetterCallback)( |
4733 uint32_t index, | 4755 uint32_t index, |
4734 const PropertyCallbackInfo<Value>& info); | 4756 const PropertyCallbackInfo<Value>& info); |
4735 | 4757 |
4736 | 4758 |
4737 /** | 4759 /** |
4738 * Returns the value if the setter intercepts the request. | 4760 * Returns the value if the setter intercepts the request. |
(...skipping 28 matching lines...) Expand all Loading... |
4767 * Returns an array containing the indices of the properties the | 4789 * Returns an array containing the indices of the properties the |
4768 * indexed property getter intercepts. | 4790 * indexed property getter intercepts. |
4769 */ | 4791 */ |
4770 typedef void (*IndexedPropertyEnumeratorCallback)( | 4792 typedef void (*IndexedPropertyEnumeratorCallback)( |
4771 const PropertyCallbackInfo<Array>& info); | 4793 const PropertyCallbackInfo<Array>& info); |
4772 | 4794 |
4773 typedef void (*IndexedPropertyDefinerCallback)( | 4795 typedef void (*IndexedPropertyDefinerCallback)( |
4774 uint32_t index, const PropertyDescriptor& desc, | 4796 uint32_t index, const PropertyDescriptor& desc, |
4775 const PropertyCallbackInfo<Value>& info); | 4797 const PropertyCallbackInfo<Value>& info); |
4776 | 4798 |
| 4799 typedef void (*IndexedPropertyDescriptorCallback)( |
| 4800 uint32_t index, const PropertyCallbackInfo<Value>& info); |
| 4801 |
4777 /** | 4802 /** |
4778 * Access type specification. | 4803 * Access type specification. |
4779 */ | 4804 */ |
4780 enum AccessType { | 4805 enum AccessType { |
4781 ACCESS_GET, | 4806 ACCESS_GET, |
4782 ACCESS_SET, | 4807 ACCESS_SET, |
4783 ACCESS_HAS, | 4808 ACCESS_HAS, |
4784 ACCESS_DELETE, | 4809 ACCESS_DELETE, |
4785 ACCESS_KEYS | 4810 ACCESS_KEYS |
4786 }; | 4811 }; |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5028 GenericNamedPropertyDeleterCallback deleter = 0, | 5053 GenericNamedPropertyDeleterCallback deleter = 0, |
5029 GenericNamedPropertyEnumeratorCallback enumerator = 0, | 5054 GenericNamedPropertyEnumeratorCallback enumerator = 0, |
5030 Local<Value> data = Local<Value>(), | 5055 Local<Value> data = Local<Value>(), |
5031 PropertyHandlerFlags flags = PropertyHandlerFlags::kNone) | 5056 PropertyHandlerFlags flags = PropertyHandlerFlags::kNone) |
5032 : getter(getter), | 5057 : getter(getter), |
5033 setter(setter), | 5058 setter(setter), |
5034 query(query), | 5059 query(query), |
5035 deleter(deleter), | 5060 deleter(deleter), |
5036 enumerator(enumerator), | 5061 enumerator(enumerator), |
5037 definer(0), | 5062 definer(0), |
| 5063 descriptor(0), |
5038 data(data), | 5064 data(data), |
5039 flags(flags) {} | 5065 flags(flags) {} |
5040 | 5066 |
5041 NamedPropertyHandlerConfiguration( | 5067 NamedPropertyHandlerConfiguration( |
5042 GenericNamedPropertyGetterCallback getter, | 5068 GenericNamedPropertyGetterCallback getter, |
5043 GenericNamedPropertySetterCallback setter, | 5069 GenericNamedPropertySetterCallback setter, |
5044 GenericNamedPropertyQueryCallback query, | 5070 GenericNamedPropertyDescriptorCallback descriptor, |
5045 GenericNamedPropertyDeleterCallback deleter, | 5071 GenericNamedPropertyDeleterCallback deleter, |
5046 GenericNamedPropertyEnumeratorCallback enumerator, | 5072 GenericNamedPropertyEnumeratorCallback enumerator, |
5047 GenericNamedPropertyDefinerCallback definer, | 5073 GenericNamedPropertyDefinerCallback definer, |
5048 Local<Value> data = Local<Value>(), | 5074 Local<Value> data = Local<Value>(), |
5049 PropertyHandlerFlags flags = PropertyHandlerFlags::kNone) | 5075 PropertyHandlerFlags flags = PropertyHandlerFlags::kNone) |
5050 : getter(getter), | 5076 : getter(getter), |
5051 setter(setter), | 5077 setter(setter), |
5052 query(query), | 5078 query(0), |
5053 deleter(deleter), | 5079 deleter(deleter), |
5054 enumerator(enumerator), | 5080 enumerator(enumerator), |
5055 definer(definer), | 5081 definer(definer), |
| 5082 descriptor(descriptor), |
5056 data(data), | 5083 data(data), |
5057 flags(flags) {} | 5084 flags(flags) {} |
5058 | 5085 |
5059 GenericNamedPropertyGetterCallback getter; | 5086 GenericNamedPropertyGetterCallback getter; |
5060 GenericNamedPropertySetterCallback setter; | 5087 GenericNamedPropertySetterCallback setter; |
5061 GenericNamedPropertyQueryCallback query; | 5088 GenericNamedPropertyQueryCallback query; |
5062 GenericNamedPropertyDeleterCallback deleter; | 5089 GenericNamedPropertyDeleterCallback deleter; |
5063 GenericNamedPropertyEnumeratorCallback enumerator; | 5090 GenericNamedPropertyEnumeratorCallback enumerator; |
5064 GenericNamedPropertyDefinerCallback definer; | 5091 GenericNamedPropertyDefinerCallback definer; |
| 5092 GenericNamedPropertyDescriptorCallback descriptor; |
5065 Local<Value> data; | 5093 Local<Value> data; |
5066 PropertyHandlerFlags flags; | 5094 PropertyHandlerFlags flags; |
5067 }; | 5095 }; |
5068 | 5096 |
5069 | 5097 |
5070 struct IndexedPropertyHandlerConfiguration { | 5098 struct IndexedPropertyHandlerConfiguration { |
5071 IndexedPropertyHandlerConfiguration( | 5099 IndexedPropertyHandlerConfiguration( |
5072 /** Note: getter is required **/ | 5100 /** Note: getter is required **/ |
5073 IndexedPropertyGetterCallback getter = 0, | 5101 IndexedPropertyGetterCallback getter = 0, |
5074 IndexedPropertySetterCallback setter = 0, | 5102 IndexedPropertySetterCallback setter = 0, |
5075 IndexedPropertyQueryCallback query = 0, | 5103 IndexedPropertyQueryCallback query = 0, |
5076 IndexedPropertyDeleterCallback deleter = 0, | 5104 IndexedPropertyDeleterCallback deleter = 0, |
5077 IndexedPropertyEnumeratorCallback enumerator = 0, | 5105 IndexedPropertyEnumeratorCallback enumerator = 0, |
5078 Local<Value> data = Local<Value>(), | 5106 Local<Value> data = Local<Value>(), |
5079 PropertyHandlerFlags flags = PropertyHandlerFlags::kNone) | 5107 PropertyHandlerFlags flags = PropertyHandlerFlags::kNone) |
5080 : getter(getter), | 5108 : getter(getter), |
5081 setter(setter), | 5109 setter(setter), |
5082 query(query), | 5110 query(query), |
5083 deleter(deleter), | 5111 deleter(deleter), |
5084 enumerator(enumerator), | 5112 enumerator(enumerator), |
5085 definer(0), | 5113 definer(0), |
| 5114 descriptor(0), |
5086 data(data), | 5115 data(data), |
5087 flags(flags) {} | 5116 flags(flags) {} |
5088 | 5117 |
5089 IndexedPropertyHandlerConfiguration( | 5118 IndexedPropertyHandlerConfiguration( |
5090 IndexedPropertyGetterCallback getter, | 5119 IndexedPropertyGetterCallback getter, |
5091 IndexedPropertySetterCallback setter, IndexedPropertyQueryCallback query, | 5120 IndexedPropertySetterCallback setter, |
| 5121 IndexedPropertyDescriptorCallback descriptor, |
5092 IndexedPropertyDeleterCallback deleter, | 5122 IndexedPropertyDeleterCallback deleter, |
5093 IndexedPropertyEnumeratorCallback enumerator, | 5123 IndexedPropertyEnumeratorCallback enumerator, |
5094 IndexedPropertyDefinerCallback definer, | 5124 IndexedPropertyDefinerCallback definer, |
5095 Local<Value> data = Local<Value>(), | 5125 Local<Value> data = Local<Value>(), |
5096 PropertyHandlerFlags flags = PropertyHandlerFlags::kNone) | 5126 PropertyHandlerFlags flags = PropertyHandlerFlags::kNone) |
5097 : getter(getter), | 5127 : getter(getter), |
5098 setter(setter), | 5128 setter(setter), |
5099 query(query), | 5129 query(0), |
5100 deleter(deleter), | 5130 deleter(deleter), |
5101 enumerator(enumerator), | 5131 enumerator(enumerator), |
5102 definer(definer), | 5132 definer(definer), |
| 5133 descriptor(descriptor), |
5103 data(data), | 5134 data(data), |
5104 flags(flags) {} | 5135 flags(flags) {} |
5105 | 5136 |
5106 IndexedPropertyGetterCallback getter; | 5137 IndexedPropertyGetterCallback getter; |
5107 IndexedPropertySetterCallback setter; | 5138 IndexedPropertySetterCallback setter; |
5108 IndexedPropertyQueryCallback query; | 5139 IndexedPropertyQueryCallback query; |
5109 IndexedPropertyDeleterCallback deleter; | 5140 IndexedPropertyDeleterCallback deleter; |
5110 IndexedPropertyEnumeratorCallback enumerator; | 5141 IndexedPropertyEnumeratorCallback enumerator; |
5111 IndexedPropertyDefinerCallback definer; | 5142 IndexedPropertyDefinerCallback definer; |
| 5143 IndexedPropertyDescriptorCallback descriptor; |
5112 Local<Value> data; | 5144 Local<Value> data; |
5113 PropertyHandlerFlags flags; | 5145 PropertyHandlerFlags flags; |
5114 }; | 5146 }; |
5115 | 5147 |
5116 | 5148 |
5117 /** | 5149 /** |
5118 * An ObjectTemplate is used to create objects at runtime. | 5150 * An ObjectTemplate is used to create objects at runtime. |
5119 * | 5151 * |
5120 * Properties added to an ObjectTemplate are added to each object | 5152 * Properties added to an ObjectTemplate are added to each object |
5121 * created from the ObjectTemplate. | 5153 * created from the ObjectTemplate. |
(...skipping 4324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9446 */ | 9478 */ |
9447 | 9479 |
9448 | 9480 |
9449 } // namespace v8 | 9481 } // namespace v8 |
9450 | 9482 |
9451 | 9483 |
9452 #undef TYPE_CHECK | 9484 #undef TYPE_CHECK |
9453 | 9485 |
9454 | 9486 |
9455 #endif // INCLUDE_V8_H_ | 9487 #endif // INCLUDE_V8_H_ |
OLD | NEW |