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

Unified Diff: include/v8.h

Issue 660243: Small API improvements: (Closed)
Patch Set: Created 10 years, 10 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') | src/runtime.cc » ('J')
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 e8b19ec635a6b639afd57cc5ba0ed130aad6b090..0992f0bfc8199d765d8a1ca2702bb9bf4f8bac45 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -261,6 +261,10 @@ template <class T> class V8EXPORT_INLINE Handle {
return Handle<T>(T::Cast(*that));
}
+ template <class S> inline Handle<S> As() {
+ return Handle<S>::Cast(*this);
+ }
+
private:
T* val_;
};
@@ -295,6 +299,10 @@ template <class T> class V8EXPORT_INLINE Local : public Handle<T> {
return Local<T>(T::Cast(*that));
}
+ template <class S> inline Local<S> As() {
+ return Local<S>::Cast(*this);
+ }
+
/** Create a local handle for the content of another handle.
* The referee is kept alive by the local handle even when
* the original handle is destroyed/disposed.
@@ -368,6 +376,10 @@ template <class T> class V8EXPORT_INLINE Persistent : public Handle<T> {
return Persistent<T>(T::Cast(*that));
}
+ template <class S> inline Persistent<S> As() {
+ return Persistent<S>::Cast(*this);
+ }
+
/**
* Creates a new persistent handle for an existing local or
* persistent handle.
@@ -1178,6 +1190,9 @@ class V8EXPORT Object : public Value {
Handle<Value> value,
PropertyAttribute attribs = None);
+ bool Set(uint32_t index,
+ Handle<Value> value);
+
// Sets a local property on this object bypassing interceptors and
// overriding accessors or read-only properties.
//
@@ -1192,6 +1207,8 @@ class V8EXPORT Object : public Value {
Local<Value> Get(Handle<Value> key);
+ Local<Value> Get(uint32_t index);
+
// TODO(1245389): Replace the type-specific versions of these
// functions with generic ones that accept a Handle<Value> key.
bool Has(Handle<String> key);
« no previous file with comments | « no previous file | src/api.cc » ('j') | src/runtime.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698