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

Side by Side Diff: include/v8.h

Issue 3101001: First phase of migration to new indexed property query callbacks. (Closed)
Patch Set: Addressing Mads' comments Created 10 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
« 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 2007-2009 the V8 project authors. All rights reserved. 1 // Copyright 2007-2009 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 1806 matching lines...) Expand 10 before | Expand all | Expand 10 after
1817 * Returns the value if the setter intercepts the request. 1817 * Returns the value if the setter intercepts the request.
1818 * Otherwise, returns an empty handle. 1818 * Otherwise, returns an empty handle.
1819 */ 1819 */
1820 typedef Handle<Value> (*IndexedPropertySetter)(uint32_t index, 1820 typedef Handle<Value> (*IndexedPropertySetter)(uint32_t index,
1821 Local<Value> value, 1821 Local<Value> value,
1822 const AccessorInfo& info); 1822 const AccessorInfo& info);
1823 1823
1824 1824
1825 /** 1825 /**
1826 * Returns a non-empty handle if the interceptor intercepts the request. 1826 * Returns a non-empty handle if the interceptor intercepts the request.
1827 * The result is true if the property exists and false otherwise. 1827 * The result is true if either a boolean (true if property exists and false
1828 * otherwise) or an integer encoding property attributes.
1828 */ 1829 */
1830 #ifdef USE_NEW_QUERY_CALLBACKS
1831 typedef Handle<Integer> (*IndexedPropertyQuery)(uint32_t index,
1832 const AccessorInfo& info);
1833 #else
1829 typedef Handle<Boolean> (*IndexedPropertyQuery)(uint32_t index, 1834 typedef Handle<Boolean> (*IndexedPropertyQuery)(uint32_t index,
1830 const AccessorInfo& info); 1835 const AccessorInfo& info);
1836 #endif
1837
1838 typedef Handle<Value> (*IndexedPropertyQueryImpl)(uint32_t index,
1839 const AccessorInfo& info);
1831 1840
1832 /** 1841 /**
1833 * Returns a non-empty handle if the deleter intercepts the request. 1842 * Returns a non-empty handle if the deleter intercepts the request.
1834 * The return value is true if the property could be deleted and false 1843 * The return value is true if the property could be deleted and false
1835 * otherwise. 1844 * otherwise.
1836 */ 1845 */
1837 typedef Handle<Boolean> (*IndexedPropertyDeleter)(uint32_t index, 1846 typedef Handle<Boolean> (*IndexedPropertyDeleter)(uint32_t index,
1838 const AccessorInfo& info); 1847 const AccessorInfo& info);
1839 1848
1840 /** 1849 /**
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
2038 NamedPropertySetter setter, 2047 NamedPropertySetter setter,
2039 NamedPropertyQuery query, 2048 NamedPropertyQuery query,
2040 NamedPropertyDeleter remover, 2049 NamedPropertyDeleter remover,
2041 NamedPropertyEnumerator enumerator, 2050 NamedPropertyEnumerator enumerator,
2042 Handle<Value> data); 2051 Handle<Value> data);
2043 void SetIndexedInstancePropertyHandler(IndexedPropertyGetter getter, 2052 void SetIndexedInstancePropertyHandler(IndexedPropertyGetter getter,
2044 IndexedPropertySetter setter, 2053 IndexedPropertySetter setter,
2045 IndexedPropertyQuery query, 2054 IndexedPropertyQuery query,
2046 IndexedPropertyDeleter remover, 2055 IndexedPropertyDeleter remover,
2047 IndexedPropertyEnumerator enumerator, 2056 IndexedPropertyEnumerator enumerator,
2048 Handle<Value> data); 2057 Handle<Value> data) {
2058 IndexedPropertyQueryImpl casted =
2059 reinterpret_cast<IndexedPropertyQueryImpl>(query);
2060 SetIndexedInstancePropertyHandlerImpl(getter,
2061 setter,
2062 casted,
2063 remover,
2064 enumerator,
2065 data);
2066 }
2067 void SetIndexedInstancePropertyHandlerImpl(
2068 IndexedPropertyGetter getter,
2069 IndexedPropertySetter setter,
2070 IndexedPropertyQueryImpl query,
2071 IndexedPropertyDeleter remover,
2072 IndexedPropertyEnumerator enumerator,
2073 Handle<Value> data);
2049 void SetInstanceCallAsFunctionHandler(InvocationCallback callback, 2074 void SetInstanceCallAsFunctionHandler(InvocationCallback callback,
2050 Handle<Value> data); 2075 Handle<Value> data);
2051 2076
2052 friend class Context; 2077 friend class Context;
2053 friend class ObjectTemplate; 2078 friend class ObjectTemplate;
2054 }; 2079 };
2055 2080
2056 2081
2057 /** 2082 /**
2058 * An ObjectTemplate is used to create objects at runtime. 2083 * An ObjectTemplate is used to create objects at runtime.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
2137 * \param enumerator The callback to invoke to enumerate all the indexed 2162 * \param enumerator The callback to invoke to enumerate all the indexed
2138 * properties of an object. 2163 * properties of an object.
2139 * \param data A piece of data that will be passed to the callbacks 2164 * \param data A piece of data that will be passed to the callbacks
2140 * whenever they are invoked. 2165 * whenever they are invoked.
2141 */ 2166 */
2142 void SetIndexedPropertyHandler(IndexedPropertyGetter getter, 2167 void SetIndexedPropertyHandler(IndexedPropertyGetter getter,
2143 IndexedPropertySetter setter = 0, 2168 IndexedPropertySetter setter = 0,
2144 IndexedPropertyQuery query = 0, 2169 IndexedPropertyQuery query = 0,
2145 IndexedPropertyDeleter deleter = 0, 2170 IndexedPropertyDeleter deleter = 0,
2146 IndexedPropertyEnumerator enumerator = 0, 2171 IndexedPropertyEnumerator enumerator = 0,
2147 Handle<Value> data = Handle<Value>()); 2172 Handle<Value> data = Handle<Value>()) {
2173 IndexedPropertyQueryImpl casted =
2174 reinterpret_cast<IndexedPropertyQueryImpl>(query);
2175 SetIndexedPropertyHandlerImpl(getter,
2176 setter,
2177 casted,
2178 deleter,
2179 enumerator,
2180 data);
2181 }
2182 private:
2183 void SetIndexedPropertyHandlerImpl(IndexedPropertyGetter getter,
2184 IndexedPropertySetter setter,
2185 IndexedPropertyQueryImpl query,
2186 IndexedPropertyDeleter deleter,
2187 IndexedPropertyEnumerator enumerator,
2188 Handle<Value> data);
2189 public:
2190
2148 /** 2191 /**
2149 * Sets the callback to be used when calling instances created from 2192 * Sets the callback to be used when calling instances created from
2150 * this template as a function. If no callback is set, instances 2193 * this template as a function. If no callback is set, instances
2151 * behave like normal JavaScript objects that cannot be called as a 2194 * behave like normal JavaScript objects that cannot be called as a
2152 * function. 2195 * function.
2153 */ 2196 */
2154 void SetCallAsFunctionHandler(InvocationCallback callback, 2197 void SetCallAsFunctionHandler(InvocationCallback callback,
2155 Handle<Value> data = Handle<Value>()); 2198 Handle<Value> data = Handle<Value>());
2156 2199
2157 /** 2200 /**
(...skipping 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after
3612 3655
3613 3656
3614 } // namespace v8 3657 } // namespace v8
3615 3658
3616 3659
3617 #undef V8EXPORT 3660 #undef V8EXPORT
3618 #undef TYPE_CHECK 3661 #undef TYPE_CHECK
3619 3662
3620 3663
3621 #endif // V8_H_ 3664 #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