| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 ScriptScope scope(m_scriptState); | 106 ScriptScope scope(m_scriptState); |
| 107 m_arguments.append(ScriptValue(v8::Number::New(isolate, argument), isolate))
; | 107 m_arguments.append(ScriptValue(v8::Number::New(isolate, argument), isolate))
; |
| 108 } | 108 } |
| 109 | 109 |
| 110 void ScriptCallArgumentHandler::appendArgument(bool argument) | 110 void ScriptCallArgumentHandler::appendArgument(bool argument) |
| 111 { | 111 { |
| 112 v8::Isolate* isolate = m_scriptState->isolate(); | 112 v8::Isolate* isolate = m_scriptState->isolate(); |
| 113 m_arguments.append(ScriptValue(v8Boolean(argument, isolate), isolate)); | 113 m_arguments.append(ScriptValue(v8Boolean(argument, isolate), isolate)); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void ScriptCallArgumentHandler::appendArgument(const Vector<ScriptValue>& argume
nt) |
| 117 { |
| 118 v8::Isolate* isolate = m_scriptState->isolate(); |
| 119 ScriptScope scope(m_scriptState); |
| 120 v8::Handle<v8::Array> result = v8::Array::New(isolate, argument.size()); |
| 121 for (size_t i = 0; i < argument.size(); ++i) |
| 122 result->Set(v8::Integer::New(isolate, i), argument[i].v8Value()); |
| 123 m_arguments.append(ScriptValue(result, isolate)); |
| 124 } |
| 125 |
| 116 ScriptFunctionCall::ScriptFunctionCall(const ScriptObject& thisObject, const Str
ing& name) | 126 ScriptFunctionCall::ScriptFunctionCall(const ScriptObject& thisObject, const Str
ing& name) |
| 117 : ScriptCallArgumentHandler(thisObject.scriptState()) | 127 : ScriptCallArgumentHandler(thisObject.scriptState()) |
| 118 , m_thisObject(thisObject) | 128 , m_thisObject(thisObject) |
| 119 , m_name(name) | 129 , m_name(name) |
| 120 { | 130 { |
| 121 } | 131 } |
| 122 | 132 |
| 123 ScriptValue ScriptFunctionCall::call(bool& hadException, bool reportExceptions) | 133 ScriptValue ScriptFunctionCall::call(bool& hadException, bool reportExceptions) |
| 124 { | 134 { |
| 125 ScriptScope scope(m_scriptState, reportExceptions); | 135 ScriptScope scope(m_scriptState, reportExceptions); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 | 212 |
| 203 OwnPtr<v8::Handle<v8::Value>[]> info = adoptArrayPtr(new v8::Handle<v8::Valu
e>[m_arguments.size()]); | 213 OwnPtr<v8::Handle<v8::Value>[]> info = adoptArrayPtr(new v8::Handle<v8::Valu
e>[m_arguments.size()]); |
| 204 for (size_t i = 0; i < m_arguments.size(); ++i) | 214 for (size_t i = 0; i < m_arguments.size(); ++i) |
| 205 info[i] = m_arguments[i].v8Value(); | 215 info[i] = m_arguments[i].v8Value(); |
| 206 | 216 |
| 207 v8::Handle<v8::Value> result = ScriptController::callFunction(m_scriptState-
>executionContext(), function, object, m_arguments.size(), info.get(), m_scriptS
tate->isolate()); | 217 v8::Handle<v8::Value> result = ScriptController::callFunction(m_scriptState-
>executionContext(), function, object, m_arguments.size(), info.get(), m_scriptS
tate->isolate()); |
| 208 return ScriptValue(result, m_scriptState->isolate()); | 218 return ScriptValue(result, m_scriptState->isolate()); |
| 209 } | 219 } |
| 210 | 220 |
| 211 } // namespace WebCore | 221 } // namespace WebCore |
| OLD | NEW |