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

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: rebase, grokdump 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') | 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 2105 matching lines...) Expand 10 before | Expand all | Expand 10 after
2116 bool Delete(uint32_t index); 2116 bool Delete(uint32_t index);
2117 2117
2118 bool SetAccessor(Handle<String> name, 2118 bool SetAccessor(Handle<String> name,
2119 AccessorGetterCallback getter, 2119 AccessorGetterCallback getter,
2120 AccessorSetterCallback setter = 0, 2120 AccessorSetterCallback setter = 0,
2121 Handle<Value> data = Handle<Value>(), 2121 Handle<Value> data = Handle<Value>(),
2122 AccessControl settings = DEFAULT, 2122 AccessControl settings = DEFAULT,
2123 PropertyAttribute attribute = None); 2123 PropertyAttribute attribute = None);
2124 2124
2125 // This function is not yet stable and should not be used at this time. 2125 // This function is not yet stable and should not be used at this time.
2126 bool SetAccessor(Handle<String> name, 2126 bool SetDeclaredAccessor(Local<String> name,
2127 Handle<DeclaredAccessorDescriptor> descriptor, 2127 Local<DeclaredAccessorDescriptor> descriptor,
2128 AccessControl settings = DEFAULT, 2128 PropertyAttribute attribute = None,
2129 PropertyAttribute attribute = None); 2129 AccessControl settings = DEFAULT);
2130 2130
2131 /** 2131 /**
2132 * Returns an array containing the names of the enumerable properties 2132 * Returns an array containing the names of the enumerable properties
2133 * of this object, including properties from prototype objects. The 2133 * of this object, including properties from prototype objects. The
2134 * array returned by this method contains the same values as would 2134 * array returned by this method contains the same values as would
2135 * be enumerated by a for-in statement over this object. 2135 * be enumerated by a for-in statement over this object.
2136 */ 2136 */
2137 Local<Array> GetPropertyNames(); 2137 Local<Array> GetPropertyNames();
2138 2138
2139 /** 2139 /**
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
2974 PropertyAttribute attributes = None); 2974 PropertyAttribute attributes = None);
2975 V8_INLINE(void Set(const char* name, Handle<Data> value)); 2975 V8_INLINE(void Set(const char* name, Handle<Data> value));
2976 2976
2977 void SetAccessorProperty( 2977 void SetAccessorProperty(
2978 Local<String> name, 2978 Local<String> name,
2979 Local<FunctionTemplate> getter = Local<FunctionTemplate>(), 2979 Local<FunctionTemplate> getter = Local<FunctionTemplate>(),
2980 Local<FunctionTemplate> setter = Local<FunctionTemplate>(), 2980 Local<FunctionTemplate> setter = Local<FunctionTemplate>(),
2981 PropertyAttribute attribute = None, 2981 PropertyAttribute attribute = None,
2982 AccessControl settings = DEFAULT); 2982 AccessControl settings = DEFAULT);
2983 2983
2984 /**
2985 * Whenever the property with the given name is accessed on objects
2986 * created from this Template the getter and setter callbacks
2987 * are called instead of getting and setting the property directly
2988 * on the JavaScript object.
2989 *
2990 * \param name The name of the property for which an accessor is added.
2991 * \param getter The callback to invoke when getting the property.
2992 * \param setter The callback to invoke when setting the property.
2993 * \param data A piece of data that will be passed to the getter and setter
2994 * callbacks whenever they are invoked.
2995 * \param settings Access control settings for the accessor. This is a bit
2996 * field consisting of one of more of
2997 * DEFAULT = 0, ALL_CAN_READ = 1, or ALL_CAN_WRITE = 2.
2998 * The default is to not allow cross-context access.
2999 * ALL_CAN_READ means that all cross-context reads are allowed.
3000 * ALL_CAN_WRITE means that all cross-context writes are allowed.
3001 * The combination ALL_CAN_READ | ALL_CAN_WRITE can be used to allow all
3002 * cross-context access.
3003 * \param attribute The attributes of the property for which an accessor
3004 * is added.
3005 * \param signature The signature describes valid receivers for the accessor
3006 * and is used to perform implicit instance checks against them. If the
3007 * receiver is incompatible (i.e. is not an instance of the constructor as
3008 * defined by FunctionTemplate::HasInstance()), an implicit TypeError is
3009 * thrown and no callback is invoked.
3010 */
3011 void SetNativeDataProperty(Local<String> name,
3012 AccessorGetterCallback getter,
3013 AccessorSetterCallback setter = 0,
3014 // TODO(dcarney): gcc can't handle Local below
3015 Handle<Value> data = Handle<Value>(),
3016 PropertyAttribute attribute = None,
3017 Local<AccessorSignature> signature =
3018 Local<AccessorSignature>(),
3019 AccessControl settings = DEFAULT);
3020
3021 // This function is not yet stable and should not be used at this time.
3022 bool SetDeclaredAccessor(Local<String> name,
3023 Local<DeclaredAccessorDescriptor> descriptor,
3024 PropertyAttribute attribute = None,
3025 Local<AccessorSignature> signature =
3026 Local<AccessorSignature>(),
3027 AccessControl settings = DEFAULT);
3028
2984 private: 3029 private:
2985 Template(); 3030 Template();
2986 3031
2987 friend class ObjectTemplate; 3032 friend class ObjectTemplate;
2988 friend class FunctionTemplate; 3033 friend class FunctionTemplate;
2989 }; 3034 };
2990 3035
2991 3036
2992 template<typename T> 3037 template<typename T>
2993 class ReturnValue { 3038 class ReturnValue {
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
3440 */ 3485 */
3441 void SetAccessor(Handle<String> name, 3486 void SetAccessor(Handle<String> name,
3442 AccessorGetterCallback getter, 3487 AccessorGetterCallback getter,
3443 AccessorSetterCallback setter = 0, 3488 AccessorSetterCallback setter = 0,
3444 Handle<Value> data = Handle<Value>(), 3489 Handle<Value> data = Handle<Value>(),
3445 AccessControl settings = DEFAULT, 3490 AccessControl settings = DEFAULT,
3446 PropertyAttribute attribute = None, 3491 PropertyAttribute attribute = None,
3447 Handle<AccessorSignature> signature = 3492 Handle<AccessorSignature> signature =
3448 Handle<AccessorSignature>()); 3493 Handle<AccessorSignature>());
3449 3494
3450 // This function is not yet stable and should not be used at this time.
3451 bool SetAccessor(Handle<String> name,
3452 Handle<DeclaredAccessorDescriptor> descriptor,
3453 AccessControl settings = DEFAULT,
3454 PropertyAttribute attribute = None,
3455 Handle<AccessorSignature> signature =
3456 Handle<AccessorSignature>());
3457
3458 /** 3495 /**
3459 * Sets a named property handler on the object template. 3496 * Sets a named property handler on the object template.
3460 * 3497 *
3461 * Whenever a named property is accessed on objects created from 3498 * Whenever a named property is accessed on objects created from
3462 * this object template, the provided callback is invoked instead of 3499 * this object template, the provided callback is invoked instead of
3463 * accessing the property directly on the JavaScript object. 3500 * accessing the property directly on the JavaScript object.
3464 * 3501 *
3465 * \param getter The callback to invoke when getting a property. 3502 * \param getter The callback to invoke when getting a property.
3466 * \param setter The callback to invoke when setting a property. 3503 * \param setter The callback to invoke when setting a property.
3467 * \param query The callback to invoke to check if a property is present, 3504 * \param query The callback to invoke to check if a property is present,
(...skipping 3029 matching lines...) Expand 10 before | Expand all | Expand 10 after
6497 */ 6534 */
6498 6535
6499 6536
6500 } // namespace v8 6537 } // namespace v8
6501 6538
6502 6539
6503 #undef TYPE_CHECK 6540 #undef TYPE_CHECK
6504 6541
6505 6542
6506 #endif // V8_H_ 6543 #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