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

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

Issue 17572008: WIP IDL compiler rewrite (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: Branch: const + primitive type readonly attributes Created 7 years, 4 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/interface.cpp ('k') | Source/bindings/templates/interface_wip.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/templates/interface_wip.h
diff --git a/Source/bindings/templates/interface_wip.h b/Source/bindings/templates/interface_wip.h
new file mode 100644
index 0000000000000000000000000000000000000000..beeabe2da68c5302cb4bf7878a270b3c9cec81e9
--- /dev/null
+++ b/Source/bindings/templates/interface_wip.h
@@ -0,0 +1,258 @@
+/*
+ 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
+
+{% if conditional_string %}
+#if {{conditional_string}}
+{% endif %}
+{% for filename in header_includes %}
+#include "{{filename}}"
+{% endfor %}
+
+namespace WebCore {
+
+{% if svg_property_type %}
+template<typename PropertyType> class SVGPropertyTearOff;
+
+{% endif %}
+{% if svg_native_type %}
+{% if svg_native_type_contains_svg_static_list_property_tear_off %}
+template<typename PropertyType> class SVGStaticListPropertyTearOff;
+
+{% else %}
+template<typename PropertyType> class SVGListPropertyTearOff;
+
+{% endif %}
+{% endif %}
+{%- if is_constructor_template_of_event %}
+class Dictionary;
+{% endif %}
+{% for definition in namespace_WebCore_definitions %}
+ {{definition | indent}}
+{% endfor %}
+{% if has_named_constructor %}
+class {{v8_class_name}}Constructor {
+public:
+ static v8::Handle<v8::FunctionTemplate> GetTemplate(v8::Isolate*, WrapperWorldType);
+ static WrapperTypeInfo info;
+};
+
+{% endif %}
+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 {{cpp_class_name}}* toNative(v8::Handle<v8::Object> object)
+ {
+ return fromInternalPointer(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_event_target %}
+ static EventTarget* toEventTarget(v8::Handle<v8::Object>);
+{% endif %}
+{% if interface_name == "Window" %}
+ static v8::Handle<v8::ObjectTemplate> GetShadowObjectTemplate(v8::Isolate*, WrapperWorldType);
+{% endif %}
+{% for definition in operation_definitions %}
+ {{definition | indent}}
+{% endfor %}
+{% if is_constructable %}
+ static void constructorCallback(const v8::FunctionCallbackInfo<v8::Value>&);
+{% endif %}
+{% if has_custom_constructor %}
+ static void constructorCustom(const v8::FunctionCallbackInfo<v8::Value>&);
+{% endif %}
+{% for definition in attribute_definitions %}
+ {{definition | indent}}
+{% endfor %}
+{# indexed/named accessors #}
+{% if has_custom_indexed_getter %}
+ static void indexedPropertyGetterCustom(uint32_t, const v8::PropertyCallbackInfo<v8::Value>&);
+{% endif %}
+{% if has_custom_indexed_setter %}
+ static void indexedPropertySetterCustom(uint32_t, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<v8::Value>&);
+{% endif %}
+{% if has_custom_indexed_deleter %}
+ static void indexedPropertyDeleterCustom(uint32_t, const v8::PropertyCallbackInfo<v8::Boolean>&);
+{% endif %}
+{% if has_custom_named_getter %}
+ static void namedPropertyGetterCustom(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>&);
+{% endif %}
+{% if has_custom_named_setter %}
+ static void namedPropertySetterCustom(v8::Local<v8::String>, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<v8::Value>&);
+{% endif %}
+{% if has_custom_named_deleter %}
+ static void namedPropertyDeleterCustom(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Boolean>&);
+{% endif %}
+{% if has_custom_named_enumerator %}
+ static void namedPropertyEnumeratorCustom(const v8::PropertyCallbackInfo<v8::Array>&);
+ static void namedPropertyQueryCustom(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Integer>&);
+{% endif %}
+{% if custom_legacy_call %}
+ static void legacyCallCustom(const v8::FunctionCallbackInfo<v8::Value>&);
+{% endif %}
+{% for definition in custom_internal_field_indices %}
+ {{definition | indent}}
+{% endfor %}
+{%- for internal_field in internal_fields %}
+ static const int {{internal_field}} = v8DefaultWrapperInternalFieldCount + {{loop.index0}};
+{% endfor %}
+ static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + {{internal_fields|length}};
+ static inline void* toInternalPointer({{cpp_class_name}}* impl)
+ {
+ return {{to_wrapped_type}};
+ }
+
+ static inline {{cpp_class_name}}* fromInternalPointer(void* object)
+ {
+ return {{from_wrapped_type}};
+ }
+{% if interface_name == "Window" %}
+ static bool namedSecurityCheckCustom(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType, v8::Local<v8::Value> data);
+ static bool indexedSecurityCheckCustom(v8::Local<v8::Object> host, uint32_t index, v8::AccessType, v8::Local<v8::Value> data);
+{% endif %}
+ static void installPerContextProperties(v8::Handle<v8::Object>, {{cpp_class_name}}*, v8::Isolate*){{install_per_context_properties_body}}
+ static void installPerContextPrototypeProperties(v8::Handle<v8::Object>, v8::Isolate*){{install_per_context_prototype_properties_body}}
+{# FIXME: Remove special hacks #}
+{% if interface_name == "HTMLElement" %}
+ friend v8::Handle<v8::Object> createV8HTMLWrapper(HTMLElement*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
+ friend v8::Handle<v8::Object> createV8HTMLDirectWrapper(HTMLElement*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
+{% elif interface_name == "SVGElement" %}
+ friend v8::Handle<v8::Object> createV8SVGWrapper(SVGElement*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
+ friend v8::Handle<v8::Object> createV8SVGDirectWrapper(SVGElement*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
+ friend v8::Handle<v8::Object> createV8SVGFallbackWrapper(SVGElement*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
+{% elif interface_name == "HTMLUnknownElement" %}
+ friend v8::Handle<v8::Object> createV8HTMLFallbackWrapper(HTMLUnknownElement*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
+{% elif interface_name == "Element" %}
+ // This is a performance optimization hack. See V8Element::wrap.
+ friend v8::Handle<v8::Object> wrap(Node*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
+{% endif %}
+private:
+{% if wrap %}
+ friend v8::Handle<v8::Object> wrap({{cpp_class_name}}*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
+ static v8::Handle<v8::Object> createWrapper({{cpp_class_name_as_parameter}}, v8::Handle<v8::Object> creationContext, v8::Isolate*);
+{% endif %}
+};
+
+template<>
+class WrapperTypeTraits<{{cpp_class_name}} > {
+public:
+ static WrapperTypeInfo* info() { return &{{v8_class_name}}::info; }
+};
+
+{% if generate_to_v8 %}
+class {{cpp_class_name}};
+v8::Handle<v8::Value> toV8({{cpp_class_name}}*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
+v8::Handle<v8::Value> toV8ForMainWorld({{cpp_class_name}}*, v8::Handle<v8::Object> creationContext, v8::Isolate*);
+
+template<class CallbackInfo, class Wrappable>
+inline v8::Handle<v8::Value> toV8Fast({{cpp_class_name}}* impl, const CallbackInfo& callbackInfo, Wrappable*)
+{
+ return toV8(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
+}
+
+{% endif %}
+{% if wrap %}
+
+{% if custom_wrap %}
+v8::Handle<v8::Object> wrap({{cpp_class_name}}* impl, v8::Handle<v8::Object> creationContext, v8::Isolate*);
+{% else %}
+inline v8::Handle<v8::Object> wrap({{cpp_class_name}}* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ ASSERT(impl);
+ ASSERT(DOMDataStore::getWrapper<{{v8_class_name}}>(impl, isolate).IsEmpty());
+ return {{v8_class_name}}::{{ custom_wrap and "wrap" or "createWrapper" }}(impl, creationContext, isolate);
+}
+{% endif %}
+
+{% endif %}
+{% if wrap %}
+inline v8::Handle<v8::Value> toV8({{cpp_class_name}}* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ if (UNLIKELY(!impl))
+ return v8NullWithCheck(isolate);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapper<{{v8_class_name}}>(impl, isolate);
+ if (!wrapper.IsEmpty())
+ return wrapper;
+ return wrap(impl, creationContext, isolate);
+}
+
+inline v8::Handle<v8::Value> toV8ForMainWorld({{cpp_class_name}}* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ ASSERT(worldType(isolate) == MainWorld);
+ if (UNLIKELY(!impl))
+ return v8::Null(isolate);
+ v8::Handle<v8::Value> wrapper = DOMDataStore::getWrapperForMainWorld<{{v8_class_name}}>(impl);
+ if (!wrapper.IsEmpty())
+ return wrapper;
+ return wrap(impl, creationContext, isolate);
+}
+
+template<class CallbackInfo, class Wrappable>
+inline v8::Handle<v8::Value> toV8Fast({{cpp_class_name}}* impl, const CallbackInfo& callbackInfo, Wrappable* wrappable)
+{
+ if (UNLIKELY(!impl))
+ return v8::Null(callbackInfo.GetIsolate());
+ v8::Handle<v8::Object> wrapper = DOMDataStore::getWrapperFast<{{v8_class_name}}>(impl, callbackInfo, wrappable);
+ if (!wrapper.IsEmpty())
+ return wrapper;
+ return wrap(impl, callbackInfo.Holder(), callbackInfo.GetIsolate());
+}
+
+inline v8::Handle<v8::Value> toV8ForMainWorld(PassRefPtr< {{cpp_class_name}} > impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
+{
+ return toV8ForMainWorld(impl.get(), creationContext, isolate);
+}
+
+{% endif %}
+
+template<class CallbackInfo, class Wrappable>
+inline v8::Handle<v8::Value> toV8Fast(PassRefPtr< {{cpp_class_name}} > impl, const CallbackInfo& callbackInfo, Wrappable* wrappable)
+{
+ return toV8Fast(impl.get(), callbackInfo, wrappable);
+}
+
+inline v8::Handle<v8::Value> toV8(PassRefPtr< {{cpp_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{{cpp_class_name}}Init({{cpp_class_name}}Init&, const Dictionary&);
+
+{% endif %}
+}
+{% if conditional_string %}
+
+#endif // {{conditional_string}}
+{% endif %}
+
+#endif // {{v8_class_name}}_h
+
« no previous file with comments | « Source/bindings/templates/interface.cpp ('k') | Source/bindings/templates/interface_wip.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698