-
Notifications
You must be signed in to change notification settings - Fork 1.7k
provide API for spawning DOM isolates #3050
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This comment was originally written by @pjako Let me get that right, the domisoltes are the isolates that still have limited access to the dom (see: https://developer.mozilla.org/en/DOM/Worker/Functions_available_to_workers) or have dom isolates full access to the dom? Now the plan is that we have to use spawnUri to spawn new domisolates wouldn't that force us to send only strings instead of any type of object? (see: http://www.dartlang.org/docs/language-tour/#send-any-type-of-object) |
Good question. We also need to figure that out. One idea was to have 3 spawning functions for the dom:
|
This comment was originally written by @pjako That sounds quite good, however why should we have an special call "spawnFunctionInWorker()" instead of the normal call you have on the server "spawnFunction()" why would anyone brother to have something else on a dartium client then a worker isolate when spawnFunctionInWorker is used? |
This comment was originally written by @pjako Sorry I meant: |
This comment was originally written by [email protected] p4jako, workers are intentionally heavy-weight (at least the last time I looked into the spec) while we expect Dart isolates be very very lightweight. So honestly I don't know the right answer for workers vs. Dart isolates for the given question. Having too APIs looks bad too. My immediate stance would be: let's keep simple Dart isolates which know nothing of Worker API. spawnUriInWindow(Window window, String/Uri uri) looks great for me. |
This comment was originally written by @pjako My concern is mainly being able to send any type of object to workers(/isolates). |
This comment was originally written by @seaneagan in that case, would probably want to make it an instance method: interface Window { |
Added Library-Isolates label. |
Removed Isolates label. |
Added Library-Isolate label. |
Removed Library-Isolates label. |
I think a spawnDomIsolate (or whatever name) should be in dart:html, not dart:isolate, since dart:isolate must work outside the browser too. It should have the same arguments and behavior as Isolate.spawnUri/Isolate.spawnUri, it just allows importing and using "dart:html". Removed Library-Isolate label. |
This comment was originally written by [email protected] Not sure if this directly related or should be a separate issue but could you just allow Websocket (which is part of dart:html) to be used in Isolate (browser isolate, so with webworker) ? |
Removed Type-Defect label. |
Re #14. We can't "just" do that, but we might do it. One issue is that Dartium doesn't spawn workers in the background, it spawns dart isolates, so they have no context at all. That might be https://code.google.com/p/dart/issues/detail?id=21573 , but might be another bug as well. Even if it's a worker, that has a limited API that isn't the same as dart:html exposes. The fact that it works in dartj2s is a bit of a coincidence in that the APIs are the same and it doesn't rely on anything missing. In Dartium it would be more complicated, because we're going through C++ bindings. Relying on it failing in an acceptable way if you call an unavailable API is less of an option in C++. Splitting out a dart:websocket would be one option. However, if we have a worker, then it would at least be possible to call WebSocket APIs through JS interop as a workaround. I'm going to split off the websocket issue as https://code.google.com/p/dart/issues/detail?id=22128 |
This comment was originally written by @pjako But it is not just websockets.. as I stated two years ago:
|
Not worried about Isolate API and the Web any more - https://groups.google.com/a/dartlang.org/forum/#!topic/announce/jh8uN5S0GE4 |
Bump pub ``` > git log --format="%C(auto) %h %s" 70b1a4f9229a36bac6340ec7eae2b2068baac96c..9f2ddc02f066c68fb638ff65fbb73761ece23267 9f2ddc02 Use uris for paths in git source descriptions (#3063) 97a0033e Update README.md (#3069) 2ef10adf Roll setup-dart (#3054) 4b5450d3 Updated repository specification. (#3050) 0f3055db Add executables to allErrors (#3048) ``` Change-Id: Iaa42df2339b6f62aeb63e0f2e7eaf062da84e7c6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209681 Reviewed-by: Jonas Jensen <[email protected]> Commit-Queue: Sigurd Meldgaard <[email protected]>
…3 revisions) https://dart.googlesource.com/dartdoc/+log/c58f21042ebd..8549817bb1b5 2022-05-24 49699333+dependabot[bot]@users.noreply.github.com Bump actions/checkout from 3 to 3.0.2 (#3048) 2022-05-24 49699333+dependabot[bot]@users.noreply.github.com Bump github/codeql-action from 1.0.26 to 2.1.11 (#3049) 2022-05-24 49699333+dependabot[bot]@users.noreply.github.com Bump actions/upload-artifact from 3.0.0 to 3.1.0 (#3050) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/dart-doc-dart-sdk Please CC [email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Dart Documentation Generator: https://github.com/dart-lang/dartdoc/issues To file a bug in Dart SDK: https://github.com/dart-lang/sdk/issues To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md Tbr: [email protected] Change-Id: I14041ce5576cc0efadcc897603f8b7893b891b22 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245721 Reviewed-by: Kevin Moore <[email protected]> Commit-Queue: DEPS Autoroller <[email protected]> Commit-Queue: Kevin Moore <[email protected]>
As we migrate to the new isolate's API, it's unclear what is the best API for spawning DOM isolates.
We used to have [window.spawnDOMIsolate] in dartium that takes as an argument a function to run. However, this is not that valuable use of isolates. More precisely, isolates have 2 main uses: concurrency and running untrusted third-party code. Under the new API we use [spawnFunction] for the former, and [spawnUri] for the latter.
When using DOM isolates, all isolates run in the UI-thread, so there is no concurrency win. We'd mostly want to use isolates in the same way as spawnUri.
We propose removing [spawnDOMIsolate], and instead, provide a function similar to spawnUri, that spawns the isolate in the UI thread (e.g. using iframes).
The text was updated successfully, but these errors were encountered: