Chromium Code Reviews| Index: Source/bindings/modules/v8/V8BindingForModules.cpp |
| diff --git a/Source/bindings/modules/v8/V8BindingForModules.cpp b/Source/bindings/modules/v8/V8BindingForModules.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3fef7fe0fe3201ccb199506895081ecbe66d60ac |
| --- /dev/null |
| +++ b/Source/bindings/modules/v8/V8BindingForModules.cpp |
| @@ -0,0 +1,34 @@ |
| +// Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "config.h" |
| +#include "bindings/modules/v8/V8BindingForModules.h" |
| + |
| +#include "bindings/core/v8/V8Binding.h" |
| +#include "modules/webdatabase/sqlite/SQLValue.h" |
| + |
| +namespace blink { |
| + |
| +Vector<SQLValue> toSQLValueArray(const Nullable<Vector<ScriptValue>>& values) |
|
Jens Widell
2015/03/05 13:54:37
I think toSQLValueArray(const Vector<ScriptValue>>
bashi
2015/03/06 00:52:58
We might want to have more generic one like follow
|
| +{ |
| + if (values.isNull()) |
| + return Vector<SQLValue>(); |
| + |
| + Vector<SQLValue> sqlValues; |
| + const Vector<ScriptValue>& arguments = values.get(); |
| + for (unsigned i = 0; i < arguments.size(); ++i) { |
| + const v8::Local<v8::Value>& arg = arguments[i].v8Value(); |
| + if (arg.IsEmpty() || arg->IsNull()) { |
| + sqlValues.append(SQLValue()); |
| + } else if (arg->IsNumber()) { |
| + sqlValues.append(SQLValue(arg->NumberValue())); |
| + } else { |
| + TOSTRING_DEFAULT(V8StringResource<>, stringValue, arg, Vector<SQLValue>()); |
|
Jens Widell
2015/03/05 13:54:38
Exception handling is wrong here. This function sh
|
| + sqlValues.append(SQLValue(stringValue)); |
| + } |
| + } |
| + return sqlValues; |
| +} |
| + |
| +} // namespace blink |