Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit 629d0f5

Browse files
Constructing a AudioWorkletNode should construct an AudioWorkletProcessor on the Worklet thread
https://bugs.webkit.org/show_bug.cgi?id=217442 Reviewed by Geoffrey Garen. LayoutTests/imported/w3c: Rebaseline WPT tests now that we are passing more checks. * web-platform-tests/webaudio/the-audio-api/the-audiocontext-interface/processing-after-resume.https-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-messageport.https-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletglobalscope-timing-info.https-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletprocessor-options.https-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/processor-construction-port.https-expected.txt: * web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/suspended-context-messageport.https-expected.txt: Source/WebCore: Constructing a AudioWorkletNode should construct an AudioWorkletProcessor on the Worklet thread: - https://www.w3.org/TR/webaudio/#AudioWorkletNode-constructors (Step 13) No new tests, rebaselined existing tests. * Modules/webaudio/AudioWorklet.cpp: (WebCore::AudioWorklet::createProcessor): Add createProcessor() function to AudioWorklet which takes care of hopping to the worklet thread in order to call createProcessor() on the AudioWorkletGlobalScope. * Modules/webaudio/AudioWorklet.h: * Modules/webaudio/AudioWorkletGlobalScope.cpp: (WebCore::AudioWorkletGlobalScope::createProcessor): Construct an AudioWorkletProcessor, as specified here: - https://www.w3.org/TR/webaudio/#AudioWorkletProcessor-instantiation (WebCore::AudioWorkletGlobalScope::takePendingProcessorConstructionData): A function to take the pending ProcessorConstructionData. This construction data gets initialized in createProcessor() and gets consumed by AudioWorkletProcessor::create(). * Modules/webaudio/AudioWorkletGlobalScope.h: * Modules/webaudio/AudioWorkletNode.cpp: (WebCore::AudioWorkletNode::create): Improve AudioWorkletNode constructor to actually cause the construction of the AudioWorkletProcessor on the worklet thread, passing it the options and the MessagePort. This is as per the specification here: - https://www.w3.org/TR/webaudio/#AudioWorkletNode-constructors (WebCore::AudioWorkletNode::AudioWorkletNode): (WebCore::AudioWorkletNode::~AudioWorkletNode): (WebCore::AudioWorkletNode::setProcessor): Once the AudioWorkletProcessor is created on the worklet thread, this gets called so that the AudioWorkletNode has a reference to the processor. This will be needed later on once AudioWorkletNode::process() starts doing audio processing through the AudioWorkletProcessor. (WebCore::AudioWorkletNode::process): Improve comment. * Modules/webaudio/AudioWorkletNode.h: * Modules/webaudio/AudioWorkletNode.idl: Pass the global object to the constructor. It is needed now that the constructor serializes script values to pass them to the worklet thread. * Modules/webaudio/AudioWorkletNodeOptions.idl: Add [JSGenerateToJSObject] to AudioWorkletNodeOptions dictionary so that a convertDictionaryToJS() function gets generated for this dictionary. This function is called by the AudioWorkletNode constructor. * Modules/webaudio/AudioWorkletProcessor.cpp: (WebCore::AudioWorkletProcessor::create): (WebCore::AudioWorkletProcessor::AudioWorkletProcessor): * Modules/webaudio/AudioWorkletProcessor.h: (WebCore::AudioWorkletProcessor::name const): (WebCore::AudioWorkletProcessor::port): Implement AudioWorkletProcessor constructor so that its retrieves the pending construction data from the AudioWorkletGlobalScope and properly initializes its name and port. The specification for this is here: - https://www.w3.org/TR/webaudio/#dom-audioworkletprocessor-audioworkletprocessor * Modules/webaudio/AudioWorkletProcessor.idl: Indicate that the constructor may throw an exception as per the specification: - https://www.w3.org/TR/webaudio/#dom-audioworkletprocessor-audioworkletprocessor (Step 1) Also pass the ScriptExecutionContext to the constructor since the constructor needs to retrieve the pending construction data from it: - https://www.w3.org/TR/webaudio/#dom-audioworkletprocessor-audioworkletprocessor (Step 1) * Modules/webaudio/AudioWorkletProcessorConstructionData.h: (WebCore::AudioWorkletProcessorConstructionData::AudioWorkletProcessorConstructionData): (WebCore::AudioWorkletProcessorConstructionData::name const): (WebCore::AudioWorkletProcessorConstructionData::port const): Add class to wrap the AudioWorkletProcess's construction data: - https://www.w3.org/TR/webaudio/#pending-processor-construction-data * Modules/webaudio/AudioWorkletThread.h: Move ThreadSafeRefCounted from this class to the parent class (WorkerOrWorkletThread) since WorkerMessagePortChannelProvider needs to protect a WorkerOrWorkletThread now. * WebCore.xcodeproj/project.pbxproj: Add new header to project. * bindings/js/JSDOMGlobalObject.cpp: (WebCore::toJSDOMGlobalObject): Properly handle WorkletGlobalScope. * dom/MessagePort.cpp: (WebCore::MessagePort::disentangle): (WebCore::MessagePort::disentanglePorts): (WebCore::MessagePort::entanglePorts): (WebCore::MessagePort::entangle): * dom/MessagePort.h: Tweak MessagePort API to support disentangling/entangling a single MessagePort. Previously we had to pass an array of ports. * dom/ScriptExecutionContext.cpp: (WebCore::ScriptExecutionContext::createdMessagePort): (WebCore::ScriptExecutionContext::destroyedMessagePort): Tweak assertions to handle AudioWorkletGlobalScopes. * dom/messageports/MessagePortChannelProvider.cpp: (WebCore::MessagePortChannelProvider::fromContext): * dom/messageports/MessageWithMessagePorts.h: * dom/messageports/WorkerMessagePortChannelProvider.cpp: (WebCore::WorkerMessagePortChannelProvider::WorkerMessagePortChannelProvider): (WebCore::WorkerMessagePortChannelProvider::takeAllMessagesForPort): (WebCore::WorkerMessagePortChannelProvider::checkRemotePortForActivity): * dom/messageports/WorkerMessagePortChannelProvider.h: Update WorkerMessagePortChannelProvider to use WorkerOrWorkletScope instead or WorkerGlobalScope. This allows us to reuse this class for AudioWorklets so that MessagePort communication between the main thread and the worklet thread now works. * workers/WorkerOrWorkletThread.h: Move ThreadSafeRefCounted from subclasses to this class so that WorkerMessagePortChannelProvider can protect a WorkerOrWorkletThread. * workers/WorkerThread.h: * worklets/WorkletGlobalScope.cpp: (WebCore::WorkletGlobalScope::notifyFinished): Only evaluate the script if we have not already evaluated it in this worklet. I am assuming this is needed because we are not treating the script as a module yet (due to lack of support in workers). Without this changes, the worklet's script would get in a bad state when importing several times the same module (which is something the WPT tests do). (WebCore::WorkletGlobalScope::messagePortChannelProvider): Instantiate WorkerMessagePortChannelProvider if needed. This is needed for MessagePort communication is AudioWorklets. * worklets/WorkletGlobalScope.h: LayoutTests: Unskip a few tests that are no longer timing out. * TestExpectations: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@268161 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 64da6d6 commit 629d0f5

36 files changed

+502
-90
lines changed

LayoutTests/ChangeLog

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
2020-10-07 Chris Dumez <[email protected]>
2+
3+
Constructing a AudioWorkletNode should construct an AudioWorkletProcessor on the Worklet thread
4+
https://bugs.webkit.org/show_bug.cgi?id=217442
5+
6+
Reviewed by Geoffrey Garen.
7+
8+
Unskip a few tests that are no longer timing out.
9+
10+
* TestExpectations:
11+
112
2020-10-07 Tyler Wilcock <[email protected]>
213

314
background-clip:var(--a) invalidates -webkit-background-clip:text when --a:text

LayoutTests/TestExpectations

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,20 +320,15 @@ imported/w3c/web-platform-tests/html/webappapis/scripting/event-loops/fully_acti
320320
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-mediastreamaudiosourcenode-interface/mediastreamaudiosourcenode-routing.html [ Skip ]
321321

322322
# These webaudio tests are timing out due to lack for support for AudioWorklet.
323-
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audiocontext-interface/processing-after-resume.https.html [ Skip ]
324-
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-messageport.https.html [ Skip ]
325323
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-postmessage-sharedarraybuffer.https.html [ Skip ]
326-
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletglobalscope-timing-info.https.html [ Skip ]
327324
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-automatic-pull.https.html [ Skip ]
328325
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-onerror.https.html [ Skip ]
329326
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletnode-output-channel-count.https.html [ Skip ]
330-
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletprocessor-options.https.html [ Skip ]
331327
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletprocessor-process-frozen-array.https.html [ Skip ]
332328
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletprocessor-process-zero-outputs.https.html [ Skip ]
333329
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletprocessor-promises.https.html [ Skip ]
334330
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/process-getter.https.html [ Skip ]
335331
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/process-parameters.https.html [ Skip ]
336-
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/suspended-context-messageport.https.html [ Skip ]
337332
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-channelmergernode-interface/active-processing.https.html [ Skip ]
338333
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-convolvernode-interface/active-processing.https.html [ Skip ]
339334
imported/w3c/web-platform-tests/webaudio/the-audio-api/the-mediaelementaudiosourcenode-interface/cors-check.https.html [ Skip ]

LayoutTests/imported/w3c/ChangeLog

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
2020-10-07 Chris Dumez <[email protected]>
2+
3+
Constructing a AudioWorkletNode should construct an AudioWorkletProcessor on the Worklet thread
4+
https://bugs.webkit.org/show_bug.cgi?id=217442
5+
6+
Reviewed by Geoffrey Garen.
7+
8+
Rebaseline WPT tests now that we are passing more checks.
9+
10+
* web-platform-tests/webaudio/the-audio-api/the-audiocontext-interface/processing-after-resume.https-expected.txt:
11+
* web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworklet-messageport.https-expected.txt:
12+
* web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletglobalscope-timing-info.https-expected.txt:
13+
* web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/audioworkletprocessor-options.https-expected.txt:
14+
* web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/processor-construction-port.https-expected.txt:
15+
* web-platform-tests/webaudio/the-audio-api/the-audioworklet-interface/suspended-context-messageport.https-expected.txt:
16+
117
2020-10-07 Noam Rosenthal <[email protected]>
218

319
clip-path: path() ignores page zooming (Command-+)
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11

2-
Harness Error (TIMEOUT), message = null
3-
4-
TIMEOUT Test consistency of processing after resume() Test timed out
2+
PASS Test consistency of processing after resume()
53

Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11

2-
Harness Error (TIMEOUT), message = null
3-
42
PASS # AUDIT TASK RUNNER STARTED.
5-
TIMEOUT Executing "Test postMessage from AudioWorkletProcessor to AudioWorkletNode" Test timed out
6-
NOTRUN Executing "Test postMessage from AudioWorkletNode to AudioWorkletProcessor"
7-
NOTRUN Audit report
3+
PASS Executing "Test postMessage from AudioWorkletProcessor to AudioWorkletNode"
4+
PASS Executing "Test postMessage from AudioWorkletNode to AudioWorkletProcessor"
5+
PASS Audit report
86
PASS > [Test postMessage from AudioWorkletProcessor to AudioWorkletNode]
7+
PASS The initial message from PortProcessor is equal to created.
8+
PASS < [Test postMessage from AudioWorkletProcessor to AudioWorkletNode] All assertions passed. (total 1 assertions)
9+
PASS > [Test postMessage from AudioWorkletNode to AudioWorkletProcessor]
10+
PASS The response from PortProcessor is equal to hello.
11+
PASS < [Test postMessage from AudioWorkletNode to AudioWorkletProcessor] All assertions passed. (total 1 assertions)
12+
PASS # AUDIT TASK RUNNER FINISHED: 2 tasks ran successfully.
913

Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
11

2-
Harness Error (TIMEOUT), message = null
3-
42
PASS # AUDIT TASK RUNNER STARTED.
5-
TIMEOUT Executing "Check the timing information from AudioWorkletProcessor" Test timed out
6-
NOTRUN Audit report
3+
PASS Executing "Check the timing information from AudioWorkletProcessor"
4+
PASS Audit report
75
PASS > [Check the timing information from AudioWorkletProcessor]
6+
PASS currentFrame from the processor at 0 is equal to 0.
7+
PASS currentTime from the processor at 0 is equal to 0.
8+
PASS currentFrame from the processor at 128 is equal to 128.
9+
PASS currentTime from the processor at 0.0026666666666666666 is equal to 0.0026666666666666666.
10+
PASS currentFrame from the processor at 256 is equal to 256.
11+
PASS currentTime from the processor at 0.005333333333333333 is equal to 0.005333333333333333.
12+
PASS currentFrame from the processor at 384 is equal to 384.
13+
PASS currentTime from the processor at 0.008 is equal to 0.008.
14+
PASS < [Check the timing information from AudioWorkletProcessor] All assertions passed. (total 8 assertions)
15+
PASS # AUDIT TASK RUNNER FINISHED: 1 tasks ran successfully.
816

Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11

2-
Harness Error (TIMEOUT), message = null
3-
42
PASS # AUDIT TASK RUNNER STARTED.
5-
TIMEOUT Executing "valid-processor-data" Test timed out
6-
NOTRUN Executing "empty-option"
7-
NOTRUN Audit report
3+
PASS Executing "valid-processor-data"
4+
PASS Executing "empty-option"
5+
PASS Audit report
86
PASS > [valid-processor-data]
7+
PASS |description| field in processorOptions from processor("foo") is equal to the field in node constructor options ("foo").
8+
PASS |payload| array in processorOptions from processor([0,1,2,3]) is identical to the array the array in node constructor options ([0,1,2,3]).
9+
PASS < [valid-processor-data] All assertions passed. (total 2 assertions)
10+
PASS > [empty-option]
11+
PASS Number of properties in data from processor is equal to 2.
12+
PASS |numberOfInputs| field in data from processor is equal to 1.
13+
PASS |numberOfOutputs| field in data from processor is identical to the array 1.
14+
PASS < [empty-option] All assertions passed. (total 3 assertions)
15+
PASS # AUDIT TASK RUNNER FINISHED: 2 tasks ran successfully.
916

Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

22
Harness Error (TIMEOUT), message = null
33

4-
TIMEOUT super() after new AudioWorkletProcessor() Test timed out
5-
NOTRUN new AudioWorkletProcessor() after super()
6-
NOTRUN new AudioWorkletProcessor() after new AudioWorkletProcessor()
7-
NOTRUN Singleton AudioWorkletProcessor
4+
PASS super() after new AudioWorkletProcessor()
5+
PASS new AudioWorkletProcessor() after super()
6+
PASS new AudioWorkletProcessor() after new AudioWorkletProcessor()
7+
TIMEOUT Singleton AudioWorkletProcessor Test timed out
88

Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11

2-
Harness Error (TIMEOUT), message = null
3-
4-
TIMEOUT realtime suspended Test timed out
5-
NOTRUN offline before start
6-
NOTRUN offline on complete
2+
PASS realtime suspended
3+
PASS offline before start
4+
FAIL offline on complete promise_test: Unhandled rejection with value: object "InvalidStateError: Context is closed"
75

Source/WebCore/ChangeLog

Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,146 @@
1+
2020-10-07 Chris Dumez <[email protected]>
2+
3+
Constructing a AudioWorkletNode should construct an AudioWorkletProcessor on the Worklet thread
4+
https://bugs.webkit.org/show_bug.cgi?id=217442
5+
6+
Reviewed by Geoffrey Garen.
7+
8+
Constructing a AudioWorkletNode should construct an AudioWorkletProcessor on the Worklet thread:
9+
- https://www.w3.org/TR/webaudio/#AudioWorkletNode-constructors (Step 13)
10+
11+
No new tests, rebaselined existing tests.
12+
13+
* Modules/webaudio/AudioWorklet.cpp:
14+
(WebCore::AudioWorklet::createProcessor):
15+
Add createProcessor() function to AudioWorklet which takes care of hopping to the worklet thread
16+
in order to call createProcessor() on the AudioWorkletGlobalScope.
17+
18+
* Modules/webaudio/AudioWorklet.h:
19+
20+
* Modules/webaudio/AudioWorkletGlobalScope.cpp:
21+
(WebCore::AudioWorkletGlobalScope::createProcessor):
22+
Construct an AudioWorkletProcessor, as specified here:
23+
- https://www.w3.org/TR/webaudio/#AudioWorkletProcessor-instantiation
24+
25+
(WebCore::AudioWorkletGlobalScope::takePendingProcessorConstructionData):
26+
A function to take the pending ProcessorConstructionData. This construction
27+
data gets initialized in createProcessor() and gets consumed by
28+
AudioWorkletProcessor::create().
29+
30+
* Modules/webaudio/AudioWorkletGlobalScope.h:
31+
32+
* Modules/webaudio/AudioWorkletNode.cpp:
33+
(WebCore::AudioWorkletNode::create):
34+
Improve AudioWorkletNode constructor to actually cause the construction of
35+
the AudioWorkletProcessor on the worklet thread, passing it the options and
36+
the MessagePort. This is as per the specification here:
37+
- https://www.w3.org/TR/webaudio/#AudioWorkletNode-constructors
38+
39+
(WebCore::AudioWorkletNode::AudioWorkletNode):
40+
(WebCore::AudioWorkletNode::~AudioWorkletNode):
41+
42+
(WebCore::AudioWorkletNode::setProcessor):
43+
Once the AudioWorkletProcessor is created on the worklet thread, this gets
44+
called so that the AudioWorkletNode has a reference to the processor. This
45+
will be needed later on once AudioWorkletNode::process() starts doing audio
46+
processing through the AudioWorkletProcessor.
47+
48+
(WebCore::AudioWorkletNode::process):
49+
Improve comment.
50+
51+
* Modules/webaudio/AudioWorkletNode.h:
52+
* Modules/webaudio/AudioWorkletNode.idl:
53+
Pass the global object to the constructor. It is needed now that the constructor
54+
serializes script values to pass them to the worklet thread.
55+
56+
* Modules/webaudio/AudioWorkletNodeOptions.idl:
57+
Add [JSGenerateToJSObject] to AudioWorkletNodeOptions dictionary so that a
58+
convertDictionaryToJS() function gets generated for this dictionary. This function
59+
is called by the AudioWorkletNode constructor.
60+
61+
* Modules/webaudio/AudioWorkletProcessor.cpp:
62+
(WebCore::AudioWorkletProcessor::create):
63+
(WebCore::AudioWorkletProcessor::AudioWorkletProcessor):
64+
* Modules/webaudio/AudioWorkletProcessor.h:
65+
(WebCore::AudioWorkletProcessor::name const):
66+
(WebCore::AudioWorkletProcessor::port):
67+
Implement AudioWorkletProcessor constructor so that its retrieves the pending
68+
construction data from the AudioWorkletGlobalScope and properly initializes
69+
its name and port. The specification for this is here:
70+
- https://www.w3.org/TR/webaudio/#dom-audioworkletprocessor-audioworkletprocessor
71+
72+
* Modules/webaudio/AudioWorkletProcessor.idl:
73+
Indicate that the constructor may throw an exception as per the specification:
74+
- https://www.w3.org/TR/webaudio/#dom-audioworkletprocessor-audioworkletprocessor (Step 1)
75+
Also pass the ScriptExecutionContext to the constructor since the constructor
76+
needs to retrieve the pending construction data from it:
77+
- https://www.w3.org/TR/webaudio/#dom-audioworkletprocessor-audioworkletprocessor (Step 1)
78+
79+
* Modules/webaudio/AudioWorkletProcessorConstructionData.h:
80+
81+
(WebCore::AudioWorkletProcessorConstructionData::AudioWorkletProcessorConstructionData):
82+
(WebCore::AudioWorkletProcessorConstructionData::name const):
83+
(WebCore::AudioWorkletProcessorConstructionData::port const):
84+
Add class to wrap the AudioWorkletProcess's construction data:
85+
- https://www.w3.org/TR/webaudio/#pending-processor-construction-data
86+
87+
* Modules/webaudio/AudioWorkletThread.h:
88+
Move ThreadSafeRefCounted from this class to the parent class (WorkerOrWorkletThread)
89+
since WorkerMessagePortChannelProvider needs to protect a WorkerOrWorkletThread now.
90+
91+
* WebCore.xcodeproj/project.pbxproj:
92+
Add new header to project.
93+
94+
* bindings/js/JSDOMGlobalObject.cpp:
95+
(WebCore::toJSDOMGlobalObject):
96+
Properly handle WorkletGlobalScope.
97+
98+
* dom/MessagePort.cpp:
99+
(WebCore::MessagePort::disentangle):
100+
(WebCore::MessagePort::disentanglePorts):
101+
(WebCore::MessagePort::entanglePorts):
102+
(WebCore::MessagePort::entangle):
103+
* dom/MessagePort.h:
104+
Tweak MessagePort API to support disentangling/entangling a single
105+
MessagePort. Previously we had to pass an array of ports.
106+
107+
* dom/ScriptExecutionContext.cpp:
108+
(WebCore::ScriptExecutionContext::createdMessagePort):
109+
(WebCore::ScriptExecutionContext::destroyedMessagePort):
110+
Tweak assertions to handle AudioWorkletGlobalScopes.
111+
112+
* dom/messageports/MessagePortChannelProvider.cpp:
113+
(WebCore::MessagePortChannelProvider::fromContext):
114+
* dom/messageports/MessageWithMessagePorts.h:
115+
* dom/messageports/WorkerMessagePortChannelProvider.cpp:
116+
(WebCore::WorkerMessagePortChannelProvider::WorkerMessagePortChannelProvider):
117+
(WebCore::WorkerMessagePortChannelProvider::takeAllMessagesForPort):
118+
(WebCore::WorkerMessagePortChannelProvider::checkRemotePortForActivity):
119+
* dom/messageports/WorkerMessagePortChannelProvider.h:
120+
Update WorkerMessagePortChannelProvider to use WorkerOrWorkletScope instead
121+
or WorkerGlobalScope. This allows us to reuse this class for AudioWorklets
122+
so that MessagePort communication between the main thread and the worklet
123+
thread now works.
124+
125+
* workers/WorkerOrWorkletThread.h:
126+
Move ThreadSafeRefCounted from subclasses to this class so that
127+
WorkerMessagePortChannelProvider can protect a WorkerOrWorkletThread.
128+
129+
* workers/WorkerThread.h:
130+
* worklets/WorkletGlobalScope.cpp:
131+
(WebCore::WorkletGlobalScope::notifyFinished):
132+
Only evaluate the script if we have not already evaluated it in this worklet.
133+
I am assuming this is needed because we are not treating the script as a module
134+
yet (due to lack of support in workers). Without this changes, the worklet's
135+
script would get in a bad state when importing several times the same module
136+
(which is something the WPT tests do).
137+
138+
(WebCore::WorkletGlobalScope::messagePortChannelProvider):
139+
Instantiate WorkerMessagePortChannelProvider if needed. This is needed for
140+
MessagePort communication is AudioWorklets.
141+
142+
* worklets/WorkletGlobalScope.h:
143+
1144
2020-10-07 Chris Dumez <[email protected]>
2145

3146
Crash under JSAudioWorkletProcessorConstructor::~JSAudioWorkletProcessorConstructor()

0 commit comments

Comments
 (0)