Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/02 09:13:09
It would be better to change LINK_CORE_MODULES_SEP
| |
| 35 // Explicit declarations of copy constructor, destructor and operator=, | |
| 36 // because msvc automatically generates them if they are not declared in | |
| 37 // this header. | |
| 38 {{container.cpp_class}}(const {{container.cpp_class}}&); | |
| 39 ~{{container.cpp_class}}(); | |
| 40 {{container.cpp_class}}& operator=(const {{container.cpp_class}}&); | |
| 41 #endif | |
| 34 {% if container.needs_trace %} | 42 {% if container.needs_trace %} |
| 35 DECLARE_TRACE(); | 43 DECLARE_TRACE(); |
| 36 | 44 |
| 37 {% endif %} | 45 {% endif %} |
| 38 private: | 46 private: |
| 39 enum SpecificTypes { | 47 enum SpecificTypes { |
| 40 SpecificTypeNone, | 48 SpecificTypeNone, |
| 41 {% for member in container.members %} | 49 {% for member in container.members %} |
| 42 {{member.specific_type_enum}}, | 50 {{member.specific_type_enum}}, |
| 43 {% endfor %} | 51 {% endfor %} |
| 44 }; | 52 }; |
| 45 SpecificTypes m_type; | 53 SpecificTypes m_type; |
| 46 | 54 |
| 47 {% for member in container.members %} | 55 {% for member in container.members %} |
| 48 {{member.cpp_type}} m_{{member.cpp_name}}; | 56 {{member.cpp_type}} m_{{member.cpp_name}}; |
| 49 {% endfor %} | 57 {% endfor %} |
| 50 | 58 |
| 51 friend v8::Local<v8::Value> toV8(const {{container.cpp_class}}&, v8::Local<v 8::Object>, v8::Isolate*); | 59 friend {{exported}}v8::Local<v8::Value> toV8(const {{container.cpp_class}}&, v8::Local<v8::Object>, v8::Isolate*); |
| 52 }; | 60 }; |
| 53 | 61 |
| 54 class V8{{container.cpp_class}} final { | 62 class V8{{container.cpp_class}} final { |
| 55 public: | 63 public: |
| 56 static void toImpl(v8::Isolate*, v8::Local<v8::Value>, {{container.cpp_class }}&, ExceptionState&); | 64 {{exported}}static void toImpl(v8::Isolate*, v8::Local<v8::Value>, {{contain er.cpp_class}}&, ExceptionState&); |
| 57 }; | 65 }; |
| 58 | 66 |
| 59 v8::Local<v8::Value> toV8(const {{container.cpp_class}}&, v8::Local<v8::Object>, v8::Isolate*); | 67 {{exported}}v8::Local<v8::Value> toV8(const {{container.cpp_class}}&, v8::Local< v8::Object>, v8::Isolate*); |
| 60 | 68 |
| 61 template <class CallbackInfo> | 69 template <class CallbackInfo> |
| 62 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, {{container.cpp_c lass}}& impl) | 70 inline void v8SetReturnValue(const CallbackInfo& callbackInfo, {{container.cpp_c lass}}& impl) |
| 63 { | 71 { |
| 64 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate())); | 72 v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInf o.GetIsolate())); |
| 65 } | 73 } |
| 66 | 74 |
| 67 template <> | 75 template <> |
| 68 struct NativeValueTraits<{{container.cpp_class}}> { | 76 struct NativeValueTraits<{{container.cpp_class}}> { |
| 69 static {{container.cpp_class}} nativeValue(v8::Isolate*, v8::Local<v8::Value >, ExceptionState&); | 77 static {{container.cpp_class}} nativeValue(v8::Isolate*, v8::Local<v8::Value >, ExceptionState&); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 80 if (isUndefinedOrNull(v8Value)) | 88 if (isUndefinedOrNull(v8Value)) |
| 81 return; | 89 return; |
| 82 V8{{cpp_type}}::toImpl(isolate, v8Value, impl, exceptionState); | 90 V8{{cpp_type}}::toImpl(isolate, v8Value, impl, exceptionState); |
| 83 } | 91 } |
| 84 }; | 92 }; |
| 85 | 93 |
| 86 {% endfor %} | 94 {% endfor %} |
| 87 } // namespace blink | 95 } // namespace blink |
| 88 | 96 |
| 89 #endif // {{macro_guard}} | 97 #endif // {{macro_guard}} |
| OLD | NEW |