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

Side by Side Diff: include/v8.h

Issue 10442129: Implement implicit instance checks for API accessors. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 6 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/api.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 2271 matching lines...) Expand 10 before | Expand all | Expand 10 after
2282 */ 2282 */
2283 bool HasInstance(Handle<Value> object); 2283 bool HasInstance(Handle<Value> object);
2284 2284
2285 private: 2285 private:
2286 FunctionTemplate(); 2286 FunctionTemplate();
2287 void AddInstancePropertyAccessor(Handle<String> name, 2287 void AddInstancePropertyAccessor(Handle<String> name,
2288 AccessorGetter getter, 2288 AccessorGetter getter,
2289 AccessorSetter setter, 2289 AccessorSetter setter,
2290 Handle<Value> data, 2290 Handle<Value> data,
2291 AccessControl settings, 2291 AccessControl settings,
2292 PropertyAttribute attributes); 2292 PropertyAttribute attributes,
2293 Handle<FunctionTemplate> constructor);
2293 void SetNamedInstancePropertyHandler(NamedPropertyGetter getter, 2294 void SetNamedInstancePropertyHandler(NamedPropertyGetter getter,
2294 NamedPropertySetter setter, 2295 NamedPropertySetter setter,
2295 NamedPropertyQuery query, 2296 NamedPropertyQuery query,
2296 NamedPropertyDeleter remover, 2297 NamedPropertyDeleter remover,
2297 NamedPropertyEnumerator enumerator, 2298 NamedPropertyEnumerator enumerator,
2298 Handle<Value> data); 2299 Handle<Value> data);
2299 void SetIndexedInstancePropertyHandler(IndexedPropertyGetter getter, 2300 void SetIndexedInstancePropertyHandler(IndexedPropertyGetter getter,
2300 IndexedPropertySetter setter, 2301 IndexedPropertySetter setter,
2301 IndexedPropertyQuery query, 2302 IndexedPropertyQuery query,
2302 IndexedPropertyDeleter remover, 2303 IndexedPropertyDeleter remover,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2340 * \param settings Access control settings for the accessor. This is a bit 2341 * \param settings Access control settings for the accessor. This is a bit
2341 * field consisting of one of more of 2342 * field consisting of one of more of
2342 * DEFAULT = 0, ALL_CAN_READ = 1, or ALL_CAN_WRITE = 2. 2343 * DEFAULT = 0, ALL_CAN_READ = 1, or ALL_CAN_WRITE = 2.
2343 * The default is to not allow cross-context access. 2344 * The default is to not allow cross-context access.
2344 * ALL_CAN_READ means that all cross-context reads are allowed. 2345 * ALL_CAN_READ means that all cross-context reads are allowed.
2345 * ALL_CAN_WRITE means that all cross-context writes are allowed. 2346 * ALL_CAN_WRITE means that all cross-context writes are allowed.
2346 * The combination ALL_CAN_READ | ALL_CAN_WRITE can be used to allow all 2347 * The combination ALL_CAN_READ | ALL_CAN_WRITE can be used to allow all
2347 * cross-context access. 2348 * cross-context access.
2348 * \param attribute The attributes of the property for which an accessor 2349 * \param attribute The attributes of the property for which an accessor
2349 * is added. 2350 * is added.
2351 * \param constructor The constructor used to perform an implicit instance
2352 * check against. If the receiver is incompatible (i.e. is not an instance
2353 * of the constructor as defined by FunctionTemplate::HasInstance()), an
2354 * implicit TypeError is thrown and no callback is invoked.
2350 */ 2355 */
2351 void SetAccessor(Handle<String> name, 2356 void SetAccessor(Handle<String> name,
2352 AccessorGetter getter, 2357 AccessorGetter getter,
2353 AccessorSetter setter = 0, 2358 AccessorSetter setter = 0,
2354 Handle<Value> data = Handle<Value>(), 2359 Handle<Value> data = Handle<Value>(),
2355 AccessControl settings = DEFAULT, 2360 AccessControl settings = DEFAULT,
2356 PropertyAttribute attribute = None); 2361 PropertyAttribute attribute = None,
2362 Handle<FunctionTemplate> constructor =
Michael Starzinger 2012/06/01 13:19:43 As discussed offline, we might want to wrap this F
Michael Starzinger 2012/06/04 11:34:34 Done.
2363 Handle<FunctionTemplate>());
2357 2364
2358 /** 2365 /**
2359 * Sets a named property handler on the object template. 2366 * Sets a named property handler on the object template.
2360 * 2367 *
2361 * Whenever a named property is accessed on objects created from 2368 * Whenever a named property is accessed on objects created from
2362 * this object template, the provided callback is invoked instead of 2369 * this object template, the provided callback is invoked instead of
2363 * accessing the property directly on the JavaScript object. 2370 * accessing the property directly on the JavaScript object.
2364 * 2371 *
2365 * \param getter The callback to invoke when getting a property. 2372 * \param getter The callback to invoke when getting a property.
2366 * \param setter The callback to invoke when setting a property. 2373 * \param setter The callback to invoke when setting a property.
(...skipping 2107 matching lines...) Expand 10 before | Expand all | Expand 10 after
4474 4481
4475 4482
4476 } // namespace v8 4483 } // namespace v8
4477 4484
4478 4485
4479 #undef V8EXPORT 4486 #undef V8EXPORT
4480 #undef TYPE_CHECK 4487 #undef TYPE_CHECK
4481 4488
4482 4489
4483 #endif // V8_H_ 4490 #endif // V8_H_
OLDNEW
« no previous file with comments | « no previous file | src/api.cc » ('j') | src/api.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698