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"
29 #include "V8CustomVoidCallback.h"
30 #include "V8DOMString.h"
32 #include <wtf/GetPtr.h>
33 #include <wtf/RefCounted.h>
34 #include <wtf/RefPtr.h>
36 #include <wtf/Assertions.h>
40 V8TestCallback::V8TestCallback(v8::Local<v8::Object> callback, ScriptExecutionContext* context)
41 : ActiveDOMCallback(context)
42 , m_callback(v8::Persistent<v8::Object>::New(callback))
43 , m_worldContext(UseCurrentWorld)
47 V8TestCallback::~V8TestCallback()
54 bool V8TestCallback::callbackWithNoParam()
56 if (!canInvokeCallback())
59 v8::HandleScope handleScope;
61 v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_worldContext);
62 if (v8Context.IsEmpty())
65 v8::Context::Scope scope(v8Context);
68 v8::Handle<v8::Value> *argv = 0;
70 bool callbackReturnValue = false;
71 return !invokeCallback(m_callback, 0, argv, callbackReturnValue, scriptExecutionContext());
74 bool V8TestCallback::callbackWithClass1Param(Class1* class1Param)
76 if (!canInvokeCallback())
79 v8::HandleScope handleScope;
81 v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_worldContext);
82 if (v8Context.IsEmpty())
85 v8::Context::Scope scope(v8Context);
87 v8::Handle<v8::Value> class1ParamHandle = toV8(class1Param);
88 if (class1ParamHandle.IsEmpty()) {
93 v8::Handle<v8::Value> argv[] = {
97 bool callbackReturnValue = false;
98 return !invokeCallback(m_callback, 1, argv, callbackReturnValue, scriptExecutionContext());
101 bool V8TestCallback::callbackWithClass2Param(Class2* class2Param, const String& strArg)
103 if (!canInvokeCallback())
106 v8::HandleScope handleScope;
108 v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_worldContext);
109 if (v8Context.IsEmpty())
112 v8::Context::Scope scope(v8Context);
114 v8::Handle<v8::Value> class2ParamHandle = toV8(class2Param);
115 if (class2ParamHandle.IsEmpty()) {
119 v8::Handle<v8::Value> strArgHandle = v8String(strArg);
120 if (strArgHandle.IsEmpty()) {
125 v8::Handle<v8::Value> argv[] = {
130 bool callbackReturnValue = false;
131 return !invokeCallback(m_callback, 2, argv, callbackReturnValue, scriptExecutionContext());
134 } // namespace WebCore
136 #endif // ENABLE(DATABASE)