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

Side by Side Diff: Source/bindings/templates/union.h

Issue 946973005: IDL: Drop value conversion (V8 -> C++) macros from generated code (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 {% for member in container.members %} 47 {% for member in container.members %}
48 {{member.cpp_type}} m_{{member.cpp_name}}; 48 {{member.cpp_type}} m_{{member.cpp_name}};
49 {% endfor %} 49 {% endfor %}
50 50
51 friend v8::Local<v8::Value> toV8(const {{container.cpp_class}}&, v8::Local<v 8::Object>, v8::Isolate*); 51 friend v8::Local<v8::Value> toV8(const {{container.cpp_class}}&, v8::Local<v 8::Object>, v8::Isolate*);
52 }; 52 };
53 53
54 class V8{{container.cpp_class}} final { 54 class V8{{container.cpp_class}} final {
55 public: 55 public:
56 static void toImpl(v8::Isolate*, v8::Local<v8::Value>, {{container.cpp_class }}&, ExceptionState&); 56 static bool toImpl(v8::Isolate*, v8::Local<v8::Value>, {{container.cpp_class }}&, ExceptionState&);
57 }; 57 };
58 58
59 v8::Local<v8::Value> toV8(const {{container.cpp_class}}&, v8::Local<v8::Object>, v8::Isolate*); 59 v8::Local<v8::Value> toV8(const {{container.cpp_class}}&, v8::Local<v8::Object>, v8::Isolate*);
60 60
61 template <class CallbackInfo> 61 template <class CallbackInfo>
62 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, {{container.cpp_c lass}}& impl) 62 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, {{container.cpp_c lass}}& impl)
63 { 63 {
64 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate())); 64 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate()));
65 } 65 }
66 66
67 template <> 67 template <>
68 struct NativeValueTraits<{{container.cpp_class}}> { 68 struct NativeValueTraits<{{container.cpp_class}}> {
69 static {{container.cpp_class}} nativeValue(const v8::Local<v8::Value>&, v8:: Isolate*, ExceptionState&); 69 static {{container.cpp_class}} nativeValue(const v8::Local<v8::Value>&, v8:: Isolate*, ExceptionState&);
70 }; 70 };
71 71
72 {% endfor %} 72 {% endfor %}
73 {% for cpp_type in nullable_cpp_types %} 73 {% for cpp_type in nullable_cpp_types %}
74 class V8{{cpp_type}}OrNull final { 74 class V8{{cpp_type}}OrNull final {
75 public: 75 public:
76 static void toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, {{cpp _type}}& impl, ExceptionState& exceptionState) 76 static bool toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, {{cpp _type}}& impl, ExceptionState& exceptionState)
77 { 77 {
78 {# http://heycam.github.io/webidl/#es-union #} 78 {# http://heycam.github.io/webidl/#es-union #}
79 {# 1. null or undefined #} 79 {# 1. null or undefined #}
80 if (isUndefinedOrNull(v8Value)) 80 if (isUndefinedOrNull(v8Value))
81 return; 81 return true;
82 V8{{cpp_type}}::toImpl(isolate, v8Value, impl, exceptionState); 82 return V8{{cpp_type}}::toImpl(isolate, v8Value, impl, exceptionState);
83 } 83 }
84 }; 84 };
85 85
86 {% endfor %} 86 {% endfor %}
87 } // namespace blink 87 } // namespace blink
88 88
89 #endif // {{macro_guard}} 89 #endif // {{macro_guard}}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698