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

Unified Diff: include/v8.h

Issue 23182003: Push SetAccessor to Template (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebase, grokdump Created 7 years, 3 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 | 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 1b676deb6a565242caf4fbc290aa6dc4cd2c60a5..53e5929bd43646e1abb9344a11945a5ecbe89e0e 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -2123,10 +2123,10 @@ class V8_EXPORT Object : public Value {
PropertyAttribute attribute = None);
// This function is not yet stable and should not be used at this time.
- bool SetAccessor(Handle<String> name,
- Handle<DeclaredAccessorDescriptor> descriptor,
- AccessControl settings = DEFAULT,
- PropertyAttribute attribute = None);
+ bool SetDeclaredAccessor(Local<String> name,
+ Local<DeclaredAccessorDescriptor> descriptor,
+ PropertyAttribute attribute = None,
+ AccessControl settings = DEFAULT);
/**
* Returns an array containing the names of the enumerable properties
@@ -2981,6 +2981,51 @@ class V8_EXPORT Template : public Data {
PropertyAttribute attribute = None,
AccessControl settings = DEFAULT);
+ /**
+ * Whenever the property with the given name is accessed on objects
+ * created from this Template the getter and setter callbacks
+ * are called instead of getting and setting the property directly
+ * on the JavaScript object.
+ *
+ * \param name The name of the property for which an accessor is added.
+ * \param getter The callback to invoke when getting the property.
+ * \param setter The callback to invoke when setting the property.
+ * \param data A piece of data that will be passed to the getter and setter
+ * callbacks whenever they are invoked.
+ * \param settings Access control settings for the accessor. This is a bit
+ * field consisting of one of more of
+ * DEFAULT = 0, ALL_CAN_READ = 1, or ALL_CAN_WRITE = 2.
+ * The default is to not allow cross-context access.
+ * ALL_CAN_READ means that all cross-context reads are allowed.
+ * ALL_CAN_WRITE means that all cross-context writes are allowed.
+ * The combination ALL_CAN_READ | ALL_CAN_WRITE can be used to allow all
+ * cross-context access.
+ * \param attribute The attributes of the property for which an accessor
+ * is added.
+ * \param signature The signature describes valid receivers for the accessor
+ * and is used to perform implicit instance checks against them. If the
+ * receiver is incompatible (i.e. is not an instance of the constructor as
+ * defined by FunctionTemplate::HasInstance()), an implicit TypeError is
+ * thrown and no callback is invoked.
+ */
+ void SetNativeDataProperty(Local<String> name,
+ AccessorGetterCallback getter,
+ AccessorSetterCallback setter = 0,
+ // TODO(dcarney): gcc can't handle Local below
+ Handle<Value> data = Handle<Value>(),
+ PropertyAttribute attribute = None,
+ Local<AccessorSignature> signature =
+ Local<AccessorSignature>(),
+ AccessControl settings = DEFAULT);
+
+ // This function is not yet stable and should not be used at this time.
+ bool SetDeclaredAccessor(Local<String> name,
+ Local<DeclaredAccessorDescriptor> descriptor,
+ PropertyAttribute attribute = None,
+ Local<AccessorSignature> signature =
+ Local<AccessorSignature>(),
+ AccessControl settings = DEFAULT);
+
private:
Template();
@@ -3447,14 +3492,6 @@ class V8_EXPORT ObjectTemplate : public Template {
Handle<AccessorSignature> signature =
Handle<AccessorSignature>());
- // This function is not yet stable and should not be used at this time.
- bool SetAccessor(Handle<String> name,
- Handle<DeclaredAccessorDescriptor> descriptor,
- AccessControl settings = DEFAULT,
- PropertyAttribute attribute = None,
- Handle<AccessorSignature> signature =
- Handle<AccessorSignature>());
-
/**
* Sets a named property handler on the object template.
*
« 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