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

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

Issue 1054443002: Make classes for union types exported. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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 %}
11 #include "{{filename}}" 11 #include "{{filename}}"
12 {% endfor %} 12 {% endfor %}
13 13
14 namespace blink { 14 namespace blink {
15 15
16 {% for decl in header_forward_decls %} 16 {% for decl in header_forward_decls %}
17 class {{decl}}; 17 class {{decl}};
18 {% endfor %} 18 {% endfor %}
19 19
20 {% for container in containers %} 20 {% for container in containers %}
21 class {{container.cpp_class}} final { 21 class {{exported}}{{container.cpp_class}} final {
22 ALLOW_ONLY_INLINE_ALLOCATION(); 22 ALLOW_ONLY_INLINE_ALLOCATION();
23 public: 23 public:
24 {{container.cpp_class}}(); 24 {{container.cpp_class}}();
25 bool isNull() const { return m_type == SpecificTypeNone; } 25 bool isNull() const { return m_type == SpecificTypeNone; }
26 26
27 {% for member in container.members %} 27 {% for member in container.members %}
28 bool is{{member.type_name}}() const { return m_type == {{member.specific_typ e_enum}}; } 28 bool is{{member.type_name}}() const { return m_type == {{member.specific_typ e_enum}}; }
29 {{member.rvalue_cpp_type}} getAs{{member.type_name}}() const; 29 {{member.rvalue_cpp_type}} getAs{{member.type_name}}() const;
30 void set{{member.type_name}}({{member.rvalue_cpp_type}}); 30 void set{{member.type_name}}({{member.rvalue_cpp_type}});
31 static {{container.cpp_class}} from{{member.type_name}}({{member.rvalue_cpp_ type}}); 31 static {{container.cpp_class}} from{{member.type_name}}({{member.rvalue_cpp_ type}});
32 32
33 {% endfor %} 33 {% endfor %}
34 #if COMPILER(MSVC) && defined(COMPONENT_BUILD) && LINK_CORE_MODULES_SEPARATELY
haraken 2015/04/01 07:03:13 Add a comment on this.
tasak 2015/04/02 05:31:37 Done.
35 {{container.cpp_class}}(const {{container.cpp_class}}&);
36 ~{{container.cpp_class}}();
37 {{container.cpp_class}}& operator=(const {{container.cpp_class}}&);
38 #endif
34 {% if container.needs_trace %} 39 {% if container.needs_trace %}
35 DECLARE_TRACE(); 40 DECLARE_TRACE();
36 41
37 {% endif %} 42 {% endif %}
38 private: 43 private:
39 enum SpecificTypes { 44 enum SpecificTypes {
40 SpecificTypeNone, 45 SpecificTypeNone,
41 {% for member in container.members %} 46 {% for member in container.members %}
42 {{member.specific_type_enum}}, 47 {{member.specific_type_enum}},
43 {% endfor %} 48 {% endfor %}
44 }; 49 };
45 SpecificTypes m_type; 50 SpecificTypes m_type;
46 51
47 {% for member in container.members %} 52 {% for member in container.members %}
48 {{member.cpp_type}} m_{{member.cpp_name}}; 53 {{member.cpp_type}} m_{{member.cpp_name}};
49 {% endfor %} 54 {% endfor %}
50 55
51 friend v8::Local<v8::Value> toV8(const {{container.cpp_class}}&, v8::Local<v 8::Object>, v8::Isolate*); 56 friend {{exported}}v8::Local<v8::Value> toV8(const {{container.cpp_class}}&, v8::Local<v8::Object>, v8::Isolate*);
52 }; 57 };
53 58
54 class V8{{container.cpp_class}} final { 59 class V8{{container.cpp_class}} final {
55 public: 60 public:
56 static void toImpl(v8::Isolate*, v8::Local<v8::Value>, {{container.cpp_class }}&, ExceptionState&); 61 {{exported}}static void toImpl(v8::Isolate*, v8::Local<v8::Value>, {{contain er.cpp_class}}&, ExceptionState&);
57 }; 62 };
58 63
59 v8::Local<v8::Value> toV8(const {{container.cpp_class}}&, v8::Local<v8::Object>, v8::Isolate*); 64 {{exported}}v8::Local<v8::Value> toV8(const {{container.cpp_class}}&, v8::Local< v8::Object>, v8::Isolate*);
60 65
61 template <class CallbackInfo> 66 template <class CallbackInfo>
62 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, {{container.cpp_c lass}}& impl) 67 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, {{container.cpp_c lass}}& impl)
63 { 68 {
64 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate())); 69 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate()));
65 } 70 }
66 71
67 template <> 72 template <>
68 struct NativeValueTraits<{{container.cpp_class}}> { 73 struct NativeValueTraits<{{container.cpp_class}}> {
69 static {{container.cpp_class}} nativeValue(v8::Isolate*, v8::Local<v8::Value >, ExceptionState&); 74 static {{container.cpp_class}} nativeValue(v8::Isolate*, v8::Local<v8::Value >, ExceptionState&);
(...skipping 10 matching lines...) Expand all
80 if (isUndefinedOrNull(v8Value)) 85 if (isUndefinedOrNull(v8Value))
81 return; 86 return;
82 V8{{cpp_type}}::toImpl(isolate, v8Value, impl, exceptionState); 87 V8{{cpp_type}}::toImpl(isolate, v8Value, impl, exceptionState);
83 } 88 }
84 }; 89 };
85 90
86 {% endfor %} 91 {% endfor %}
87 } // namespace blink 92 } // namespace blink
88 93
89 #endif // {{macro_guard}} 94 #endif // {{macro_guard}}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698