Remove legacy callback handling.

Prior to types 'callback info' and 'callback function' we had to identify async methods by hand. All the old methods have been out for a while now.

Bug: 427302682
Test: Manual
Change-Id: I54622c71a40cb52ead78cc468447eff77c282e27
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/248454
Commit-Queue: Jim Blackler <jimblackler@google.com>
Reviewed-by: Loko Kung <lokokung@google.com>
diff --git a/generator/dawn_json_generator.py b/generator/dawn_json_generator.py
index f9fd104..b3fee3d 100644
--- a/generator/dawn_json_generator.py
+++ b/generator/dawn_json_generator.py
@@ -799,17 +799,6 @@
     def jni_name(type):
         return kt_file_path + '/' + type.name.CamelCase()
 
-    # We assume that if the final two parameters are named 'userdata' and 'callback' respectively
-    # that this is an async method that uses function pointer based callbacks.
-    def is_async_method(method):
-        if len(method.arguments) < 2:
-            return False  # Not enough parameters to be an async method.
-        if method.arguments[-1].name.get() != 'userdata':
-            return False
-        if method.arguments[-2].name.get() != 'callback':
-            return False
-        return True
-
     # A structure may need to know which other structures listed it as a chain root, e.g.
     # to know whether to mark the generated class 'open'.
     chain_children = defaultdict(list)
@@ -823,7 +812,6 @@
     params_kotlin['include_structure'] = include_structure
     params_kotlin['kotlin_record_members'] = kotlin_record_members
     params_kotlin['jni_name'] = jni_name
-    params_kotlin['is_async_method'] = is_async_method
     params_kotlin['has_kotlin_classes'] = (
         by_category['callback function'] + by_category['callback info'] +
         by_category['enum'] + by_category['function pointer'] +
diff --git a/generator/templates/art/api_kotlin_async_helpers.kt b/generator/templates/art/api_kotlin_async_helpers.kt
index 3698661..21b1d84 100644
--- a/generator/templates/art/api_kotlin_async_helpers.kt
+++ b/generator/templates/art/api_kotlin_async_helpers.kt
@@ -30,44 +30,6 @@
 import kotlin.coroutines.suspendCoroutine
 {% from 'art/api_kotlin_types.kt' import kotlin_declaration, kotlin_definition with context %}
 
-//* Legacy callback pattern: we make a return class for every function pointer so that usage of
-//* callback-using methods can be replaced with suspend (async) function that returns the same data.
-{% for function_pointer
-        in by_category['function pointer'] if len(function_pointer.name.chunks) > 1 %}
-    //* Function pointers generally end in Callback which we replace with Return.
-    {% set return_name = function_pointer.name.chunks[:-1] | map('title') | join + 'Return' %}
-    public data class {{ return_name }}(
-        {% for arg in kotlin_record_members(function_pointer.arguments) %}
-            val {{ as_varName(arg.name) }}: {{ kotlin_declaration(arg) }},
-        {% endfor %})
-{% endfor %}
-
-//* Legacy callback pattern: every method that is identified as using callbacks is given a helper
-//* method that wraps the call with a suspend function.
-{% for obj in by_category['object'] %}
-    {% for method in obj.methods if is_async_method(method) %}
-        {% set function_pointer = method.arguments[-2].type %}
-        {% set return_name = function_pointer.name.chunks[:-1] | map('title') | join + 'Return' %}
-        public suspend fun {{ obj.name.CamelCase() }}.{{ method.name.camelCase() }}(
-            {%- for arg in method.arguments[:-2] %}
-                {{- as_varName(arg.name) }}: {{ kotlin_definition(arg) }},
-            {%- endfor %}): {{ return_name }} = suspendCoroutine {
-                {{ method.name.camelCase() }}(
-                    {%- for arg in method.arguments[:-2] %}
-                        {{- as_varName(arg.name) }},
-                    {% endfor %}) {
-                    {%- for arg in kotlin_record_members(function_pointer.arguments) %}
-                        {{- as_varName(arg.name) }},
-                    {%- endfor %} -> it.resume({{ return_name }}(
-                        {%- for arg in kotlin_record_members(function_pointer.arguments) %}
-                            {{- as_varName(arg.name) }},
-                        {%- endfor %})
-                    )
-                }
-            }
-    {% endfor %}
-{% endfor %}
-
 //* Provide an async wrapper for the 'callback info' type of async methods.
 {% for obj in by_category['object'] %}
     {% for method in obj.methods if has_callbackInfoStruct(method) %}