diff options
author | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-09-01 19:18:36 (GMT) |
---|---|---|
committer | Stefan Radomski <radomski@tk.informatik.tu-darmstadt.de> | 2013-09-01 19:18:36 (GMT) |
commit | fd0778237785840ec754f98e847a524590cbf61c (patch) | |
tree | ebf4609be11843f9657810515d47faa3873c2db8 /src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int8Array.h | |
parent | 99d2c52f1068b2dd4bd16b8c1c8231beeb94a649 (diff) | |
download | uscxml-fd0778237785840ec754f98e847a524590cbf61c.zip uscxml-fd0778237785840ec754f98e847a524590cbf61c.tar.gz uscxml-fd0778237785840ec754f98e847a524590cbf61c.tar.bz2 |
More work on TypedArrays
Diffstat (limited to 'src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int8Array.h')
-rw-r--r-- | src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int8Array.h | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int8Array.h b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int8Array.h index bcfcc3c..2802c5f 100644 --- a/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int8Array.h +++ b/src/uscxml/plugins/datamodel/ecmascript/v8/dom/V8Int8Array.h @@ -24,6 +24,7 @@ #include <string> #include "../../TypedArray.h" #include "DOM/Node.hpp" +#include "V8ArrayBufferView.h" #include "string" #include "uscxml/plugins/datamodel/ecmascript/v8/V8DOM.h" #include <v8.h> @@ -46,6 +47,18 @@ public: static v8::Handle<v8::Value> subarrayCallback(const v8::Arguments&); static v8::Handle<v8::Value> lengthAttrGetter(v8::Local<v8::String> property, const v8::AccessorInfo& info); + static v8::Handle<v8::Value> indexedPropertyCustomGetter(uint32_t, const v8::AccessorInfo&); + static v8::Handle<v8::Value> indexedPropertyCustomSetter(uint32_t, v8::Local<v8::Value>, const v8::AccessorInfo&); + + static v8::Handle<v8::Value> constructor(const v8::Arguments&); + static v8::Persistent<v8::FunctionTemplate> Constr; + static v8::Handle<v8::FunctionTemplate> getConstructor() { + if (Constr.IsEmpty()) { + v8::Handle<v8::FunctionTemplate> constr = v8::FunctionTemplate::New(constructor); + Constr = v8::Persistent<v8::FunctionTemplate>::New(constr); + } + return Constr; + } static v8::Persistent<v8::FunctionTemplate> Tmpl; static v8::Handle<v8::FunctionTemplate> getTmpl() { @@ -63,20 +76,18 @@ public: instance->SetAccessor(v8::String::NewSymbol("length"), V8Int8Array::lengthAttrGetter, 0, v8::External::New(0), static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None)); + instance->SetIndexedPropertyHandler(V8Int8Array::indexedPropertyCustomGetter, V8Int8Array::indexedPropertyCustomSetter); prototype->Set(v8::String::NewSymbol("get"), v8::FunctionTemplate::New(V8Int8Array::getCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); prototype->Set(v8::String::NewSymbol("set"), v8::FunctionTemplate::New(V8Int8Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); - prototype->Set(v8::String::NewSymbol("set"), - v8::FunctionTemplate::New(V8Int8Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); - prototype->Set(v8::String::NewSymbol("set"), - v8::FunctionTemplate::New(V8Int8Array::setCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); prototype->Set(v8::String::NewSymbol("subarray"), v8::FunctionTemplate::New(V8Int8Array::subarrayCallback, v8::Undefined()), static_cast<v8::PropertyAttribute>(v8::DontDelete)); tmpl->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); prototype->Set(v8::String::NewSymbol("BYTES_PER_ELEMENT"), v8::Integer::New(1), static_cast<v8::PropertyAttribute>(v8::ReadOnly | v8::DontEnum)); + tmpl->Inherit(V8ArrayBufferView::getTmpl()); Tmpl = v8::Persistent<v8::FunctionTemplate>::New(tmpl); } return Tmpl; |