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

Unified Diff: Source/bindings/templates/union.h

Issue 953123003: IDL: Put generated union type containers in separate files (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/templates/templates.gypi ('k') | Source/bindings/templates/union.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/templates/union.h
diff --git a/Source/bindings/templates/union.h b/Source/bindings/templates/union.h
index 468492a616f6e2cd4619f7cdd7e8cad4c84c04b7..01be796dc7da478d0ff71fb47ef033da12377e47 100644
--- a/Source/bindings/templates/union.h
+++ b/Source/bindings/templates/union.h
@@ -1,4 +1,4 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -11,79 +11,4 @@
#include "{{filename}}"
{% endfor %}
-namespace blink {
-
-{% for decl in header_forward_decls %}
-class {{decl}};
-{% endfor %}
-
-{% for container in containers %}
-class {{container.cpp_class}} final {
- ALLOW_ONLY_INLINE_ALLOCATION();
-public:
- {{container.cpp_class}}();
- bool isNull() const { return m_type == SpecificTypeNone; }
-
- {% for member in container.members %}
- bool is{{member.type_name}}() const { return m_type == {{member.specific_type_enum}}; }
- {{member.rvalue_cpp_type}} getAs{{member.type_name}}() const;
- void set{{member.type_name}}({{member.rvalue_cpp_type}});
- static {{container.cpp_class}} from{{member.type_name}}({{member.rvalue_cpp_type}});
-
- {% endfor %}
- {% if container.needs_trace %}
- DECLARE_TRACE();
-
- {% endif %}
-private:
- enum SpecificTypes {
- SpecificTypeNone,
- {% for member in container.members %}
- {{member.specific_type_enum}},
- {% endfor %}
- };
- SpecificTypes m_type;
-
- {% for member in container.members %}
- {{member.cpp_type}} m_{{member.cpp_name}};
- {% endfor %}
-
- friend v8::Local<v8::Value> toV8(const {{container.cpp_class}}&, v8::Local<v8::Object>, v8::Isolate*);
-};
-
-class V8{{container.cpp_class}} final {
-public:
- static void toImpl(v8::Isolate*, v8::Local<v8::Value>, {{container.cpp_class}}&, ExceptionState&);
-};
-
-v8::Local<v8::Value> toV8(const {{container.cpp_class}}&, v8::Local<v8::Object>, v8::Isolate*);
-
-template <class CallbackInfo>
-inline void v8SetReturnValue(const CallbackInfo& callbackInfo, {{container.cpp_class}}& impl)
-{
- v8SetReturnValue(callbackInfo, toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate()));
-}
-
-template <>
-struct NativeValueTraits<{{container.cpp_class}}> {
- static {{container.cpp_class}} nativeValue(const v8::Local<v8::Value>&, v8::Isolate*, ExceptionState&);
-};
-
-{% endfor %}
-{% for cpp_type in nullable_cpp_types %}
-class V8{{cpp_type}}OrNull final {
-public:
- static void toImpl(v8::Isolate* isolate, v8::Local<v8::Value> v8Value, {{cpp_type}}& impl, ExceptionState& exceptionState)
- {
- {# http://heycam.github.io/webidl/#es-union #}
- {# 1. null or undefined #}
- if (isUndefinedOrNull(v8Value))
- return;
- V8{{cpp_type}}::toImpl(isolate, v8Value, impl, exceptionState);
- }
-};
-
-{% endfor %}
-} // namespace blink
-
#endif // {{macro_guard}}
« no previous file with comments | « Source/bindings/templates/templates.gypi ('k') | Source/bindings/templates/union.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698