Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(810)

Unified Diff: include/v8.h

Issue 765883003: new api for adding indexed interceptors (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index d4e76f5c76f54607809dcec3b67c4915289110fe..b08607bee6a531a512e02dd5153603c9b9fdac32 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -3876,6 +3876,31 @@ struct NamedPropertyHandlerConfiguration {
};
+struct IndexedPropertyHandlerConfiguration {
+ IndexedPropertyHandlerConfiguration(
+ /** Note: getter is required **/
+ IndexedPropertyGetterCallback getter = 0,
+ IndexedPropertySetterCallback setter = 0,
+ IndexedPropertyQueryCallback query = 0,
+ IndexedPropertyDeleterCallback deleter = 0,
+ IndexedPropertyEnumeratorCallback enumerator = 0,
+ Handle<Value> data = Handle<Value>())
+ : getter(getter),
+ setter(setter),
+ query(query),
+ deleter(deleter),
+ enumerator(enumerator),
+ data(data) {}
+
+ IndexedPropertyGetterCallback getter;
+ IndexedPropertySetterCallback setter;
+ IndexedPropertyQueryCallback query;
+ IndexedPropertyDeleterCallback deleter;
+ IndexedPropertyEnumeratorCallback enumerator;
+ Handle<Value> data;
+};
+
+
/**
* An ObjectTemplate is used to create objects at runtime.
*
@@ -3958,6 +3983,7 @@ class V8_EXPORT ObjectTemplate : public Template {
* \param data A piece of data that will be passed to the callbacks
* whenever they are invoked.
*/
+ // TODO(dcarney): deprecate
void SetNamedPropertyHandler(
NamedPropertyGetterCallback getter,
NamedPropertySetterCallback setter = 0,
@@ -3983,14 +4009,18 @@ class V8_EXPORT ObjectTemplate : public Template {
* \param data A piece of data that will be passed to the callbacks
* whenever they are invoked.
*/
+ void SetHandler(const IndexedPropertyHandlerConfiguration& configuration);
+ // TODO(dcarney): deprecate
void SetIndexedPropertyHandler(
IndexedPropertyGetterCallback getter,
IndexedPropertySetterCallback setter = 0,
IndexedPropertyQueryCallback query = 0,
IndexedPropertyDeleterCallback deleter = 0,
IndexedPropertyEnumeratorCallback enumerator = 0,
- Handle<Value> data = Handle<Value>());
-
+ Handle<Value> data = Handle<Value>()) {
+ SetHandler(IndexedPropertyHandlerConfiguration(getter, setter, query,
+ deleter, enumerator, data));
+ }
/**
* Sets the callback to be used when calling instances created from
* this template as a function. If no callback is set, instances
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698