aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/v8/qv8engine_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/qml/v8/qv8engine_p.h')
-rw-r--r--src/declarative/qml/v8/qv8engine_p.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/declarative/qml/v8/qv8engine_p.h b/src/declarative/qml/v8/qv8engine_p.h
index b29f465e95..46ba0a4431 100644
--- a/src/declarative/qml/v8/qv8engine_p.h
+++ b/src/declarative/qml/v8/qv8engine_p.h
@@ -128,11 +128,18 @@ public:
};
template<class T>
-T *v8_resource_cast(v8::Handle<v8::Object> object) {
+inline T *v8_resource_cast(v8::Handle<v8::Object> object) {
QV8ObjectResource *resource = static_cast<QV8ObjectResource *>(object->GetExternalResource());
return (resource && (quint32)resource->resourceType() == (quint32)T::V8ResourceType)?static_cast<T *>(resource):0;
}
+template<class T>
+inline T *v8_resource_check(v8::Handle<v8::Object> object) {
+ T *resource = static_cast<T *>(object->GetExternalResource());
+ Q_ASSERT(resource && resource->resourceType() == (quint32)T::V8ResourceType);
+ return resource;
+}
+
// Used to allow a QObject method take and return raw V8 handles without having to expose
// v8 in the public API.
// Use like this: