WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
Bug 215642
[WebXR] Make "in parallel" code run really in parallel
https://bugs.webkit.org/show_bug.cgi?id=215642
Summary
[WebXR] Make "in parallel" code run really in parallel
Sergio Villar Senin
Reported
2020-08-19 03:35:01 PDT
[WebXR] Make "in parallel" code run really in parallel
Attachments
Patch
(9.81 KB, patch)
2020-08-19 04:11 PDT
,
Sergio Villar Senin
no flags
Details
Formatted Diff
Diff
Patch
(23.00 KB, patch)
2020-09-03 10:49 PDT
,
Sergio Villar Senin
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Sergio Villar Senin
Comment 1
2020-08-19 04:11:33 PDT
Created
attachment 406833
[details]
Patch
Sergio Villar Senin
Comment 2
2020-08-19 06:11:21 PDT
Committed
r265850
: <
https://trac.webkit.org/changeset/265850
>
Radar WebKit Bug Importer
Comment 3
2020-08-19 06:12:15 PDT
<
rdar://problem/67399148
>
Sergio Villar Senin
Comment 4
2020-08-20 13:07:09 PDT
Reverted
r265850
for reason: Tests crash on debug builds Committed
r265959
: <
https://trac.webkit.org/changeset/265959
>
Sam Weinig
Comment 5
2020-08-23 14:57:42 PDT
Comment on
attachment 406833
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=406833&action=review
> Source/WebCore/Modules/webxr/WebXRSession.cpp:198 > // 2. Run the following steps in parallel:
When a spec says "in parallel", that does actually mean they have to be run on separate threads, it's really just an event loop related hint that the steps don't need to be run immediately in a specific order (
https://html.spec.whatwg.org/#in-parallel
). In WebCore, most of the DOM is not intended to be used from a non-main thread.
Darin Adler
Comment 6
2020-08-23 15:11:38 PDT
Sam said:
> that does actually mean
He meant:
> that does *not* actually mean
Sam Weinig
Comment 7
2020-08-23 16:57:57 PDT
(In reply to Darin Adler from
comment #6
)
> Sam said: > > > that does actually mean > > He meant: > > > that does *not* actually mean
Oh gosh, yeah. That is a pretty major typo. Indeed!
Sergio Villar Senin
Comment 8
2020-08-24 01:45:20 PDT
(In reply to Sam Weinig from
comment #5
)
> Comment on
attachment 406833
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=406833&action=review
> > > Source/WebCore/Modules/webxr/WebXRSession.cpp:198 > > // 2. Run the following steps in parallel: > > When a spec says "in parallel", that does actually mean they have to be run > on separate threads, it's really just an event loop related hint that the > steps don't need to be run immediately in a specific order > (
https://html.spec.whatwg.org/#in-parallel
).
Sure, I didn't imply that "in parallel" only means in a different thread/process, but it's definitely a possibility, isn't it? The standard explicitly mentions "This standard does not define the precise mechanism by which this is achieved, be it time-sharing cooperative multitasking, fibers, threads, processes, using different hyperthreads, cores, CPUs, machines, etc"
> > In WebCore, most of the DOM is not intended to be used from a non-main > thread.
Right but in this case I thought it really did because we're talking about accessing devices in a synchronous (blocking) way. We don't want to stop the main thread because of that. See for example this algorithm:
https://immersive-web.github.io/webxr/#dom-xrsystem-requestsession
Step 5. asks implementors to run the following steps in parallel. In that case I considered that it really meant off the main thread for 2 reasons: a) Step 5.3 is about retrieving the current immersive device which might force us to enumerate the list of immersive devices which is a synchronous operation in which we don't have to block the main thread b) Step 5.4 does not make much sense IMHO if we're not in a different thread, why would we want to queue another task? My interpretation was that we want to do it to run the next steps in the main thread after retrieving the current device in another thread. Granted we could think about a different way to solve it which is to implement
https://immersive-web.github.io/webxr/#obtain-the-current-device
and in consequence
https://immersive-web.github.io/webxr/#ensure-an-immersive-xr-device-is-selected
as async methods with a callback, and then perform the next steps in those callbacks. Would that make more sense? I guess that would still match the "in parallel" interpretation you made. Note that we'd still have to implement the platform code to be run asynchronously either using a different explicit thread, a work queue or the like, wouldn't we?
youenn fablet
Comment 9
2020-08-24 05:43:55 PDT
What typically happens is that you hop to a background thread when doing I/O stuff like reading/writing files. Usually this should be hidden by APIs that would be asynchronous and take a callback. In WebCore DOM code, you would just call this API passing a callback capturing the promise instead of calling a synchronous API and resolving the promise with the result of the synchronous API.
youenn fablet
Comment 10
2020-08-24 05:45:05 PDT
A typical case where you would like to run things in parallel is if you have to enumerate WebXR devices. This might be done once for the whole process or by IPCing to UIProcess. In any case, getting the list of devices would be done through a callback based API.
Sergio Villar Senin
Comment 11
2020-09-03 10:49:37 PDT
Created
attachment 407891
[details]
Patch
Sergio Villar Senin
Comment 12
2020-09-09 10:15:04 PDT
Comment on
attachment 407891
[details]
Patch Not asking for review yet
Sergio Villar Senin
Comment 13
2020-10-15 07:00:37 PDT
Closing this. See
https://bugs.webkit.org/show_bug.cgi?id=217172
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug