From ScriptProcessor
// script.js
button.onclick = async () => {
const microphoneStream = await navigator.mediaDevices.getUserMedia({
audio: true,
});
chrome.action.onClicked.addListener(async () => { | |
const adapter = await navigator.gpu.requestAdapter(); | |
const device = await adapter.requestDevice(); | |
const canvas = new OffscreenCanvas(256, 256); | |
const context = canvas.getContext("webgpu"); | |
const format = navigator.gpu.getPreferredCanvasFormat(); | |
context.configure({ device, format }); | |
const code = ` |
$ git diff --no-index chrome-webgpureport.txt safari-webgpureport.txt | |
diff --git a/chrome-webgpureport.txt b/safari-webgpureport.txt | |
index 67fffd7..3b6ed7c 100644 | |
--- a/chrome-webgpureport.txt | |
+++ b/safari-webgpureport.txt | |
@@ -2,9 +2,9 @@ WebGPU Report | |
adapter info: | |
------------- | |
-architecture common-3 |
// script.js
button.onclick = async () => {
const microphoneStream = await navigator.mediaDevices.getUserMedia({
audio: true,
});
const fs = require("fs"); | |
const LEGACY_UUIDS = { | |
"0x180F": "battery_service", | |
"0x2900": "gatt.characteristic_extended_properties", | |
"0x2901": "gatt.characteristic_user_description", | |
"0x2902": "gatt.client_characteristic_configuration", | |
"0x2903": "gatt.server_characteristic_configuration", | |
"0x2904": "gatt.characteristic_presentation_format", | |
"0x2905": "gatt.characteristic_aggregate_format", |
0x05, 0x01, // Usage Page (Generic Desktop Ctrls) | |
0x09, 0x02, // Usage (Mouse) | |
0xA1, 0x01, // Collection (Application) | |
0x09, 0x01, // Usage (Pointer) | |
0xA1, 0x00, // Collection (Physical) | |
0x05, 0x09, // Usage Page (Button) | |
0x19, 0x01, // Usage Minimum (0x01) | |
0x29, 0x03, // Usage Maximum (0x03) | |
0x15, 0x00, // Logical Minimum (0) | |
0x25, 0x01, // Logical Maximum (1) |
diff --git a/third_party/blink/renderer/modules/webgpu/gpu_buffer.cc b/third_party/blink/renderer/modules/webgpu/gpu_buffer.cc | |
index 9658796f2508..37a106c741f6 100644 | |
--- a/third_party/blink/renderer/modules/webgpu/gpu_buffer.cc | |
+++ b/third_party/blink/renderer/modules/webgpu/gpu_buffer.cc | |
@ -127,6 +131,25 @@ void GPUBuffer::OnMapAsyncCallback(ScriptPromiseResolver* resolver, | |
WTF::ArrayBufferContents::SharingType::kNotShared); | |
mapped_buffer_ = DOMArrayBuffer::Create(contents); | |
+ | |
+ auto* script_state = resolver->GetScriptState(); |
// In an ideal world, MSE would be that simple... | |
const mediaSource = new MediaSource() | |
video.srcObject = mediaSource | |
await mediaSource.ready | |
const sourceBuffer = mediaSource.addSourceBuffer('video/mp4') | |
const response = await fetch('https://example.com/init.mp4') |
// Promise.prototype.finally | |
fetch('http://foo.bar') | |
.then(response => console.log(response)) | |
.catch(error => console.log(error)) | |
.finally(_ => console.log('finally')) | |
// try/catch/finally with Async/Await |