Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Unified Diff: third_party/WebKit/Source/bindings/core/v8/ToV8.h

Issue 2125213002: [IndexedDB] Propogating changes to observers : Renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lifetime
Patch Set: Implements Map in IDBObserverChanges idl Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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.

Powered by Google App Engine
This is Rietveld 408576698