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

Unified Diff: Source/bindings/templates/interface_base.cpp

Issue 606653006: bindings: Adds DOMArrayBuffer, etc. as thin wrappers for ArrayBuffer, etc. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Synced. Created 6 years, 2 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
Index: Source/bindings/templates/interface_base.cpp
diff --git a/Source/bindings/templates/interface_base.cpp b/Source/bindings/templates/interface_base.cpp
index 1188d0575946332f559d2ac2b83622bba6ed701c..366d9108424f1bafc4a5e26193671b1d1bf3ba2e 100644
--- a/Source/bindings/templates/interface_base.cpp
+++ b/Source/bindings/templates/interface_base.cpp
@@ -23,16 +23,21 @@ namespace blink {
if parent_interface else '0' %}
{% set wrapper_type_prototype = 'WrapperTypeExceptionPrototype' if is_exception else
'WrapperTypeObjectPrototype' %}
+{% set dom_template = '%s::domTemplate' % v8_class if is_v8object else '0' %}
-const WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin::kEmbedderBlink, {{v8_class}}::domTemplate, {{v8_class}}::refObject, {{v8_class}}::derefObject, {{v8_class}}::createPersistentHandle, {{to_active_dom_object}}, {{to_event_target}}, {{visit_dom_wrapper}}, {{v8_class}}::installConditionallyEnabledMethods, {{v8_class}}::installConditionallyEnabledProperties, {{parent_wrapper_type_info}}, WrapperTypeInfo::{{wrapper_type_prototype}}, WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo::{{lifetime}}, WrapperTypeInfo::{{gc_type}} };
+const WrapperTypeInfo {{v8_class}}::wrapperTypeInfo = { gin::kEmbedderBlink, {{dom_template}}, {{v8_class}}::refObject, {{v8_class}}::derefObject, {{v8_class}}::createPersistentHandle, {{to_active_dom_object}}, {{to_event_target}}, {{visit_dom_wrapper}}, {{v8_class}}::installConditionallyEnabledMethods, {{v8_class}}::installConditionallyEnabledProperties, {{parent_wrapper_type_info}}, WrapperTypeInfo::{{wrapper_type_prototype}}, WrapperTypeInfo::{{wrapper_class_id}}, WrapperTypeInfo::{{lifetime}}, WrapperTypeInfo::{{gc_type}} };
{% if is_script_wrappable %}
// This static member must be declared by DEFINE_WRAPPERTYPEINFO in {{cpp_class}}.h.
// For details, see the comment of DEFINE_WRAPPERTYPEINFO in
// bindings/core/v8/ScriptWrappable.h.
+{% if is_typed_array_type %}
+template<>
+{% endif %}
const WrapperTypeInfo& {{cpp_class}}::s_wrapperTypeInfo = {{v8_class}}::wrapperTypeInfo;
{% endif %}
+{% if is_v8object %}
namespace {{cpp_class}}V8Internal {
{# Constants #}
@@ -229,6 +234,7 @@ static const V8DOMConfiguration::MethodConfiguration {{v8_class}}Methods[] = {
{% endif %}
{% endblock %}
+{% endif %}{# is_v8object #}
{##############################################################################}
{% block named_constructor %}{% endblock %}
{% block initialize_event %}{% endblock %}
@@ -236,6 +242,7 @@ static const V8DOMConfiguration::MethodConfiguration {{v8_class}}Methods[] = {
{% block configure_shadow_object_template %}{% endblock %}
{##############################################################################}
{% block install_dom_template %}
+{% if is_v8object %}
{% from 'methods.cpp' import install_custom_signature with context %}
{% from 'constants.cpp' import install_constants with context %}
static void install{{v8_class}}Template(v8::Handle<v8::FunctionTemplate> functionTemplate, v8::Isolate* isolate)
@@ -400,14 +407,16 @@ static void install{{v8_class}}Template(v8::Handle<v8::FunctionTemplate> functio
functionTemplate->Set(v8AtomicString(isolate, "toString"), V8PerIsolateData::from(isolate)->toStringTemplate());
}
+{% endif %}{# is_v8object #}
{% endblock %}
{##############################################################################}
{% block get_dom_template %}{% endblock %}
{% block has_instance %}{% endblock %}
+{% block to_impl %}{% endblock %}
{% block to_impl_with_type_check %}{% endblock %}
{##############################################################################}
{% block install_conditional_attributes %}
-{% if has_conditional_attributes %}
+{% if is_v8object and has_conditional_attributes %}
haraken 2014/10/16 05:41:41 I think you can drop the 'is_v8object and' check b
Yuki 2014/10/16 14:21:51 Done.
void {{v8_class}}::installConditionallyEnabledProperties(v8::Handle<v8::Object> instanceObject, v8::Isolate* isolate)
{
v8::Local<v8::Object> prototypeObject = v8::Local<v8::Object>::Cast(instanceObject->GetPrototype());
@@ -428,7 +437,7 @@ void {{v8_class}}::installConditionallyEnabledProperties(v8::Handle<v8::Object>
{% endblock %}
{##############################################################################}
{% block install_conditional_methods %}
-{% if conditionally_enabled_methods %}
+{% if is_v8object and conditionally_enabled_methods %}
haraken 2014/10/16 05:41:41 Ditto.
Yuki 2014/10/16 14:21:51 Done.
void {{v8_class}}::installConditionallyEnabledMethods(v8::Handle<v8::Object> prototypeObject, v8::Isolate* isolate)
{
{# Define per-context enabled operations #}

Powered by Google App Engine
This is Rietveld 408576698