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 "V8TestCallback.h"
26 #include "ScriptExecutionContext.h"
27 #include "V8Binding.h"
30 #include "V8CustomVoidCallback.h"
31 #include "V8DOMStringList.h"
33 #include <wtf/GetPtr.h>
34 #include <wtf/RefCounted.h>
35 #include <wtf/RefPtr.h>
37 #include <wtf/Assertions.h>
41 V8TestCallback::V8TestCallback(v8::Local<v8::Object> callback, ScriptExecutionContext* context)
42 : ActiveDOMCallback(context)
43 , m_callback(v8::Persistent<v8::Object>::New(callback))
44 , m_worldContext(UseCurrentWorld)
48 V8TestCallback::~V8TestCallback()
55 bool V8TestCallback::callbackWithNoParam()
57 if (!canInvokeCallback())
60 v8::HandleScope handleScope;
62 v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_worldContext);
63 if (v8Context.IsEmpty())
66 v8::Context::Scope scope(v8Context);
69 v8::Handle<v8::Value> *argv = 0;
71 bool callbackReturnValue = false;
72 return !invokeCallback(m_callback, 0, argv, callbackReturnValue, scriptExecutionContext());
75 bool V8TestCallback::callbackWithClass1Param(Class1* class1Param)
77 if (!canInvokeCallback())
80 v8::HandleScope handleScope;
82 v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_worldContext);
83 if (v8Context.IsEmpty())
86 v8::Context::Scope scope(v8Context);
88 v8::Handle<v8::Value> class1ParamHandle = toV8(class1Param);
89 if (class1ParamHandle.IsEmpty()) {
94 v8::Handle<v8::Value> argv[] = {
98 bool callbackReturnValue = false;
99 return !invokeCallback(m_callback, 1, argv, callbackReturnValue, scriptExecutionContext());
102 bool V8TestCallback::callbackWithClass2Param(Class2* class2Param, const String& strArg)
104 if (!canInvokeCallback())
107 v8::HandleScope handleScope;
109 v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_worldContext);
110 if (v8Context.IsEmpty())
113 v8::Context::Scope scope(v8Context);
115 v8::Handle<v8::Value> class2ParamHandle = toV8(class2Param);
116 if (class2ParamHandle.IsEmpty()) {
120 v8::Handle<v8::Value> strArgHandle = v8String(strArg);
121 if (strArgHandle.IsEmpty()) {
126 v8::Handle<v8::Value> argv[] = {
131 bool callbackReturnValue = false;
132 return !invokeCallback(m_callback, 2, argv, callbackReturnValue, scriptExecutionContext());
135 bool V8TestCallback::callbackWithStringList(RefPtr<DOMStringList> listParam)
137 if (!canInvokeCallback())
140 v8::HandleScope handleScope;
142 v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_worldContext);
143 if (v8Context.IsEmpty())
146 v8::Context::Scope scope(v8Context);
148 v8::Handle<v8::Value> listParamHandle = toV8(listParam);
149 if (listParamHandle.IsEmpty()) {
154 v8::Handle<v8::Value> argv[] = {
158 bool callbackReturnValue = false;
159 return !invokeCallback(m_callback, 1, argv, callbackReturnValue, scriptExecutionContext());
162 } // namespace WebCore
164 #endif // ENABLE(DATABASE)