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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3858 matching lines...) Expand 10 before | Expand all | Expand 10 after
3869 3869
3870 GenericNamedPropertyGetterCallback getter; 3870 GenericNamedPropertyGetterCallback getter;
3871 GenericNamedPropertySetterCallback setter; 3871 GenericNamedPropertySetterCallback setter;
3872 GenericNamedPropertyQueryCallback query; 3872 GenericNamedPropertyQueryCallback query;
3873 GenericNamedPropertyDeleterCallback deleter; 3873 GenericNamedPropertyDeleterCallback deleter;
3874 GenericNamedPropertyEnumeratorCallback enumerator; 3874 GenericNamedPropertyEnumeratorCallback enumerator;
3875 Handle<Value> data; 3875 Handle<Value> data;
3876 }; 3876 };
3877 3877
3878 3878
3879 struct IndexedPropertyHandlerConfiguration {
3880 IndexedPropertyHandlerConfiguration(
3881 /** Note: getter is required **/
3882 IndexedPropertyGetterCallback getter = 0,
3883 IndexedPropertySetterCallback setter = 0,
3884 IndexedPropertyQueryCallback query = 0,
3885 IndexedPropertyDeleterCallback deleter = 0,
3886 IndexedPropertyEnumeratorCallback enumerator = 0,
3887 Handle<Value> data = Handle<Value>())
3888 : getter(getter),
3889 setter(setter),
3890 query(query),
3891 deleter(deleter),
3892 enumerator(enumerator),
3893 data(data) {}
3894
3895 IndexedPropertyGetterCallback getter;
3896 IndexedPropertySetterCallback setter;
3897 IndexedPropertyQueryCallback query;
3898 IndexedPropertyDeleterCallback deleter;
3899 IndexedPropertyEnumeratorCallback enumerator;
3900 Handle<Value> data;
3901 };
3902
3903
3879 /** 3904 /**
3880 * An ObjectTemplate is used to create objects at runtime. 3905 * An ObjectTemplate is used to create objects at runtime.
3881 * 3906 *
3882 * Properties added to an ObjectTemplate are added to each object 3907 * Properties added to an ObjectTemplate are added to each object
3883 * created from the ObjectTemplate. 3908 * created from the ObjectTemplate.
3884 */ 3909 */
3885 class V8_EXPORT ObjectTemplate : public Template { 3910 class V8_EXPORT ObjectTemplate : public Template {
3886 public: 3911 public:
3887 /** Creates an ObjectTemplate. */ 3912 /** Creates an ObjectTemplate. */
3888 static Local<ObjectTemplate> New(Isolate* isolate); 3913 static Local<ObjectTemplate> New(Isolate* isolate);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
3951 * \param getter The callback to invoke when getting a property. 3976 * \param getter The callback to invoke when getting a property.
3952 * \param setter The callback to invoke when setting a property. 3977 * \param setter The callback to invoke when setting a property.
3953 * \param query The callback to invoke to check if a property is present, 3978 * \param query The callback to invoke to check if a property is present,
3954 * and if present, get its attributes. 3979 * and if present, get its attributes.
3955 * \param deleter The callback to invoke when deleting a property. 3980 * \param deleter The callback to invoke when deleting a property.
3956 * \param enumerator The callback to invoke to enumerate all the named 3981 * \param enumerator The callback to invoke to enumerate all the named
3957 * properties of an object. 3982 * properties of an object.
3958 * \param data A piece of data that will be passed to the callbacks 3983 * \param data A piece of data that will be passed to the callbacks
3959 * whenever they are invoked. 3984 * whenever they are invoked.
3960 */ 3985 */
3986 // TODO(dcarney): deprecate
3961 void SetNamedPropertyHandler( 3987 void SetNamedPropertyHandler(
3962 NamedPropertyGetterCallback getter, 3988 NamedPropertyGetterCallback getter,
3963 NamedPropertySetterCallback setter = 0, 3989 NamedPropertySetterCallback setter = 0,
3964 NamedPropertyQueryCallback query = 0, 3990 NamedPropertyQueryCallback query = 0,
3965 NamedPropertyDeleterCallback deleter = 0, 3991 NamedPropertyDeleterCallback deleter = 0,
3966 NamedPropertyEnumeratorCallback enumerator = 0, 3992 NamedPropertyEnumeratorCallback enumerator = 0,
3967 Handle<Value> data = Handle<Value>()); 3993 Handle<Value> data = Handle<Value>());
3968 void SetHandler(const NamedPropertyHandlerConfiguration& configuration); 3994 void SetHandler(const NamedPropertyHandlerConfiguration& configuration);
3969 3995
3970 /** 3996 /**
3971 * Sets an indexed property handler on the object template. 3997 * Sets an indexed property handler on the object template.
3972 * 3998 *
3973 * Whenever an indexed property is accessed on objects created from 3999 * Whenever an indexed property is accessed on objects created from
3974 * this object template, the provided callback is invoked instead of 4000 * this object template, the provided callback is invoked instead of
3975 * accessing the property directly on the JavaScript object. 4001 * accessing the property directly on the JavaScript object.
3976 * 4002 *
3977 * \param getter The callback to invoke when getting a property. 4003 * \param getter The callback to invoke when getting a property.
3978 * \param setter The callback to invoke when setting a property. 4004 * \param setter The callback to invoke when setting a property.
3979 * \param query The callback to invoke to check if an object has a property. 4005 * \param query The callback to invoke to check if an object has a property.
3980 * \param deleter The callback to invoke when deleting a property. 4006 * \param deleter The callback to invoke when deleting a property.
3981 * \param enumerator The callback to invoke to enumerate all the indexed 4007 * \param enumerator The callback to invoke to enumerate all the indexed
3982 * properties of an object. 4008 * properties of an object.
3983 * \param data A piece of data that will be passed to the callbacks 4009 * \param data A piece of data that will be passed to the callbacks
3984 * whenever they are invoked. 4010 * whenever they are invoked.
3985 */ 4011 */
4012 void SetHandler(const IndexedPropertyHandlerConfiguration& configuration);
4013 // TODO(dcarney): deprecate
3986 void SetIndexedPropertyHandler( 4014 void SetIndexedPropertyHandler(
3987 IndexedPropertyGetterCallback getter, 4015 IndexedPropertyGetterCallback getter,
3988 IndexedPropertySetterCallback setter = 0, 4016 IndexedPropertySetterCallback setter = 0,
3989 IndexedPropertyQueryCallback query = 0, 4017 IndexedPropertyQueryCallback query = 0,
3990 IndexedPropertyDeleterCallback deleter = 0, 4018 IndexedPropertyDeleterCallback deleter = 0,
3991 IndexedPropertyEnumeratorCallback enumerator = 0, 4019 IndexedPropertyEnumeratorCallback enumerator = 0,
3992 Handle<Value> data = Handle<Value>()); 4020 Handle<Value> data = Handle<Value>()) {
3993 4021 SetHandler(IndexedPropertyHandlerConfiguration(getter, setter, query,
4022 deleter, enumerator, data));
4023 }
3994 /** 4024 /**
3995 * Sets the callback to be used when calling instances created from 4025 * Sets the callback to be used when calling instances created from
3996 * this template as a function. If no callback is set, instances 4026 * this template as a function. If no callback is set, instances
3997 * behave like normal JavaScript objects that cannot be called as a 4027 * behave like normal JavaScript objects that cannot be called as a
3998 * function. 4028 * function.
3999 */ 4029 */
4000 void SetCallAsFunctionHandler(FunctionCallback callback, 4030 void SetCallAsFunctionHandler(FunctionCallback callback,
4001 Handle<Value> data = Handle<Value>()); 4031 Handle<Value> data = Handle<Value>());
4002 4032
4003 /** 4033 /**
(...skipping 3464 matching lines...) Expand 10 before | Expand all | Expand 10 after
7468 */ 7498 */
7469 7499
7470 7500
7471 } // namespace v8 7501 } // namespace v8
7472 7502
7473 7503
7474 #undef TYPE_CHECK 7504 #undef TYPE_CHECK
7475 7505
7476 7506
7477 #endif // V8_H_ 7507 #endif // V8_H_
OLDNEW
« 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