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

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 62dd42703a9c344143a57ae8b1a94adfa4bb3793..78c810af077e31349d42fea52f0d4baf2db82250 100644
--- a/Source/bindings/templates/union.h
+++ b/Source/bindings/templates/union.h
@@ -64,6 +64,21 @@ inline void v8SetReturnValue(const CallbackInfo& callbackInfo, {{container.cpp_c
}
{% endfor %}
+
+{% for cpp_type in nullable_cpp_types %}
+class V8{{cpp_type}}OrNull final {
bashi 2014/11/07 10:07:53 Maybe "IncludesNull" is accurate, but I'm not sure
Jens Widell 2014/11/07 10:58:19 "AOrBCommaOrNull" (for "A or B, or null")? ;-) If
haraken 2014/11/07 18:06:31 I'm OK with AOrBOrNull :)
bashi 2014/11/08 07:10:34 Let's use "OrNull" suffix :)
+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 #}
haraken 2014/11/07 18:06:31 Can we add unit tests for the following cases? //
bashi 2014/11/08 07:10:34 Yes, that's what I'm going to add in a follow-up C
+ if (isUndefinedOrNull(v8Value))
+ return;
+ V8{{cpp_type}}::toImpl(isolate, v8Value, impl, exceptionState);
+ }
+};
+
+{% endfor %}
} // namespace blink
#endif // {{macro_guard}}

Powered by Google App Engine
This is Rietveld 408576698