Chromium Code Reviews| Index: include/v8.h |
| diff --git a/include/v8.h b/include/v8.h |
| index 6572f26d177a18a41887d4348d69246c74d56612..74458aa18f4289a1c85e9803e418537627c9fdf7 100644 |
| --- a/include/v8.h |
| +++ b/include/v8.h |
| @@ -3319,6 +3319,55 @@ typedef void (*NamedPropertyEnumeratorCallback)( |
| const PropertyCallbackInfo<Array>& info); |
| +// TODO(wingo): Deprecate and remove previous typedefs, and replace |
| +// GenericNamedPropertyFooCallback with just NamedPropertyFooCallback. |
| +/** |
| + * GenericNamedProperty[Getter|Setter] are used as interceptors on object. |
| + * See ObjectTemplate::SetGenericNamedPropertyHandler. |
| + */ |
| +typedef void (*GenericNamedPropertyGetterCallback)( |
| + Local<Name> property, |
| + const PropertyCallbackInfo<Value>& info); |
| + |
| + |
| +/** |
| + * Returns the value if the setter intercepts the request. |
| + * Otherwise, returns an empty handle. |
| + */ |
| +typedef void (*GenericNamedPropertySetterCallback)( |
| + Local<Name> property, |
| + Local<Value> value, |
| + const PropertyCallbackInfo<Value>& info); |
| + |
| + |
| +/** |
| + * Returns a non-empty handle if the interceptor intercepts the request. |
| + * The result is an integer encoding property attributes (like v8::None, |
| + * v8::DontEnum, etc.) |
| + */ |
| +typedef void (*GenericNamedPropertyQueryCallback)( |
| + Local<Name> property, |
| + const PropertyCallbackInfo<Integer>& info); |
| + |
| + |
| +/** |
| + * Returns a non-empty handle if the deleter intercepts the request. |
| + * The return value is true if the property could be deleted and false |
| + * otherwise. |
| + */ |
| +typedef void (*GenericNamedPropertyDeleterCallback)( |
| + Local<Name> property, |
| + const PropertyCallbackInfo<Boolean>& info); |
| + |
| + |
| +/** |
| + * Returns an array containing the names of the properties the named |
| + * property getter intercepts. |
| + */ |
| +typedef void (*GenericNamedPropertyEnumeratorCallback)( |
| + const PropertyCallbackInfo<Array>& info); |
| + |
| + |
| /** |
| * Returns the value of the property if the getter intercepts the |
| * request. Otherwise, returns an empty handle. |
| @@ -3659,6 +3708,34 @@ class V8_EXPORT ObjectTemplate : public Template { |
| Handle<Value> data = Handle<Value>()); |
| /** |
| + * Sets a named property handler on the object template. |
| + * |
| + * Whenever a property is accessed on objects created from this object |
| + * template, the provided callback is invoked instead of accessing the |
| + * property directly on the JavaScript object. |
| + * |
| + * Unlike SetNamedPropertyHandler, this version also intercepts values whose |
| + * names are symbols. |
| + * |
| + * \param getter The callback to invoke when getting a property. |
| + * \param setter The callback to invoke when setting a property. |
| + * \param query The callback to invoke to check if a property is present, |
| + * and if present, get its attributes. |
| + * \param deleter The callback to invoke when deleting a property. |
| + * \param enumerator The callback to invoke to enumerate all the named |
| + * properties of an object. |
| + * \param data A piece of data that will be passed to the callbacks |
| + * whenever they are invoked. |
| + */ |
| + void SetGenericNamedPropertyHandler( |
|
dcarney
2014/08/13 08:25:39
should be SetNamedPropertyHandler. easier to get r
wingo
2014/08/13 10:45:39
Alack, I just did this, but:
../test/cctest/test-
dcarney
2014/08/13 11:19:56
i didn't even know this was supported. since it's
|
| + GenericNamedPropertyGetterCallback getter, |
| + GenericNamedPropertySetterCallback setter = 0, |
| + GenericNamedPropertyQueryCallback query = 0, |
| + GenericNamedPropertyDeleterCallback deleter = 0, |
| + GenericNamedPropertyEnumeratorCallback enumerator = 0, |
| + Handle<Value> data = Handle<Value>()); |
| + |
| + /** |
| * Sets an indexed property handler on the object template. |
| * |
| * Whenever an indexed property is accessed on objects created from |