Bug 217059

Summary: Add stubs for AudioWorklet
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: Web AudioAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: annulen, benjamin, calvaris, eric.carlson, esprehn+autocc, ews-watchlist, glenn, gyuyoung.kim, jer.noble, kangil.han, kondapallykalyan, macpherson, menard, philipj, ryuan.choi, sergio, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
URL: https://www.w3.org/TR/webaudio/#audioworklet
See Also: https://bugs.webkit.org/show_bug.cgi?id=217549
Bug Depends on:    
Bug Blocks: 217058    
Attachments:
Description Flags
Patch
none
Patch
ews-feeder: commit-queue-
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

Description Chris Dumez 2020-09-28 11:22:36 PDT
Add stubs for AudioWorklet:
- https://www.w3.org/TR/webaudio/#audioworklet
Comment 1 Chris Dumez 2020-09-28 18:10:20 PDT
Created attachment 409936 [details]
Patch
Comment 2 Chris Dumez 2020-09-28 18:23:11 PDT
Created attachment 409937 [details]
Patch
Comment 3 Chris Dumez 2020-09-28 18:41:15 PDT
Created attachment 409942 [details]
Patch
Comment 4 Chris Dumez 2020-09-28 18:43:48 PDT
Created attachment 409944 [details]
Patch
Comment 5 Chris Dumez 2020-09-28 19:35:49 PDT
Created attachment 409953 [details]
Patch
Comment 6 Eric Carlson 2020-09-28 19:43:33 PDT
Comment on attachment 409953 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=409953&action=review

> Source/WebCore/css/DOMCSSPaintWorklet.cpp:76
> +void PaintWorklet::addModule(Document& document, const String& moduleURL, WorkletOptions&&, DOMPromiseDeferred<void>&& promise)
> +{
> +    // FIXME: We should download the source from the URL
> +    // https://bugs.webkit.org/show_bug.cgi?id=191136
> +    auto maybeContext = PaintWorkletGlobalScope::tryCreate(document, ScriptSourceCode(moduleURL));
> +    if (UNLIKELY(!maybeContext)) {
> +        promise.reject(Exception { OutOfMemoryError });
> +        return;
> +    }
> +    auto context = maybeContext.releaseNonNull();
> +    context->evaluate();
> +
> +    auto locker = holdLock(context->paintDefinitionLock());
> +    for (auto& name : context->paintDefinitionMap().keys())
> +        document.setPaintWorkletGlobalScopeForName(name, makeRef(context.get()));
> +    promise.resolve();
> +}
> +

Did you mean to include PaintWorklet changes in this patch?
Comment 7 Chris Dumez 2020-09-28 19:45:45 PDT
(In reply to Eric Carlson from comment #6)
> Comment on attachment 409953 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=409953&action=review
> 
> > Source/WebCore/css/DOMCSSPaintWorklet.cpp:76
> > +void PaintWorklet::addModule(Document& document, const String& moduleURL, WorkletOptions&&, DOMPromiseDeferred<void>&& promise)
> > +{
> > +    // FIXME: We should download the source from the URL
> > +    // https://bugs.webkit.org/show_bug.cgi?id=191136
> > +    auto maybeContext = PaintWorkletGlobalScope::tryCreate(document, ScriptSourceCode(moduleURL));
> > +    if (UNLIKELY(!maybeContext)) {
> > +        promise.reject(Exception { OutOfMemoryError });
> > +        return;
> > +    }
> > +    auto context = maybeContext.releaseNonNull();
> > +    context->evaluate();
> > +
> > +    auto locker = holdLock(context->paintDefinitionLock());
> > +    for (auto& name : context->paintDefinitionMap().keys())
> > +        document.setPaintWorkletGlobalScopeForName(name, makeRef(context.get()));
> > +    promise.resolve();
> > +}
> > +
> 
> Did you mean to include PaintWorklet changes in this patch?

Yes, I moved paint Worklet specific code out of the generic Worklet code and to a PaintWorklet subclass.
Comment 8 Chris Dumez 2020-09-29 08:35:24 PDT
Created attachment 410003 [details]
Patch
Comment 9 Chris Dumez 2020-09-29 08:38:41 PDT
Created attachment 410004 [details]
Patch
Comment 10 EWS 2020-09-29 09:47:45 PDT
Committed r267744: <https://trac.webkit.org/changeset/267744>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 410004 [details].
Comment 11 Radar WebKit Bug Importer 2020-09-29 09:48:25 PDT
<rdar://problem/69751498>