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

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
« no previous file with comments | « Source/bindings/scripts/v8_union.py ('k') | Source/bindings/templates/union.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/templates/union.h
diff --git a/Source/bindings/templates/union.h b/Source/bindings/templates/union.h
index 62dd42703a9c344143a57ae8b1a94adfa4bb3793..bfef378f9d4276480135c458b936e2d72fb95743 100644
--- a/Source/bindings/templates/union.h
+++ b/Source/bindings/templates/union.h
@@ -64,6 +64,20 @@ inline void v8SetReturnValue(const CallbackInfo& callbackInfo, {{container.cpp_c
}
{% endfor %}
+{% for cpp_type in nullable_cpp_types %}
+class V8{{cpp_type}}OrNull final {
+public:
+ static void toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v8Value, {{cpp_type}}& impl, ExceptionState& exceptionState)
+ {
+ {# http://heycam.github.io/webidl/#es-union #}
+ {# 1. null or undefined #}
+ if (isUndefinedOrNull(v8Value))
+ return;
+ V8{{cpp_type}}::toImpl(isolate, v8Value, impl, exceptionState);
+ }
+};
+
+{% endfor %}
} // namespace blink
#endif // {{macro_guard}}
« no previous file with comments | « Source/bindings/scripts/v8_union.py ('k') | Source/bindings/templates/union.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698