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

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

Issue 2843143002: Move more files to platform/bindings (Closed)
Patch Set: Move back IDLDictionaryBase Created 3 years, 8 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/ToV8ForCore.h
diff --git a/third_party/WebKit/Source/bindings/core/v8/ToV8ForCore.h b/third_party/WebKit/Source/bindings/core/v8/ToV8ForCore.h
index 077c84a3fb6ab127c64b592eb1baa12701cacd94..9fe40954c0f0440cb993b1899fd52edb096a4c28 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ToV8ForCore.h
+++ b/third_party/WebKit/Source/bindings/core/v8/ToV8ForCore.h
@@ -8,6 +8,8 @@
// ToV8() provides C++ -> V8 conversion. Note that ToV8() can return an empty
// handle. Call sites must check IsEmpty() before using return value.
+#include "bindings/core/v8/IDLDictionaryBase.h"
+#include "bindings/core/v8/ScriptValue.h"
#include "bindings/core/v8/ToV8.h"
#include "bindings/core/v8/V8NodeFilterCondition.h"
#include "core/dom/ArrayBufferViewHelpers.h"
@@ -52,6 +54,31 @@ inline v8::Local<v8::Value> ToV8(const V8NodeFilterCondition* value,
return value ? value->Callback(isolate) : v8::Null(isolate).As<v8::Value>();
}
+// Dictionary
+
+inline v8::Local<v8::Value> ToV8(const IDLDictionaryBase& value,
+ v8::Local<v8::Object> creation_context,
+ v8::Isolate* isolate) {
+ return value.ToV8Impl(creation_context, isolate);
+}
+
+// ScriptValue
+
+inline v8::Local<v8::Value> ToV8(const ScriptValue& value,
+ v8::Local<v8::Object> creation_context,
+ v8::Isolate* isolate) {
+ if (value.IsEmpty())
+ return v8::Undefined(isolate);
+ return value.V8Value();
+}
+
+// Cannot define in ScriptValue because of the circular dependency between toV8
+// and ScriptValue
+template <typename T>
+inline ScriptValue ScriptValue::From(ScriptState* script_state, T&& value) {
+ return ScriptValue(script_state, ToV8(std::forward<T>(value), script_state));
+}
+
} // namespace blink
#endif // ToV8ForCore_h
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ToV8.h ('k') | third_party/WebKit/Source/bindings/core/v8/TraceWrapperMember.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698