Commit 1d9e0b92 authored by shend's avatar shend Committed by Commit bot

Make generated field groups inherit from RefCountedCopyable.

Currently generated groups such as StyleSurroundData inherit from
RefCounted, which means we have to explicitly specify a copy
constructor. Inheriting from RefCountedCopyable instead means we can
just use the compiler generated copy constructor.

Diff of generated files:
https://gist.github.com/darrnshn/b3f3492858caedc6359a0507dc173dff/revisions

BUG=628043

Review-Url: https://codereview.chromium.org/2799363002
Cr-Commit-Position: refs/heads/master@{#467262}
parent 04c5a199
{% from 'fields/field.tmpl' import encode, declare_storage %}
{% from 'macros.tmpl' import print_if %}
{% macro define_field_group_class(group): -%}
class {{group.type_name}} : public RefCounted<{{group.type_name}}> {
class {{group.type_name}} : public RefCountedCopyable<{{group.type_name}}> {
public:
static PassRefPtr<{{group.type_name}}> Create() {
return AdoptRef(new {{group.type_name}});
......@@ -30,11 +30,6 @@ class {{group.type_name}} : public RefCounted<{{group.type_name}}> {
{% endfor %}
{}
ALWAYS_INLINE {{group.type_name}}(const {{group.type_name}}& other) :
RefCounted<{{group.type_name}}>(),
{% for field in group.fields %}
{{field.name}}(other.{{field.name}}){{print_if(not loop.last, ',')}}
{% endfor %}
{}
{{group.type_name}}(const {{group.type_name}}&) = default;
};
{%- endmacro %}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment