| Index: third_party/WebKit/Source/bindings/core/v8/ToV8.h
|
| diff --git a/third_party/WebKit/Source/bindings/core/v8/ToV8.h b/third_party/WebKit/Source/bindings/core/v8/ToV8.h
|
| index 497deccc3af590703b7293ec67b9c0835d1cfb38..6c7c80ad5e1b7cc64d579ab38df5dd85bc4d77d8 100644
|
| --- a/third_party/WebKit/Source/bindings/core/v8/ToV8.h
|
| +++ b/third_party/WebKit/Source/bindings/core/v8/ToV8.h
|
| @@ -245,6 +245,24 @@ inline v8::Local<v8::Value> toV8(const Vector<std::pair<String, T>>& value, v8::
|
| return object;
|
| }
|
|
|
| +template <typename T>
|
| +inline v8::Local<v8::Value> toV8(const HeapVector<std::pair<String, T>>& value, v8::Local<v8::Object> creationContext, v8::Isolate* isolate)
|
| +{
|
| + v8::Local<v8::Object> object;
|
| + {
|
| + v8::Context::Scope contextScope(creationContext->CreationContext());
|
| + object = v8::Object::New(isolate);
|
| + }
|
| + for (unsigned i = 0; i < value.size(); ++i) {
|
| + v8::Local<v8::Value> v8Value = toV8(value[i].second, object, isolate);
|
| + if (v8Value.IsEmpty())
|
| + v8Value = v8::Undefined(isolate);
|
| + if (!v8CallBoolean(object->CreateDataProperty(isolate->GetCurrentContext(), v8String(isolate, value[i].first), v8Value)))
|
| + return v8::Local<v8::Value>();
|
| + }
|
| + return object;
|
| +}
|
| +
|
| // In all cases allow script state instead of creation context + isolate.
|
| // Use this function only if the call site does not otherwise need the global,
|
| // since v8::Context::Global is heavy.
|
|
|