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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index b22e3d1f4bb50e37ecad2ebdbf8052629fc76bb0..20cef79a7f08f347f0a205ac037094af478a4bc9 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -1824,10 +1824,19 @@ typedef Handle<Value> (*IndexedPropertySetter)(uint32_t index,
/**
* Returns a non-empty handle if the interceptor intercepts the request.
- * The result is true if the property exists and false otherwise.
+ * The result is true if either a boolean (true if property exists and false
+ * otherwise) or an integer encoding property attributes.
*/
+#ifdef USE_NEW_QUERY_CALLBACKS
+typedef Handle<Integer> (*IndexedPropertyQuery)(uint32_t index,
+ const AccessorInfo& info);
+#else
typedef Handle<Boolean> (*IndexedPropertyQuery)(uint32_t index,
const AccessorInfo& info);
+#endif
+
+typedef Handle<Value> (*IndexedPropertyQueryImpl)(uint32_t index,
+ const AccessorInfo& info);
/**
* Returns a non-empty handle if the deleter intercepts the request.
@@ -2045,7 +2054,23 @@ class V8EXPORT FunctionTemplate : public Template {
IndexedPropertyQuery query,
IndexedPropertyDeleter remover,
IndexedPropertyEnumerator enumerator,
- Handle<Value> data);
+ Handle<Value> data) {
+ IndexedPropertyQueryImpl casted =
+ reinterpret_cast<IndexedPropertyQueryImpl>(query);
+ SetIndexedInstancePropertyHandlerImpl(getter,
+ setter,
+ casted,
+ remover,
+ enumerator,
+ data);
+ }
+ void SetIndexedInstancePropertyHandlerImpl(
+ IndexedPropertyGetter getter,
+ IndexedPropertySetter setter,
+ IndexedPropertyQueryImpl query,
+ IndexedPropertyDeleter remover,
+ IndexedPropertyEnumerator enumerator,
+ Handle<Value> data);
void SetInstanceCallAsFunctionHandler(InvocationCallback callback,
Handle<Value> data);
@@ -2144,7 +2169,25 @@ class V8EXPORT ObjectTemplate : public Template {
IndexedPropertyQuery query = 0,
IndexedPropertyDeleter deleter = 0,
IndexedPropertyEnumerator enumerator = 0,
- Handle<Value> data = Handle<Value>());
+ Handle<Value> data = Handle<Value>()) {
+ IndexedPropertyQueryImpl casted =
+ reinterpret_cast<IndexedPropertyQueryImpl>(query);
+ SetIndexedPropertyHandlerImpl(getter,
+ setter,
+ casted,
+ deleter,
+ enumerator,
+ data);
+ }
+ private:
+ void SetIndexedPropertyHandlerImpl(IndexedPropertyGetter getter,
+ IndexedPropertySetter setter,
+ IndexedPropertyQueryImpl query,
+ IndexedPropertyDeleter deleter,
+ IndexedPropertyEnumerator enumerator,
+ Handle<Value> data);
+ public:
+
/**
* Sets the callback to be used when calling instances created from
* this template as a function. If no callback is set, instances
« 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