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

Unified Diff: Source/bindings/scripts/header.template

Issue 17572008: WIP IDL compiler rewrite (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: non-callback headers working Created 7 years, 6 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/scripts/generate_bindings.py ('k') | Source/bindings/scripts/implementation.template » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/header.template
diff --git a/Source/bindings/scripts/header.template b/Source/bindings/scripts/header.template
new file mode 100644
index 0000000000000000000000000000000000000000..ef877b43b50dcec1d584c96cd0bf0df12a6049e0
--- /dev/null
+++ b/Source/bindings/scripts/header.template
@@ -0,0 +1,200 @@
+/*
+ This file is part of the Blink open source project.
+ This file has been auto-generated by CodeGeneratorV8.pm. DO NOT MODIFY!
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB. If not, write to
+ the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
+#ifndef {{v8_class_name}}_h
+#define {{v8_class_name}}_h
+
+{{conditional_if}}
+{% for filename in includes -%}
+#include "{{filename}}"
+{% endfor %}
+namespace WebCore {
+
+{% if is_constructor_template_of_event %}
+class Dictionary;
+{% endif %}
+
+{% for definition in namespace_WebCore_definitions -%}
+{{definition | indent(4, true)}}
+{% endfor %}
+
+class {{v8_class_name}} {
+public:
+ static bool HasInstance(v8::Handle<v8::Value>, v8::Isolate*, WrapperWorldType);
+ static bool HasInstanceInAnyWorld(v8::Handle<v8::Value>, v8::Isolate*);
+ static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWorldType);
+ static {{impl_class_name}}* toNative(v8::Handle<v8::Object> object)
+ {
+ return reinterpret_cast<{{impl_class_name}}*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex));
+ }
+ static void derefObject(void*);
+ static WrapperTypeInfo info;
+{% if needs_opaque_root_for_gc %}
+ static void* opaqueRootForGC(void*, v8::Isolate*);
+{% endif %}
+{% if inherits_extended_attribute_active_dom_object %}
+ static ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object>);
+{% endif %}
+{% if inherits_extended_attribute_event_target %}
+ static EventTarget* toEventTarget(v8::Handle<v8::Object>);
+{% endif %}
+{% for definition in operation_definitions -%}
+{{definition | indent(4, true)}}
+{% endfor %}
+{% if is_constructable %}
+ static void constructorCallback(const v8::FunctionCallbackInfo<v8::Value>&);
+{% endif %}
+{% for definition in attribute_definitions -%}
+{{definition | indent(4, true)}}
+{% endfor %}
+
+{% for definition in custom_internal_field_indices -%}
+{{definition | indent(4, true)}}
+{% endfor %}
+
+ static void installPerContextProperties(v8::Handle<v8::Object>, {{impl_class_name}}*, v8::Isolate*){{install_per_context_properties_body}}
+ static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8::Isolate*){{install_per_context_prototype_properties_body}}
+
+private:
+{% if wrap %}
+ friend v8::Handle<v8::Object> wrap({{impl_class_name}}*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
+ static v8::Handle<v8::Object> createWrapper({{impl_class_name_as_parameter}}, v8::Handle<v8::Object> creationContext, v8::Isolate*);
+{% endif %}
+
+};
+
+template<>
+class WrapperTypeTraits<{{impl_class_name}} > {
+public:
+ static WrapperTypeInfo* info() { return &{{v8_class_name}}::info; }
+};
+
+{% if generate_to_v8 %}
+class {{impl_class_name}};
+v8::Handle<v8::Value> toV8({{impl_class_name}}*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
+v8::Handle<v8::Value> toV8ForMainWorld({{impl_class_name}}*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
+
+template<class HolderContainer, class Wrappable>
+inline v8::Handle<v8::Value> toV8Fast({{impl_class_name}}* impl, const HolderContainer& container, Wrappable*)
+{
+ return toV8(impl, container.Holder(), container.GetIsolate());
+}
+
+template<class HolderContainer, class Wrappable>
+inline v8::Handle<v8::Value> toV8FastForMainWorld({{impl_class_name}}* impl, const HolderContainer& container, Wrappable*)
+{
+ return toV8ForMainWorld(impl, container.Holder(), container.GetIsolate());
+}
+{% endif %}
+
+{% if wrap %}
+{% if custom_wrap %}
+v8::Handle<v8::Object> wrap({{impl_class_name}}* impl, v8::Handle<v8::Object> creationContext, v8::Isolate*);
+{% else %}
+inline v8::Handle<v8::Object> wrap({{impl_class_name}}* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ ASSERT(impl);
+ ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty());
+ if (ScriptWrappable::wrapperCanBeStoredInObject(impl)) {
+ const WrapperTypeInfo* actualInfo = ScriptWrappable::getTypeInfoFromObject(impl);
+ // Might be a XXXConstructor::info instead of an XXX::info. These will both have
+ // the same object de-ref functions, though, so use that as the basis of the check.
+ RELEASE_ASSERT_WITH_SECURITY_IMPLICATION(actualInfo->derefObjectFunction == {{v8_class_name}}::info.derefObjectFunction);
+ }
+ return {{v8_class_name}}::{{ custom_wrap and "wrap" or "createWrapper" }}(impl, creationContext, isolate);
+}
+{% endif %}
+{% endif %}
+
+{% if wrap %}
+inline v8::Handle<v8::Value> toV8({{impl_class_name}}* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ if (UNLIKELY(!impl))
+ return v8NullWithCheck(isolate);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper(impl, isolate);
+ if (!wrapper.IsEmpty())
+ return wrapper;
+ return wrap(impl, creationContext, isolate);
+}
+
+inline v8::Handle<v8::Value> toV8ForMainWorld({{impl_class_name}}* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ ASSERT(worldType(isolate) == MainWorld);
+ if (UNLIKELY(!impl))
+ return v8NullWithCheck(isolate);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ if (!wrapper.IsEmpty())
+ return wrapper;
+ return wrap(impl, creationContext, isolate);
+}
+
+template<class HolderContainer, class Wrappable>
+inline v8::Handle<v8::Value> toV8Fast({{impl_class_name}}* impl, const HolderContainer& container, Wrappable* wrappable)
+{
+ if (UNLIKELY(!impl))
+ return v8Null(container.GetIsolate());
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast(impl, container, wrappable);
+ if (!wrapper.IsEmpty())
+ return wrapper;
+ return wrap(impl, container.Holder(), container.GetIsolate());
+}
+
+template<class HolderContainer, class Wrappable>
+inline v8::Handle<v8::Value> toV8FastForMainWorld({{impl_class_name}}* impl, const HolderContainer& container, Wrappable* wrappable)
+{
+ ASSERT(worldType(container.GetIsolate()) == MainWorld);
+ if (UNLIKELY(!impl))
+ return v8Null(container.GetIsolate());
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperForMainWorld(impl);
+ if (!wrapper.IsEmpty())
+ return wrapper;
+ return wrap(impl, container.Holder(), container.GetIsolate());
+}
+
+template<class HolderContainer, class Wrappable>
+inline v8::Handle<v8::Value> toV8FastForMainWorld(PassRefPtr< {{impl_class_name}} > impl, const HolderContainer& container, Wrappable* wrappable)
+{
+ return toV8FastForMainWorld(impl.get(), container, wrappable);
+}
+{% endif %}
+
+
+template<class HolderContainer, class Wrappable>
+inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< {{impl_class_name}} > impl, const HolderContainer& container, Wrappable* wrappable)
+{
+ return toV8Fast(impl.get(), container, wrappable);
+}
+
+inline v8::Handle<v8::Value> toV8(PassRefPtr< {{impl_class_name}} > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ return toV8(impl.get(), creationContext, isolate);
+}
+
+{% if is_constructor_template_of_event %}
+bool fill{{impl_class_name}}Init({{impl_class_name}}Init&, const Dictionary&);
+{% endif %}
+
+}
+
+{{conditional_endif}}
+
+#endif // {{v8_class_name}}_h
+
+
« no previous file with comments | « Source/bindings/scripts/generate_bindings.py ('k') | Source/bindings/scripts/implementation.template » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698