chromium/components/exo/wayland/compatibility_test/template_client_helpers.cc.tmpl

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

{% if protocol.name == 'wayland' %}
#include <wayland-client-core.h>
{% endif %}
#include "components/exo/wayland/compatibility_test/generated-{{ protocol.filename|kebab }}-client-helpers.h"


namespace std {

{% for interface in protocol.interfaces|sort(attribute="name") %}
void default_delete<struct {{ interface.name }}>::operator()(struct {{ interface.name }}* instance) noexcept {
    if (instance)
    {% if interface.name == 'wl_display' %}
        wl_display_disconnect(instance);
    {% else %}
        {{ interface.name }}_{{ get_destructor(interface).name or "destroy" }}(instance);
    {% endif %}
}

{% endfor %}

}  // namespace std

{% for interface in protocol.interfaces|sort(attribute="name") %}
const wl_interface*
    WaylandGlobalInterfaceDescriptor<struct {{ interface.name }}>::protocol_interface =
        &{{ interface.name }}_interface;

{% endfor %}