Commit b8c5eb85 authored by Hitoshi Yoshida's avatar Hitoshi Yoshida Committed by Commit Bot

bindings: Add a migration adapter of IDL compilers

The code generator will be updated soon (issue 839389), and the new
generator does not generate WTF::String for IDL enumerations.
In gpu_device.cc, the return type of descriptor->extensions() in the
constructor will be Vector<V8GPUExtensionName> from Vector<String>.

This CL as an adapter function to make the generators migration easy.
The function makes a Vector<String> from either of Vector<String> or
Vector<V8GPUExtensionName>.


Bug: 839389, 1092328
Change-Id: Ib3c96f1509fa3ba1986222a13f591b42b9759258
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2352258
Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Reviewed-by: default avatarKai Ninomiya <kainino@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799021}
parent 8c6277bf
......@@ -8,6 +8,7 @@
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_gpu_device_descriptor.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_gpu_extension_name.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_gpu_uncaptured_error_event_init.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/inspector/console_message.h"
......@@ -32,6 +33,20 @@
namespace blink {
namespace {
#ifdef USE_BLINK_V8_BINDING_NEW_IDL_DICTIONARY
Vector<String> ToStringVector(
const Vector<V8GPUExtensionName>& gpu_extension_names) {
Vector<String> result;
for (auto& name : gpu_extension_names)
result.push_back(IDLEnumAsString(name));
return result;
}
#endif
} // anonymous namespace
// TODO(enga): Handle adapter options and device descriptor
GPUDevice::GPUDevice(ExecutionContext* execution_context,
scoped_refptr<DawnControlClientHolder> dawn_control_client,
......@@ -43,7 +58,11 @@ GPUDevice::GPUDevice(ExecutionContext* execution_context,
client_id,
dawn_control_client->GetInterface()->GetDevice(client_id)),
adapter_(adapter),
#ifdef USE_BLINK_V8_BINDING_NEW_IDL_DICTIONARY
extension_name_list_(ToStringVector(descriptor->extensions())),
#else
extension_name_list_(descriptor->extensions()),
#endif
queue_(MakeGarbageCollected<GPUQueue>(
this,
GetProcs().deviceGetDefaultQueue(GetHandle()))),
......
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