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

Unified Diff: include/v8.h

Issue 467013003: Add interceptor support for symbols (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Updated to filter out non-symbol keys from for-in enumeration Created 6 years, 4 months 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 | samples/process.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 cbe8edd59b59349f1492d68853c21ca79f9f122b..4d0d4aa08914f4b6b2be0494cc4ae65a3ecd4a03 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -3353,6 +3353,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::SetNamedPropertyHandler.
+ */
+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.
@@ -3674,6 +3723,9 @@ class V8_EXPORT ObjectTemplate : public Template {
* from this object template, the provided callback is invoked instead of
* accessing the property directly on the JavaScript object.
*
+ * Note that new code should use the second version that can intercept
+ * symbol-named properties as well as string-named properties.
+ *
* \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,
@@ -3691,6 +3743,13 @@ class V8_EXPORT ObjectTemplate : public Template {
NamedPropertyDeleterCallback deleter = 0,
NamedPropertyEnumeratorCallback enumerator = 0,
Handle<Value> data = Handle<Value>());
+ void SetNamedPropertyHandler(
+ 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.
« no previous file with comments | « no previous file | samples/process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698