OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ToV8_h | 5 #ifndef ToV8_h |
6 #define ToV8_h | 6 #define ToV8_h |
7 | 7 |
8 #include "bindings/core/v8/DOMDataStore.h" | 8 #include "bindings/core/v8/DOMDataStore.h" |
9 #include "bindings/core/v8/ScriptValue.h" | 9 #include "bindings/core/v8/ScriptValue.h" |
10 #include "bindings/core/v8/ScriptWrappable.h" | 10 #include "bindings/core/v8/ScriptWrappable.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 { | 209 { |
210 return toV8SequenceInternal(value, creationContext, isolate); | 210 return toV8SequenceInternal(value, creationContext, isolate); |
211 } | 211 } |
212 | 212 |
213 template<typename T, size_t inlineCapacity> | 213 template<typename T, size_t inlineCapacity> |
214 inline v8::Handle<v8::Value> toV8(const HeapVector<T, inlineCapacity>& value, v8
::Handle<v8::Object> creationContext, v8::Isolate* isolate) | 214 inline v8::Handle<v8::Value> toV8(const HeapVector<T, inlineCapacity>& value, v8
::Handle<v8::Object> creationContext, v8::Isolate* isolate) |
215 { | 215 { |
216 return toV8SequenceInternal(value, creationContext, isolate); | 216 return toV8SequenceInternal(value, creationContext, isolate); |
217 } | 217 } |
218 | 218 |
| 219 template<typename T> |
| 220 inline v8::Handle<v8::Value> toV8(const Vector<std::pair<String, T>>& value, v8:
:Handle<v8::Object> creationContext, v8::Isolate* isolate) |
| 221 { |
| 222 v8::Local<v8::Object> object = v8::Object::New(isolate); |
| 223 for (unsigned i = 0; i < value.size(); ++i) |
| 224 object->Set(v8String(isolate, value[i].first), toV8(value[i].second, cre
ationContext, isolate)); |
| 225 return object; |
| 226 } |
| 227 |
219 } // namespace blink | 228 } // namespace blink |
220 | 229 |
221 #endif // ToV8_h | 230 #endif // ToV8_h |
OLD | NEW |