2 This file is part of the WebKit open source project.
3 This file has been generated by generate-bindings.pl. DO NOT MODIFY!
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
22 #include "V8Float64Array.h"
24 #include "ExceptionCode.h"
25 #include "RuntimeEnabledFeatures.h"
26 #include "V8ArrayBufferView.h"
27 #include "V8Binding.h"
28 #include "V8BindingMacros.h"
29 #include "V8BindingState.h"
30 #include "V8DOMWrapper.h"
31 #include "V8Float32Array.h"
32 #include "V8Int32Array.h"
33 #include "V8IsolatedContext.h"
35 #include <wtf/Float32Array.h>
36 #include <wtf/Float64Array.h>
37 #include <wtf/GetPtr.h>
38 #include <wtf/Int32Array.h>
39 #include <wtf/RefCounted.h>
40 #include <wtf/RefPtr.h>
41 #include <wtf/UnusedParam.h>
45 WrapperTypeInfo V8Float64Array::info = { V8Float64Array::GetTemplate, V8Float64Array::derefObject, 0, &V8ArrayBufferView::info };
47 namespace Float64ArrayInternal {
49 template <typename T> void V8_USE(T) { }
51 static v8::Handle<v8::Value> fooCallback(const v8::Arguments& args)
53 INC_STATS("DOM.Float64Array.foo");
54 if (args.Length() < 1)
55 return throwError("Not enough arguments", V8Proxy::TypeError);
56 Float64Array* imp = V8Float64Array::toNative(args.Holder());
57 EXCEPTION_BLOCK(Float32Array*, array, V8Float32Array::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined)) ? V8Float32Array::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, MissingIsUndefined))) : 0);
58 return toV8(imp->foo(array));
61 } // namespace Float64ArrayInternal
63 static v8::Persistent<v8::FunctionTemplate> ConfigureV8Float64ArrayTemplate(v8::Persistent<v8::FunctionTemplate> desc)
65 desc->ReadOnlyPrototype();
67 v8::Local<v8::Signature> defaultSignature;
68 defaultSignature = configureTemplate(desc, "Float64Array", V8ArrayBufferView::GetTemplate(), V8Float64Array::internalFieldCount,
71 UNUSED_PARAM(defaultSignature); // In some cases, it will not be used.
72 desc->SetCallHandler(V8Float64Array::constructorCallback);
73 v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate();
74 v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate();
75 UNUSED_PARAM(instance); // In some cases, it will not be used.
76 UNUSED_PARAM(proto); // In some cases, it will not be used.
79 // Custom Signature 'foo'
80 const int fooArgc = 1;
81 v8::Handle<v8::FunctionTemplate> fooArgv[fooArgc] = { V8Float32Array::GetRawTemplate() };
82 v8::Handle<v8::Signature> fooSignature = v8::Signature::New(desc, fooArgc, fooArgv);
83 proto->Set(v8::String::New("foo"), v8::FunctionTemplate::New(Float64ArrayInternal::fooCallback, v8::Handle<v8::Value>(), fooSignature));
85 // Custom toString template
86 desc->Set(getToStringName(), getToStringTemplate());
90 v8::Persistent<v8::FunctionTemplate> V8Float64Array::GetRawTemplate()
92 V8BindingPerIsolateData* data = V8BindingPerIsolateData::current();
93 V8BindingPerIsolateData::TemplateMap::iterator result = data->rawTemplateMap().find(&info);
94 if (result != data->rawTemplateMap().end())
95 return result->second;
97 v8::HandleScope handleScope;
98 v8::Persistent<v8::FunctionTemplate> templ = createRawTemplate();
99 data->rawTemplateMap().add(&info, templ);
103 v8::Persistent<v8::FunctionTemplate> V8Float64Array::GetTemplate()
105 V8BindingPerIsolateData* data = V8BindingPerIsolateData::current();
106 V8BindingPerIsolateData::TemplateMap::iterator result = data->templateMap().find(&info);
107 if (result != data->templateMap().end())
108 return result->second;
110 v8::HandleScope handleScope;
111 v8::Persistent<v8::FunctionTemplate> templ =
112 ConfigureV8Float64ArrayTemplate(GetRawTemplate());
113 data->templateMap().add(&info, templ);
117 bool V8Float64Array::HasInstance(v8::Handle<v8::Value> value)
119 return GetRawTemplate()->HasInstance(value);
123 v8::Handle<v8::Object> V8Float64Array::wrapSlow(Float64Array* impl)
125 v8::Handle<v8::Object> wrapper;
127 wrapper = V8DOMWrapper::instantiateV8Object(proxy, &info, impl);
128 if (wrapper.IsEmpty())
132 v8::Persistent<v8::Object> wrapperHandle = v8::Persistent<v8::Object>::New(wrapper);
134 if (!hasDependentLifetime)
135 wrapperHandle.MarkIndependent();
136 getDOMObjectMap().set(impl, wrapperHandle);
140 void V8Float64Array::derefObject(void* object)
142 static_cast<Float64Array*>(object)->deref();
145 } // namespace WebCore