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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file has been auto-generated by {{code_generator}}. DO NOT MODIFY! 5 // This file has been auto-generated by {{code_generator}}. DO NOT MODIFY!
6 6
7 #ifndef {{macro_guard}} 7 #ifndef {{macro_guard}}
8 #define {{macro_guard}} 8 #define {{macro_guard}}
9 9
10 {% for filename in header_includes %} 10 {% for filename in header_includes %}
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 v8::Handle<v8::Value> toV8({{container.cpp_class}}&, v8::Handle<v8::Object>, v8: :Isolate*); 58 v8::Handle<v8::Value> toV8({{container.cpp_class}}&, v8::Handle<v8::Object>, v8: :Isolate*);
59 59
60 template <class CallbackInfo> 60 template <class CallbackInfo>
61 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, {{container.cpp_c lass}}& impl) 61 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, {{container.cpp_c lass}}& impl)
62 { 62 {
63 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate())); 63 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate()));
64 } 64 }
65 65
66 {% endfor %} 66 {% endfor %}
67
68 {% for cpp_type in nullable_cpp_types %}
69 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 :)
70 public:
71 static void toImpl(v8::Isolate* isolate, v8::Handle<v8::Value> v8Value, {{cp p_type}}& impl, ExceptionState& exceptionState)
72 {
73 {# http://heycam.github.io/webidl/#es-union #}
74 {# 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
75 if (isUndefinedOrNull(v8Value))
76 return;
77 V8{{cpp_type}}::toImpl(isolate, v8Value, impl, exceptionState);
78 }
79 };
80
81 {% endfor %}
67 } // namespace blink 82 } // namespace blink
68 83
69 #endif // {{macro_guard}} 84 #endif // {{macro_guard}}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698