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

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: now with 50% fewer descriptor arrays Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/api.cc » ('j') | src/objects.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 2125 matching lines...) Expand 10 before | Expand all | Expand 10 after
2136 AccessControl settings = DEFAULT, 2136 AccessControl settings = DEFAULT,
2137 PropertyAttribute attribute = None)); 2137 PropertyAttribute attribute = None));
2138 bool SetAccessor(Handle<String> name, 2138 bool SetAccessor(Handle<String> name,
2139 AccessorGetterCallback getter, 2139 AccessorGetterCallback getter,
2140 AccessorSetterCallback setter = 0, 2140 AccessorSetterCallback setter = 0,
2141 Handle<Value> data = Handle<Value>(), 2141 Handle<Value> data = Handle<Value>(),
2142 AccessControl settings = DEFAULT, 2142 AccessControl settings = DEFAULT,
2143 PropertyAttribute attribute = None); 2143 PropertyAttribute attribute = None);
2144 2144
2145 // This function is not yet stable and should not be used at this time. 2145 // This function is not yet stable and should not be used at this time.
2146 bool SetAccessor(Handle<String> name, 2146 bool SetDeclaredAccessor(Local<String> name,
2147 Handle<DeclaredAccessorDescriptor> descriptor, 2147 Local<DeclaredAccessorDescriptor> descriptor,
2148 AccessControl settings = DEFAULT, 2148 AccessControl settings = DEFAULT,
2149 PropertyAttribute attribute = None); 2149 PropertyAttribute attribute = None);
2150 2150
2151 /** 2151 /**
2152 * Returns an array containing the names of the enumerable properties 2152 * Returns an array containing the names of the enumerable properties
2153 * of this object, including properties from prototype objects. The 2153 * of this object, including properties from prototype objects. The
2154 * array returned by this method contains the same values as would 2154 * array returned by this method contains the same values as would
2155 * be enumerated by a for-in statement over this object. 2155 * be enumerated by a for-in statement over this object.
2156 */ 2156 */
2157 Local<Array> GetPropertyNames(); 2157 Local<Array> GetPropertyNames();
2158 2158
2159 /** 2159 /**
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after
2986 2986
2987 /** 2987 /**
2988 * The superclass of object and function templates. 2988 * The superclass of object and function templates.
2989 */ 2989 */
2990 class V8_EXPORT Template : public Data { 2990 class V8_EXPORT Template : public Data {
2991 public: 2991 public:
2992 /** Adds a property to each instance created by this template.*/ 2992 /** Adds a property to each instance created by this template.*/
2993 void Set(Handle<String> name, Handle<Data> value, 2993 void Set(Handle<String> name, Handle<Data> value,
2994 PropertyAttribute attributes = None); 2994 PropertyAttribute attributes = None);
2995 V8_INLINE(void Set(const char* name, Handle<Data> value)); 2995 V8_INLINE(void Set(const char* name, Handle<Data> value));
2996
2997 /**
2998 * Whenever the property with the given name is accessed on objects
2999 * created from this Template the getter and setter callbacks
3000 * are called instead of getting and setting the property directly
3001 * on the JavaScript object.
3002 *
3003 * \param name The name of the property for which an accessor is added.
3004 * \param getter The callback to invoke when getting the property.
3005 * \param setter The callback to invoke when setting the property.
3006 * \param data A piece of data that will be passed to the getter and setter
3007 * callbacks whenever they are invoked.
3008 * \param settings Access control settings for the accessor. This is a bit
3009 * field consisting of one of more of
3010 * DEFAULT = 0, ALL_CAN_READ = 1, or ALL_CAN_WRITE = 2.
3011 * The default is to not allow cross-context access.
3012 * ALL_CAN_READ means that all cross-context reads are allowed.
3013 * ALL_CAN_WRITE means that all cross-context writes are allowed.
3014 * The combination ALL_CAN_READ | ALL_CAN_WRITE can be used to allow all
3015 * cross-context access.
3016 * \param attribute The attributes of the property for which an accessor
3017 * is added.
3018 * \param signature The signature describes valid receivers for the accessor
3019 * and is used to perform implicit instance checks against them. If the
3020 * receiver is incompatible (i.e. is not an instance of the constructor as
3021 * defined by FunctionTemplate::HasInstance()), an implicit TypeError is
3022 * thrown and no callback is invoked.
3023 */
3024 void SetNativeDataProperty(Local<String> name,
3025 AccessorGetterCallback getter,
3026 AccessorSetterCallback setter = 0,
3027 // TODO(dcarney): gcc can't handle Local below
3028 Handle<Value> data = Handle<Value>(),
3029 AccessControl settings = DEFAULT,
3030 PropertyAttribute attribute = None,
3031 Local<AccessorSignature> signature =
3032 Local<AccessorSignature>());
3033
3034 // This function is not yet stable and should not be used at this time.
3035 bool SetDeclaredAccessor(Local<String> name,
3036 Local<DeclaredAccessorDescriptor> descriptor,
3037 AccessControl settings = DEFAULT,
3038 PropertyAttribute attribute = None,
3039 Local<AccessorSignature> signature =
3040 Local<AccessorSignature>());
3041
2996 private: 3042 private:
2997 Template(); 3043 Template();
2998 3044
2999 friend class ObjectTemplate; 3045 friend class ObjectTemplate;
3000 friend class FunctionTemplate; 3046 friend class FunctionTemplate;
3001 }; 3047 };
3002 3048
3003 3049
3004 template<typename T> 3050 template<typename T>
3005 class ReturnValue { 3051 class ReturnValue {
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
3502 Handle<AccessorSignature>())); 3548 Handle<AccessorSignature>()));
3503 void SetAccessor(Handle<String> name, 3549 void SetAccessor(Handle<String> name,
3504 AccessorGetterCallback getter, 3550 AccessorGetterCallback getter,
3505 AccessorSetterCallback setter = 0, 3551 AccessorSetterCallback setter = 0,
3506 Handle<Value> data = Handle<Value>(), 3552 Handle<Value> data = Handle<Value>(),
3507 AccessControl settings = DEFAULT, 3553 AccessControl settings = DEFAULT,
3508 PropertyAttribute attribute = None, 3554 PropertyAttribute attribute = None,
3509 Handle<AccessorSignature> signature = 3555 Handle<AccessorSignature> signature =
3510 Handle<AccessorSignature>()); 3556 Handle<AccessorSignature>());
3511 3557
3512 // This function is not yet stable and should not be used at this time.
3513 bool SetAccessor(Handle<String> name,
3514 Handle<DeclaredAccessorDescriptor> descriptor,
3515 AccessControl settings = DEFAULT,
3516 PropertyAttribute attribute = None,
3517 Handle<AccessorSignature> signature =
3518 Handle<AccessorSignature>());
3519
3520 /** 3558 /**
3521 * Sets a named property handler on the object template. 3559 * Sets a named property handler on the object template.
3522 * 3560 *
3523 * Whenever a named property is accessed on objects created from 3561 * Whenever a named property is accessed on objects created from
3524 * this object template, the provided callback is invoked instead of 3562 * this object template, the provided callback is invoked instead of
3525 * accessing the property directly on the JavaScript object. 3563 * accessing the property directly on the JavaScript object.
3526 * 3564 *
3527 * \param getter The callback to invoke when getting a property. 3565 * \param getter The callback to invoke when getting a property.
3528 * \param setter The callback to invoke when setting a property. 3566 * \param setter The callback to invoke when setting a property.
3529 * \param query The callback to invoke to check if a property is present, 3567 * \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
6602 */ 6640 */
6603 6641
6604 6642
6605 } // namespace v8 6643 } // namespace v8
6606 6644
6607 6645
6608 #undef TYPE_CHECK 6646 #undef TYPE_CHECK
6609 6647
6610 6648
6611 #endif // V8_H_ 6649 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698