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

Side by Side Diff: include/v8.h

Issue 17069003: deprecate old style callbacks (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« 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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 class ObjectTemplate; 147 class ObjectTemplate;
148 class Data; 148 class Data;
149 class AccessorInfo; 149 class AccessorInfo;
150 template<typename T> class PropertyCallbackInfo; 150 template<typename T> class PropertyCallbackInfo;
151 class StackTrace; 151 class StackTrace;
152 class StackFrame; 152 class StackFrame;
153 class Isolate; 153 class Isolate;
154 class DeclaredAccessorDescriptor; 154 class DeclaredAccessorDescriptor;
155 class ObjectOperationDescriptor; 155 class ObjectOperationDescriptor;
156 class RawOperationDescriptor; 156 class RawOperationDescriptor;
157 class CallHandlerHelper;
157 158
158 namespace internal { 159 namespace internal {
159 class Arguments; 160 class Arguments;
160 class Heap; 161 class Heap;
161 class HeapObject; 162 class HeapObject;
162 class Isolate; 163 class Isolate;
163 class Object; 164 class Object;
164 template<typename T> class CustomArguments; 165 template<typename T> class CustomArguments;
165 class PropertyCallbackArguments; 166 class PropertyCallbackArguments;
166 class FunctionCallbackArguments; 167 class FunctionCallbackArguments;
(...skipping 1879 matching lines...) Expand 10 before | Expand all | Expand 10 after
2046 bool Delete(Handle<Value> key); 2047 bool Delete(Handle<Value> key);
2047 2048
2048 // Delete a property on this object bypassing interceptors and 2049 // Delete a property on this object bypassing interceptors and
2049 // ignoring dont-delete attributes. 2050 // ignoring dont-delete attributes.
2050 bool ForceDelete(Handle<Value> key); 2051 bool ForceDelete(Handle<Value> key);
2051 2052
2052 bool Has(uint32_t index); 2053 bool Has(uint32_t index);
2053 2054
2054 bool Delete(uint32_t index); 2055 bool Delete(uint32_t index);
2055 2056
2056 // TODO(dcarney): deprecate 2057 V8_DEPRECATED(bool SetAccessor(Handle<String> name,
2057 bool SetAccessor(Handle<String> name, 2058 AccessorGetter getter,
2058 AccessorGetter getter, 2059 AccessorSetter setter = 0,
2059 AccessorSetter setter = 0, 2060 Handle<Value> data = Handle<Value>(),
2060 Handle<Value> data = Handle<Value>(), 2061 AccessControl settings = DEFAULT,
2061 AccessControl settings = DEFAULT, 2062 PropertyAttribute attribute = None));
2062 PropertyAttribute attribute = None);
2063 bool SetAccessor(Handle<String> name, 2063 bool SetAccessor(Handle<String> name,
2064 AccessorGetterCallback getter, 2064 AccessorGetterCallback getter,
2065 AccessorSetterCallback setter = 0, 2065 AccessorSetterCallback setter = 0,
2066 Handle<Value> data = Handle<Value>(), 2066 Handle<Value> data = Handle<Value>(),
2067 AccessControl settings = DEFAULT, 2067 AccessControl settings = DEFAULT,
2068 PropertyAttribute attribute = None); 2068 PropertyAttribute attribute = None);
2069 2069
2070 // This function is not yet stable and should not be used at this time. 2070 // This function is not yet stable and should not be used at this time.
2071 bool SetAccessor(Handle<String> name, 2071 bool SetAccessor(Handle<String> name,
2072 Handle<DeclaredAccessorDescriptor> descriptor, 2072 Handle<DeclaredAccessorDescriptor> descriptor,
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after
3188 * 3188 *
3189 * \code 3189 * \code
3190 * child_func.prototype.__proto__ == function.prototype; 3190 * child_func.prototype.__proto__ == function.prototype;
3191 * child_instance.instance_accessor calls 'InstanceAccessorCallback' 3191 * child_instance.instance_accessor calls 'InstanceAccessorCallback'
3192 * child_instance.instance_property == 3; 3192 * child_instance.instance_property == 3;
3193 * \endcode 3193 * \endcode
3194 */ 3194 */
3195 class V8EXPORT FunctionTemplate : public Template { 3195 class V8EXPORT FunctionTemplate : public Template {
3196 public: 3196 public:
3197 /** Creates a function template.*/ 3197 /** Creates a function template.*/
3198 // TODO(dcarney): deprecate 3198 V8_DEPRECATED(static Local<FunctionTemplate> New(
3199 InvocationCallback callback,
3200 Handle<Value> data = Handle<Value>(),
3201 Handle<Signature> signature = Handle<Signature>(),
3202 int length = 0));
3199 static Local<FunctionTemplate> New( 3203 static Local<FunctionTemplate> New(
3200 InvocationCallback callback = 0, 3204 FunctionCallback callback = 0,
3201 Handle<Value> data = Handle<Value>(), 3205 Handle<Value> data = Handle<Value>(),
3202 Handle<Signature> signature = Handle<Signature>(), 3206 Handle<Signature> signature = Handle<Signature>(),
3203 int length = 0); 3207 int length = 0);
3204 static Local<FunctionTemplate> New(
3205 FunctionCallback callback, // TODO(dcarney): add back default param.
3206 Handle<Value> data = Handle<Value>(),
3207 Handle<Signature> signature = Handle<Signature>(),
3208 int length = 0);
3209 3208
3210 /** Returns the unique function instance in the current execution context.*/ 3209 /** Returns the unique function instance in the current execution context.*/
3211 Local<Function> GetFunction(); 3210 Local<Function> GetFunction();
3212 3211
3213 /** 3212 /**
3214 * Set the call-handler callback for a FunctionTemplate. This 3213 * Set the call-handler callback for a FunctionTemplate. This
3215 * callback is called whenever the function created from this 3214 * callback is called whenever the function created from this
3216 * FunctionTemplate is called. 3215 * FunctionTemplate is called.
3217 */ 3216 */
3218 // TODO(dcarney): deprecate 3217 V8_DEPRECATED(void SetCallHandler(InvocationCallback callback,
3219 void SetCallHandler(InvocationCallback callback, 3218 Handle<Value> data = Handle<Value>()));
3220 Handle<Value> data = Handle<Value>());
3221 void SetCallHandler(FunctionCallback callback, 3219 void SetCallHandler(FunctionCallback callback,
3222 Handle<Value> data = Handle<Value>()); 3220 Handle<Value> data = Handle<Value>());
3223 3221
3224 /** Set the predefined length property for the FunctionTemplate. */ 3222 /** Set the predefined length property for the FunctionTemplate. */
3225 void SetLength(int length); 3223 void SetLength(int length);
3226 3224
3227 /** Get the InstanceTemplate. */ 3225 /** Get the InstanceTemplate. */
3228 Local<ObjectTemplate> InstanceTemplate(); 3226 Local<ObjectTemplate> InstanceTemplate();
3229 3227
3230 /** Causes the function template to inherit from a parent function template.*/ 3228 /** Causes the function template to inherit from a parent function template.*/
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
3264 void ReadOnlyPrototype(); 3262 void ReadOnlyPrototype();
3265 3263
3266 /** 3264 /**
3267 * Returns true if the given object is an instance of this function 3265 * Returns true if the given object is an instance of this function
3268 * template. 3266 * template.
3269 */ 3267 */
3270 bool HasInstance(Handle<Value> object); 3268 bool HasInstance(Handle<Value> object);
3271 3269
3272 private: 3270 private:
3273 FunctionTemplate(); 3271 FunctionTemplate();
3272 // TODO(dcarney): Remove with SetCallHandler.
3273 friend class v8::CallHandlerHelper;
3274 void SetCallHandlerInternal(InvocationCallback callback, Handle<Value> data);
3274 friend class Context; 3275 friend class Context;
3275 friend class ObjectTemplate; 3276 friend class ObjectTemplate;
3276 }; 3277 };
3277 3278
3278 3279
3279 /** 3280 /**
3280 * An ObjectTemplate is used to create objects at runtime. 3281 * An ObjectTemplate is used to create objects at runtime.
3281 * 3282 *
3282 * Properties added to an ObjectTemplate are added to each object 3283 * Properties added to an ObjectTemplate are added to each object
3283 * created from the ObjectTemplate. 3284 * created from the ObjectTemplate.
(...skipping 28 matching lines...) Expand all
3312 * The combination ALL_CAN_READ | ALL_CAN_WRITE can be used to allow all 3313 * The combination ALL_CAN_READ | ALL_CAN_WRITE can be used to allow all
3313 * cross-context access. 3314 * cross-context access.
3314 * \param attribute The attributes of the property for which an accessor 3315 * \param attribute The attributes of the property for which an accessor
3315 * is added. 3316 * is added.
3316 * \param signature The signature describes valid receivers for the accessor 3317 * \param signature The signature describes valid receivers for the accessor
3317 * and is used to perform implicit instance checks against them. If the 3318 * and is used to perform implicit instance checks against them. If the
3318 * receiver is incompatible (i.e. is not an instance of the constructor as 3319 * receiver is incompatible (i.e. is not an instance of the constructor as
3319 * defined by FunctionTemplate::HasInstance()), an implicit TypeError is 3320 * defined by FunctionTemplate::HasInstance()), an implicit TypeError is
3320 * thrown and no callback is invoked. 3321 * thrown and no callback is invoked.
3321 */ 3322 */
3322 // TODO(dcarney): deprecate 3323 V8_DEPRECATED(void SetAccessor(Handle<String> name,
3323 void SetAccessor(Handle<String> name, 3324 AccessorGetter getter,
3324 AccessorGetter getter, 3325 AccessorSetter setter = 0,
3325 AccessorSetter setter = 0, 3326 Handle<Value> data = Handle<Value>(),
3326 Handle<Value> data = Handle<Value>(), 3327 AccessControl settings = DEFAULT,
3327 AccessControl settings = DEFAULT, 3328 PropertyAttribute attribute = None,
3328 PropertyAttribute attribute = None, 3329 Handle<AccessorSignature> signature =
3329 Handle<AccessorSignature> signature = 3330 Handle<AccessorSignature>()));
3330 Handle<AccessorSignature>());
3331 void SetAccessor(Handle<String> name, 3331 void SetAccessor(Handle<String> name,
3332 AccessorGetterCallback getter, 3332 AccessorGetterCallback getter,
3333 AccessorSetterCallback setter = 0, 3333 AccessorSetterCallback setter = 0,
3334 Handle<Value> data = Handle<Value>(), 3334 Handle<Value> data = Handle<Value>(),
3335 AccessControl settings = DEFAULT, 3335 AccessControl settings = DEFAULT,
3336 PropertyAttribute attribute = None, 3336 PropertyAttribute attribute = None,
3337 Handle<AccessorSignature> signature = 3337 Handle<AccessorSignature> signature =
3338 Handle<AccessorSignature>()); 3338 Handle<AccessorSignature>());
3339 3339
3340 // This function is not yet stable and should not be used at this time. 3340 // This function is not yet stable and should not be used at this time.
(...skipping 14 matching lines...) Expand all
3355 * \param getter The callback to invoke when getting a property. 3355 * \param getter The callback to invoke when getting a property.
3356 * \param setter The callback to invoke when setting a property. 3356 * \param setter The callback to invoke when setting a property.
3357 * \param query The callback to invoke to check if a property is present, 3357 * \param query The callback to invoke to check if a property is present,
3358 * and if present, get its attributes. 3358 * and if present, get its attributes.
3359 * \param deleter The callback to invoke when deleting a property. 3359 * \param deleter The callback to invoke when deleting a property.
3360 * \param enumerator The callback to invoke to enumerate all the named 3360 * \param enumerator The callback to invoke to enumerate all the named
3361 * properties of an object. 3361 * properties of an object.
3362 * \param data A piece of data that will be passed to the callbacks 3362 * \param data A piece of data that will be passed to the callbacks
3363 * whenever they are invoked. 3363 * whenever they are invoked.
3364 */ 3364 */
3365 // TODO(dcarney): deprecate 3365 V8_DEPRECATED(void SetNamedPropertyHandler(
3366 void SetNamedPropertyHandler(NamedPropertyGetter getter, 3366 NamedPropertyGetter getter,
3367 NamedPropertySetter setter = 0, 3367 NamedPropertySetter setter = 0,
3368 NamedPropertyQuery query = 0, 3368 NamedPropertyQuery query = 0,
3369 NamedPropertyDeleter deleter = 0, 3369 NamedPropertyDeleter deleter = 0,
3370 NamedPropertyEnumerator enumerator = 0, 3370 NamedPropertyEnumerator enumerator = 0,
3371 Handle<Value> data = Handle<Value>()); 3371 Handle<Value> data = Handle<Value>()));
3372 void SetNamedPropertyHandler( 3372 void SetNamedPropertyHandler(
3373 NamedPropertyGetterCallback getter, 3373 NamedPropertyGetterCallback getter,
3374 NamedPropertySetterCallback setter = 0, 3374 NamedPropertySetterCallback setter = 0,
3375 NamedPropertyQueryCallback query = 0, 3375 NamedPropertyQueryCallback query = 0,
3376 NamedPropertyDeleterCallback deleter = 0, 3376 NamedPropertyDeleterCallback deleter = 0,
3377 NamedPropertyEnumeratorCallback enumerator = 0, 3377 NamedPropertyEnumeratorCallback enumerator = 0,
3378 Handle<Value> data = Handle<Value>()); 3378 Handle<Value> data = Handle<Value>());
3379 3379
3380 /** 3380 /**
3381 * Sets an indexed property handler on the object template. 3381 * Sets an indexed property handler on the object template.
3382 * 3382 *
3383 * Whenever an indexed property is accessed on objects created from 3383 * Whenever an indexed property is accessed on objects created from
3384 * this object template, the provided callback is invoked instead of 3384 * this object template, the provided callback is invoked instead of
3385 * accessing the property directly on the JavaScript object. 3385 * accessing the property directly on the JavaScript object.
3386 * 3386 *
3387 * \param getter The callback to invoke when getting a property. 3387 * \param getter The callback to invoke when getting a property.
3388 * \param setter The callback to invoke when setting a property. 3388 * \param setter The callback to invoke when setting a property.
3389 * \param query The callback to invoke to check if an object has a property. 3389 * \param query The callback to invoke to check if an object has a property.
3390 * \param deleter The callback to invoke when deleting a property. 3390 * \param deleter The callback to invoke when deleting a property.
3391 * \param enumerator The callback to invoke to enumerate all the indexed 3391 * \param enumerator The callback to invoke to enumerate all the indexed
3392 * properties of an object. 3392 * properties of an object.
3393 * \param data A piece of data that will be passed to the callbacks 3393 * \param data A piece of data that will be passed to the callbacks
3394 * whenever they are invoked. 3394 * whenever they are invoked.
3395 */ 3395 */
3396 // TODO(dcarney): deprecate 3396 V8_DEPRECATED(void SetIndexedPropertyHandler(
3397 void SetIndexedPropertyHandler(IndexedPropertyGetter getter, 3397 IndexedPropertyGetter getter,
3398 IndexedPropertySetter setter = 0, 3398 IndexedPropertySetter setter = 0,
3399 IndexedPropertyQuery query = 0, 3399 IndexedPropertyQuery query = 0,
3400 IndexedPropertyDeleter deleter = 0, 3400 IndexedPropertyDeleter deleter = 0,
3401 IndexedPropertyEnumerator enumerator = 0, 3401 IndexedPropertyEnumerator enumerator = 0,
3402 Handle<Value> data = Handle<Value>()); 3402 Handle<Value> data = Handle<Value>()));
3403 void SetIndexedPropertyHandler( 3403 void SetIndexedPropertyHandler(
3404 IndexedPropertyGetterCallback getter, 3404 IndexedPropertyGetterCallback getter,
3405 IndexedPropertySetterCallback setter = 0, 3405 IndexedPropertySetterCallback setter = 0,
3406 IndexedPropertyQueryCallback query = 0, 3406 IndexedPropertyQueryCallback query = 0,
3407 IndexedPropertyDeleterCallback deleter = 0, 3407 IndexedPropertyDeleterCallback deleter = 0,
3408 IndexedPropertyEnumeratorCallback enumerator = 0, 3408 IndexedPropertyEnumeratorCallback enumerator = 0,
3409 Handle<Value> data = Handle<Value>()); 3409 Handle<Value> data = Handle<Value>());
3410 3410
3411 /** 3411 /**
3412 * Sets the callback to be used when calling instances created from 3412 * Sets the callback to be used when calling instances created from
3413 * this template as a function. If no callback is set, instances 3413 * this template as a function. If no callback is set, instances
3414 * behave like normal JavaScript objects that cannot be called as a 3414 * behave like normal JavaScript objects that cannot be called as a
3415 * function. 3415 * function.
3416 */ 3416 */
3417 // TODO(dcarney): deprecate 3417 V8_DEPRECATED(void SetCallAsFunctionHandler(
3418 void SetCallAsFunctionHandler(InvocationCallback callback, 3418 InvocationCallback callback,
3419 Handle<Value> data = Handle<Value>()); 3419 Handle<Value> data = Handle<Value>()));
3420 void SetCallAsFunctionHandler(FunctionCallback callback, 3420 void SetCallAsFunctionHandler(FunctionCallback callback,
3421 Handle<Value> data = Handle<Value>()); 3421 Handle<Value> data = Handle<Value>());
3422 3422
3423 /** 3423 /**
3424 * Mark object instances of the template as undetectable. 3424 * Mark object instances of the template as undetectable.
3425 * 3425 *
3426 * In many ways, undetectable objects behave as though they are not 3426 * In many ways, undetectable objects behave as though they are not
3427 * there. They behave like 'undefined' in conditionals and when 3427 * there. They behave like 'undefined' in conditionals and when
3428 * printed. However, properties can be accessed and called as on 3428 * printed. However, properties can be accessed and called as on
3429 * normal objects. 3429 * normal objects.
(...skipping 2935 matching lines...) Expand 10 before | Expand all | Expand 10 after
6365 6365
6366 6366
6367 } // namespace v8 6367 } // namespace v8
6368 6368
6369 6369
6370 #undef V8EXPORT 6370 #undef V8EXPORT
6371 #undef TYPE_CHECK 6371 #undef TYPE_CHECK
6372 6372
6373 6373
6374 #endif // V8_H_ 6374 #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