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

Side by Side Diff: include/v8.h

Issue 23182003: Push SetAccessor to Template (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: missed something 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/api.cc » ('j') | src/factory.cc » ('J')
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 2100 matching lines...) Expand 10 before | Expand all | Expand 10 after
2111 AccessControl settings = DEFAULT, 2111 AccessControl settings = DEFAULT,
2112 PropertyAttribute attribute = None)); 2112 PropertyAttribute attribute = None));
2113 bool SetAccessor(Handle<String> name, 2113 bool SetAccessor(Handle<String> name,
2114 AccessorGetterCallback getter, 2114 AccessorGetterCallback getter,
2115 AccessorSetterCallback setter = 0, 2115 AccessorSetterCallback setter = 0,
2116 Handle<Value> data = Handle<Value>(), 2116 Handle<Value> data = Handle<Value>(),
2117 AccessControl settings = DEFAULT, 2117 AccessControl settings = DEFAULT,
2118 PropertyAttribute attribute = None); 2118 PropertyAttribute attribute = None);
2119 2119
2120 // This function is not yet stable and should not be used at this time. 2120 // This function is not yet stable and should not be used at this time.
2121 bool SetAccessor(Handle<String> name, 2121 bool SetDeclaredAccessor(Local<String> name,
2122 Handle<DeclaredAccessorDescriptor> descriptor, 2122 Local<DeclaredAccessorDescriptor> descriptor,
2123 AccessControl settings = DEFAULT, 2123 AccessControl settings = DEFAULT,
2124 PropertyAttribute attribute = None); 2124 PropertyAttribute attribute = None);
2125 2125
2126 /** 2126 /**
2127 * Returns an array containing the names of the enumerable properties 2127 * Returns an array containing the names of the enumerable properties
2128 * of this object, including properties from prototype objects. The 2128 * of this object, including properties from prototype objects. The
2129 * array returned by this method contains the same values as would 2129 * array returned by this method contains the same values as would
2130 * be enumerated by a for-in statement over this object. 2130 * be enumerated by a for-in statement over this object.
2131 */ 2131 */
2132 Local<Array> GetPropertyNames(); 2132 Local<Array> GetPropertyNames();
2133 2133
2134 /** 2134 /**
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after
2961 2961
2962 /** 2962 /**
2963 * The superclass of object and function templates. 2963 * The superclass of object and function templates.
2964 */ 2964 */
2965 class V8_EXPORT Template : public Data { 2965 class V8_EXPORT Template : public Data {
2966 public: 2966 public:
2967 /** Adds a property to each instance created by this template.*/ 2967 /** Adds a property to each instance created by this template.*/
2968 void Set(Handle<String> name, Handle<Data> value, 2968 void Set(Handle<String> name, Handle<Data> value,
2969 PropertyAttribute attributes = None); 2969 PropertyAttribute attributes = None);
2970 V8_INLINE(void Set(const char* name, Handle<Data> value)); 2970 V8_INLINE(void Set(const char* name, Handle<Data> value));
2971
2972 /**
2973 * Whenever the property with the given name is accessed on objects
2974 * created from this Template the getter and setter callbacks
2975 * are called instead of getting and setting the property directly
2976 * on the JavaScript object.
2977 *
2978 * \param name The name of the property for which an accessor is added.
2979 * \param getter The callback to invoke when getting the property.
2980 * \param setter The callback to invoke when setting the property.
2981 * \param data A piece of data that will be passed to the getter and setter
2982 * callbacks whenever they are invoked.
2983 * \param settings Access control settings for the accessor. This is a bit
2984 * field consisting of one of more of
2985 * DEFAULT = 0, ALL_CAN_READ = 1, or ALL_CAN_WRITE = 2.
2986 * The default is to not allow cross-context access.
2987 * ALL_CAN_READ means that all cross-context reads are allowed.
2988 * ALL_CAN_WRITE means that all cross-context writes are allowed.
2989 * The combination ALL_CAN_READ | ALL_CAN_WRITE can be used to allow all
2990 * cross-context access.
2991 * \param attribute The attributes of the property for which an accessor
2992 * is added.
2993 * \param signature The signature describes valid receivers for the accessor
2994 * and is used to perform implicit instance checks against them. If the
2995 * receiver is incompatible (i.e. is not an instance of the constructor as
2996 * defined by FunctionTemplate::HasInstance()), an implicit TypeError is
2997 * thrown and no callback is invoked.
2998 */
2999 void SetNativeDataProperty(Local<String> name,
3000 AccessorGetterCallback getter,
3001 AccessorSetterCallback setter = 0,
3002 // TODO(dcarney): gcc can't handle Local below
3003 Handle<Value> data = Handle<Value>(),
3004 AccessControl settings = DEFAULT,
3005 PropertyAttribute attribute = None,
3006 Local<AccessorSignature> signature =
3007 Local<AccessorSignature>());
3008
3009 // This function is not yet stable and should not be used at this time.
3010 bool SetDeclaredAccessor(Local<String> name,
3011 Local<DeclaredAccessorDescriptor> descriptor,
3012 AccessControl settings = DEFAULT,
3013 PropertyAttribute attribute = None,
3014 Local<AccessorSignature> signature =
3015 Local<AccessorSignature>());
3016
2971 private: 3017 private:
2972 Template(); 3018 Template();
2973 3019
2974 friend class ObjectTemplate; 3020 friend class ObjectTemplate;
2975 friend class FunctionTemplate; 3021 friend class FunctionTemplate;
2976 }; 3022 };
2977 3023
2978 3024
2979 template<typename T> 3025 template<typename T>
2980 class ReturnValue { 3026 class ReturnValue {
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
3477 Handle<AccessorSignature>())); 3523 Handle<AccessorSignature>()));
3478 void SetAccessor(Handle<String> name, 3524 void SetAccessor(Handle<String> name,
3479 AccessorGetterCallback getter, 3525 AccessorGetterCallback getter,
3480 AccessorSetterCallback setter = 0, 3526 AccessorSetterCallback setter = 0,
3481 Handle<Value> data = Handle<Value>(), 3527 Handle<Value> data = Handle<Value>(),
3482 AccessControl settings = DEFAULT, 3528 AccessControl settings = DEFAULT,
3483 PropertyAttribute attribute = None, 3529 PropertyAttribute attribute = None,
3484 Handle<AccessorSignature> signature = 3530 Handle<AccessorSignature> signature =
3485 Handle<AccessorSignature>()); 3531 Handle<AccessorSignature>());
3486 3532
3487 // This function is not yet stable and should not be used at this time.
3488 bool SetAccessor(Handle<String> name,
3489 Handle<DeclaredAccessorDescriptor> descriptor,
3490 AccessControl settings = DEFAULT,
3491 PropertyAttribute attribute = None,
3492 Handle<AccessorSignature> signature =
3493 Handle<AccessorSignature>());
3494
3495 /** 3533 /**
3496 * Sets a named property handler on the object template. 3534 * Sets a named property handler on the object template.
3497 * 3535 *
3498 * Whenever a named property is accessed on objects created from 3536 * Whenever a named property is accessed on objects created from
3499 * this object template, the provided callback is invoked instead of 3537 * this object template, the provided callback is invoked instead of
3500 * accessing the property directly on the JavaScript object. 3538 * accessing the property directly on the JavaScript object.
3501 * 3539 *
3502 * \param getter The callback to invoke when getting a property. 3540 * \param getter The callback to invoke when getting a property.
3503 * \param setter The callback to invoke when setting a property. 3541 * \param setter The callback to invoke when setting a property.
3504 * \param query The callback to invoke to check if a property is present, 3542 * \param query The callback to invoke to check if a property is present,
(...skipping 3072 matching lines...) Expand 10 before | Expand all | Expand 10 after
6577 */ 6615 */
6578 6616
6579 6617
6580 } // namespace v8 6618 } // namespace v8
6581 6619
6582 6620
6583 #undef TYPE_CHECK 6621 #undef TYPE_CHECK
6584 6622
6585 6623
6586 #endif // V8_H_ 6624 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | src/factory.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698