Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 2109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2120 AccessControl settings = DEFAULT, | 2120 AccessControl settings = DEFAULT, |
| 2121 PropertyAttribute attribute = None)); | 2121 PropertyAttribute attribute = None)); |
| 2122 bool SetAccessor(Handle<String> name, | 2122 bool SetAccessor(Handle<String> name, |
| 2123 AccessorGetterCallback getter, | 2123 AccessorGetterCallback getter, |
| 2124 AccessorSetterCallback setter = 0, | 2124 AccessorSetterCallback setter = 0, |
| 2125 Handle<Value> data = Handle<Value>(), | 2125 Handle<Value> data = Handle<Value>(), |
| 2126 AccessControl settings = DEFAULT, | 2126 AccessControl settings = DEFAULT, |
| 2127 PropertyAttribute attribute = None); | 2127 PropertyAttribute attribute = None); |
| 2128 | 2128 |
| 2129 // This function is not yet stable and should not be used at this time. | 2129 // This function is not yet stable and should not be used at this time. |
| 2130 bool SetAccessor(Handle<String> name, | 2130 bool SetDeclaredAccessor(Handle<String> name, |
| 2131 Handle<DeclaredAccessorDescriptor> descriptor, | 2131 Handle<DeclaredAccessorDescriptor> descriptor, |
| 2132 AccessControl settings = DEFAULT, | 2132 AccessControl settings = DEFAULT, |
| 2133 PropertyAttribute attribute = None); | 2133 PropertyAttribute attribute = None); |
| 2134 | 2134 |
| 2135 /** | 2135 /** |
| 2136 * Returns an array containing the names of the enumerable properties | 2136 * Returns an array containing the names of the enumerable properties |
| 2137 * of this object, including properties from prototype objects. The | 2137 * of this object, including properties from prototype objects. The |
| 2138 * array returned by this method contains the same values as would | 2138 * array returned by this method contains the same values as would |
| 2139 * be enumerated by a for-in statement over this object. | 2139 * be enumerated by a for-in statement over this object. |
| 2140 */ | 2140 */ |
| 2141 Local<Array> GetPropertyNames(); | 2141 Local<Array> GetPropertyNames(); |
| 2142 | 2142 |
| 2143 /** | 2143 /** |
| (...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2970 | 2970 |
| 2971 /** | 2971 /** |
| 2972 * The superclass of object and function templates. | 2972 * The superclass of object and function templates. |
| 2973 */ | 2973 */ |
| 2974 class V8_EXPORT Template : public Data { | 2974 class V8_EXPORT Template : public Data { |
| 2975 public: | 2975 public: |
| 2976 /** Adds a property to each instance created by this template.*/ | 2976 /** Adds a property to each instance created by this template.*/ |
| 2977 void Set(Handle<String> name, Handle<Data> value, | 2977 void Set(Handle<String> name, Handle<Data> value, |
| 2978 PropertyAttribute attributes = None); | 2978 PropertyAttribute attributes = None); |
| 2979 V8_INLINE(void Set(const char* name, Handle<Data> value)); | 2979 V8_INLINE(void Set(const char* name, Handle<Data> value)); |
| 2980 | |
| 2981 /** | |
| 2982 * Whenever the property with the given name is accessed on objects | |
| 2983 * created from this Template the getter and setter callbacks | |
| 2984 * are called instead of getting and setting the property directly | |
| 2985 * on the JavaScript object. | |
| 2986 * | |
| 2987 * \param name The name of the property for which an accessor is added. | |
| 2988 * \param getter The callback to invoke when getting the property. | |
| 2989 * \param setter The callback to invoke when setting the property. | |
| 2990 * \param data A piece of data that will be passed to the getter and setter | |
| 2991 * callbacks whenever they are invoked. | |
| 2992 * \param settings Access control settings for the accessor. This is a bit | |
| 2993 * field consisting of one of more of | |
| 2994 * DEFAULT = 0, ALL_CAN_READ = 1, or ALL_CAN_WRITE = 2. | |
| 2995 * The default is to not allow cross-context access. | |
| 2996 * ALL_CAN_READ means that all cross-context reads are allowed. | |
| 2997 * ALL_CAN_WRITE means that all cross-context writes are allowed. | |
| 2998 * The combination ALL_CAN_READ | ALL_CAN_WRITE can be used to allow all | |
| 2999 * cross-context access. | |
| 3000 * \param attribute The attributes of the property for which an accessor | |
| 3001 * is added. | |
| 3002 * \param signature The signature describes valid receivers for the accessor | |
| 3003 * and is used to perform implicit instance checks against them. If the | |
| 3004 * receiver is incompatible (i.e. is not an instance of the constructor as | |
| 3005 * defined by FunctionTemplate::HasInstance()), an implicit TypeError is | |
| 3006 * thrown and no callback is invoked. | |
| 3007 */ | |
| 3008 void SetNativeAccessor(Handle<String> name, | |
|
Michael Starzinger
2013/08/20 17:05:41
As discussed offline, the following naming scheme
| |
| 3009 AccessorGetterCallback getter, | |
| 3010 AccessorSetterCallback setter = 0, | |
| 3011 Handle<Value> data = Handle<Value>(), | |
| 3012 AccessControl settings = DEFAULT, | |
| 3013 PropertyAttribute attribute = None, | |
| 3014 Handle<AccessorSignature> signature = | |
| 3015 Handle<AccessorSignature>()); | |
| 3016 | |
| 3017 // This function is not yet stable and should not be used at this time. | |
| 3018 bool SetDeclaredAccessor(Handle<String> name, | |
| 3019 Handle<DeclaredAccessorDescriptor> descriptor, | |
| 3020 AccessControl settings = DEFAULT, | |
| 3021 PropertyAttribute attribute = None, | |
| 3022 Handle<AccessorSignature> signature = | |
| 3023 Handle<AccessorSignature>()); | |
| 3024 | |
| 2980 private: | 3025 private: |
| 2981 Template(); | 3026 Template(); |
| 2982 | 3027 |
| 2983 friend class ObjectTemplate; | 3028 friend class ObjectTemplate; |
| 2984 friend class FunctionTemplate; | 3029 friend class FunctionTemplate; |
| 2985 }; | 3030 }; |
| 2986 | 3031 |
| 2987 | 3032 |
| 2988 template<typename T> | 3033 template<typename T> |
| 2989 class ReturnValue { | 3034 class ReturnValue { |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3486 Handle<AccessorSignature>())); | 3531 Handle<AccessorSignature>())); |
| 3487 void SetAccessor(Handle<String> name, | 3532 void SetAccessor(Handle<String> name, |
| 3488 AccessorGetterCallback getter, | 3533 AccessorGetterCallback getter, |
| 3489 AccessorSetterCallback setter = 0, | 3534 AccessorSetterCallback setter = 0, |
| 3490 Handle<Value> data = Handle<Value>(), | 3535 Handle<Value> data = Handle<Value>(), |
| 3491 AccessControl settings = DEFAULT, | 3536 AccessControl settings = DEFAULT, |
| 3492 PropertyAttribute attribute = None, | 3537 PropertyAttribute attribute = None, |
| 3493 Handle<AccessorSignature> signature = | 3538 Handle<AccessorSignature> signature = |
| 3494 Handle<AccessorSignature>()); | 3539 Handle<AccessorSignature>()); |
| 3495 | 3540 |
| 3496 // This function is not yet stable and should not be used at this time. | |
| 3497 bool SetAccessor(Handle<String> name, | |
| 3498 Handle<DeclaredAccessorDescriptor> descriptor, | |
| 3499 AccessControl settings = DEFAULT, | |
| 3500 PropertyAttribute attribute = None, | |
| 3501 Handle<AccessorSignature> signature = | |
| 3502 Handle<AccessorSignature>()); | |
| 3503 | |
| 3504 /** | 3541 /** |
| 3505 * Sets a named property handler on the object template. | 3542 * Sets a named property handler on the object template. |
| 3506 * | 3543 * |
| 3507 * Whenever a named property is accessed on objects created from | 3544 * Whenever a named property is accessed on objects created from |
| 3508 * this object template, the provided callback is invoked instead of | 3545 * this object template, the provided callback is invoked instead of |
| 3509 * accessing the property directly on the JavaScript object. | 3546 * accessing the property directly on the JavaScript object. |
| 3510 * | 3547 * |
| 3511 * \param getter The callback to invoke when getting a property. | 3548 * \param getter The callback to invoke when getting a property. |
| 3512 * \param setter The callback to invoke when setting a property. | 3549 * \param setter The callback to invoke when setting a property. |
| 3513 * \param query The callback to invoke to check if a property is present, | 3550 * \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 Loading... | |
| 6586 */ | 6623 */ |
| 6587 | 6624 |
| 6588 | 6625 |
| 6589 } // namespace v8 | 6626 } // namespace v8 |
| 6590 | 6627 |
| 6591 | 6628 |
| 6592 #undef TYPE_CHECK | 6629 #undef TYPE_CHECK |
| 6593 | 6630 |
| 6594 | 6631 |
| 6595 #endif // V8_H_ | 6632 #endif // V8_H_ |
| OLD | NEW |