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

Unified Diff: Source/bindings/templates/union.h

Issue 698423002: IDL union: nullable support (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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: Source/bindings/templates/union.h
diff --git a/Source/bindings/templates/union.h b/Source/bindings/templates/union.h
index 5cb527951b64f2bd57521e9ba4f9a7b47b41dc2e..54a913d985fcddac528948ad25fd06f1a17b3407 100644
--- a/Source/bindings/templates/union.h
+++ b/Source/bindings/templates/union.h
@@ -62,6 +62,21 @@ inline void v8SetReturnValue(const CallbackInfo& callbackInfo, {{container.cpp_c
}
{% endfor %}
+
+{% for nullable_container in nullable_containers %}
+class V8{{nullable_container.cpp_class}}OrNull final {
+public:
+ static void toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v8Value, {{nullable_container.cpp_class}}& impl, ExceptionState& exceptionState)
+ {
+ {# http://heycam.github.io/webidl/#es-union #}
+ {# 1. null or undefined #}
+ if (isUndefinedOrNull(v8Value))
+ return;
+ V8{{nullable_container.cpp_class}}::toImpl(isolate, v8Value, impl, exceptionState);
+ }
+};
+
+{% endfor %}
} // namespace blink
#endif // {{macro_guard}}

Powered by Google App Engine
This is Rietveld 408576698