chromium/third_party/blink/web_tests/http/tests/inspector-protocol/emulation/resources/pressure-observer-worker.js

onmessage = async function(e) {
  const observer = new PressureObserver((records) => {
    const flattenedRecords = [];
    records.forEach((record) => {
      flattenedRecords.push([record.source, record.state]);
    });

    postMessage({records: flattenedRecords});

    observer.disconnect();
    close();
  });
  await observer.observe('cpu');
};