Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(84)

Issue 20703003: Proposal for new Isolate library. (Closed)

Created:
7 years, 5 months ago by floitsch
Modified:
7 years ago
CC:
reviews_dartlang.org, Ben Laurie (Google)
Visibility:
Public.

Description

Proposal for new Isolate library. What this proposal tries to achieve: - remove global port, stream. - remove stream isolates. We want them in a package on top of the current API. (Potentially we can eventually move it back, but not now). - Initiate the communication from the spawnee (using an initial message). If no communication is needed, then no Send/Receiveports are need.d - provide arguments to a spawned isolate. These arguments are the same as the ones for command-line applications. -> it is possible to spawn command-line applications in the browser (as long as they don't use dart:io, ...). - it also opens the door for more control on the spawned isolates. With this proposal the spawn functions are void. We can eventually make them return an object ("Isolate" ?) that can have properties on it. Good candidates (imho) would be stdin and stdout, and exit status code (much like the Process class).

Patch Set 1 #

Patch Set 2 : Reupload due to error #

Patch Set 3 : Forgot to save. #

Total comments: 13

Patch Set 4 : Address comments. #

Total comments: 13

Patch Set 5 : Comment changes. #

Patch Set 6 : Update comment. #

Total comments: 2

Patch Set 7 : Using capabilities. #

Total comments: 30

Patch Set 8 : Address comments. #

Total comments: 12

Patch Set 9 : Address comments. #

Total comments: 10

Patch Set 10 : Address comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+150 lines, -266 lines) Patch
M sdk/lib/isolate/isolate.dart View 1 2 3 4 5 6 7 8 9 5 chunks +150 lines, -110 lines 0 comments Download
D sdk/lib/isolate/isolate_stream.dart View 1 2 3 4 5 6 1 chunk +0 lines, -156 lines 0 comments Download

Messages

Total messages: 17 (0 generated)
floitsch
This is not intended for submission. Just for discussion.
7 years, 5 months ago (2013-07-26 11:00:37 UTC) #1
Søren Gjesse
I think this makes sense. Having no default ReceivePort in an isolate is a good ...
7 years, 5 months ago (2013-07-26 11:49:35 UTC) #2
floitsch
On 2013/07/26 11:49:35, Søren Gjesse wrote: > I think this makes sense. Having no default ...
7 years, 5 months ago (2013-07-26 11:59:47 UTC) #3
floitsch
https://codereview.chromium.org/20703003/diff/5001/sdk/lib/isolate/isolate.dart File sdk/lib/isolate/isolate.dart (right): https://codereview.chromium.org/20703003/diff/5001/sdk/lib/isolate/isolate.dart#newcode22 sdk/lib/isolate/isolate.dart:22: dynamic get isolateArguments; On 2013/07/26 11:49:35, Søren Gjesse wrote: ...
7 years, 5 months ago (2013-07-26 12:01:28 UTC) #4
floitsch
7 years, 5 months ago (2013-07-26 12:03:58 UTC) #5
Lasse Reichstein Nielsen
https://codereview.chromium.org/20703003/diff/5001/sdk/lib/isolate/isolate.dart File sdk/lib/isolate/isolate.dart (right): https://codereview.chromium.org/20703003/diff/5001/sdk/lib/isolate/isolate.dart#newcode72 sdk/lib/isolate/isolate.dart:72: * serialization and deserialization should work. You can't override ...
7 years, 4 months ago (2013-08-12 07:19:03 UTC) #6
floitsch
https://codereview.chromium.org/20703003/diff/10001/sdk/lib/isolate/isolate.dart File sdk/lib/isolate/isolate.dart (right): https://codereview.chromium.org/20703003/diff/10001/sdk/lib/isolate/isolate.dart#newcode37 sdk/lib/isolate/isolate.dart:37: * spawnee can access it. Usually the initial [message] ...
7 years, 4 months ago (2013-08-23 17:07:30 UTC) #7
Lasse Reichstein Nielsen
https://codereview.chromium.org/20703003/diff/22001/sdk/lib/isolate/isolate.dart File sdk/lib/isolate/isolate.dart (right): https://codereview.chromium.org/20703003/diff/22001/sdk/lib/isolate/isolate.dart#newcode22 sdk/lib/isolate/isolate.dart:22: dynamic get isolateMessage; Another global variable. Can we please ...
7 years, 4 months ago (2013-08-26 08:06:06 UTC) #8
floitsch
PTAL. This patch set contains significant changes. - no serializer anymore. - the sendport of ...
7 years, 2 months ago (2013-09-26 16:21:54 UTC) #9
Søren Gjesse
After having gotten a crash-course on what Capability/Premission was I find this promising. Instead of ...
7 years, 2 months ago (2013-09-27 07:04:10 UTC) #10
kasperl
https://codereview.chromium.org/20703003/diff/28001/sdk/lib/isolate/isolate.dart File sdk/lib/isolate/isolate.dart (right): https://codereview.chromium.org/20703003/diff/28001/sdk/lib/isolate/isolate.dart#newcode43 sdk/lib/isolate/isolate.dart:43: class Permission { Not sure you're going to need ...
7 years, 2 months ago (2013-09-27 07:42:19 UTC) #11
Ivan Posva
First set of comments. At some point I guess we would need an overview of ...
7 years, 2 months ago (2013-09-30 02:59:40 UTC) #12
floitsch
Thanks for all the feedback. I updated the CL. The isolate library becomes simpler. Missing: ...
7 years, 2 months ago (2013-10-12 17:04:37 UTC) #13
kasperl
https://codereview.chromium.org/20703003/diff/35001/sdk/lib/isolate/isolate.dart File sdk/lib/isolate/isolate.dart (right): https://codereview.chromium.org/20703003/diff/35001/sdk/lib/isolate/isolate.dart#newcode19 sdk/lib/isolate/isolate.dart:19: /** Do we need special Isolate-specific exceptions? Are they ...
7 years, 2 months ago (2013-10-14 06:58:12 UTC) #14
Lasse Reichstein Nielsen
https://codereview.chromium.org/20703003/diff/35001/sdk/lib/isolate/isolate.dart File sdk/lib/isolate/isolate.dart (right): https://codereview.chromium.org/20703003/diff/35001/sdk/lib/isolate/isolate.dart#newcode22 sdk/lib/isolate/isolate.dart:22: class IsolateSpawnException implements Exception { Drop implementing Exception. It ...
7 years, 2 months ago (2013-10-14 07:13:45 UTC) #15
Lasse Reichstein Nielsen
https://codereview.chromium.org/20703003/diff/42001/sdk/lib/isolate/isolate.dart File sdk/lib/isolate/isolate.dart (right): https://codereview.chromium.org/20703003/diff/42001/sdk/lib/isolate/isolate.dart#newcode62 sdk/lib/isolate/isolate.dart:62: * takes no arguments. It is illegal to pass ...
7 years, 2 months ago (2013-10-14 14:26:47 UTC) #16
floitsch
7 years, 2 months ago (2013-10-14 17:22:40 UTC) #17
https://codereview.chromium.org/20703003/diff/35001/sdk/lib/isolate/isolate.dart
File sdk/lib/isolate/isolate.dart (right):

https://codereview.chromium.org/20703003/diff/35001/sdk/lib/isolate/isolate.d...
sdk/lib/isolate/isolate.dart:19: /**
On 2013/10/14 06:58:12, kasperl wrote:
> Do we need special Isolate-specific exceptions? Are they really that
beneficial?

I think it is good style to have specialized exceptions.

https://codereview.chromium.org/20703003/diff/35001/sdk/lib/isolate/isolate.d...
sdk/lib/isolate/isolate.dart:22: class IsolateSpawnException implements
Exception {
On 2013/10/14 07:13:45, Lasse Reichstein Nielsen wrote:
> Drop implementing Exception. It doesn't help anything anyway.
> 
> What causes can there be for an Isolate not to be created? Can we enumerate
> them, and keep the reason in the exception, so the user knows what to do about
> it.
I would like that yes.
possible reasons:
- url does not exist.
- error during compilation of main (or reachable code).
- out of resources (like too many running isolates).

> 
> If the user cannot do anything, consider making it an error.
in these cases it is an exceptional case. In other words: the user is using the
API the right way and has no way to check that it won't throw an exception.

https://codereview.chromium.org/20703003/diff/35001/sdk/lib/isolate/isolate.d...
sdk/lib/isolate/isolate.dart:23: const IsolateSpawnException(String this._s);
On 2013/10/14 06:58:12, kasperl wrote:
> Remove String here.

Done.

https://codereview.chromium.org/20703003/diff/35001/sdk/lib/isolate/isolate.d...
sdk/lib/isolate/isolate.dart:29: * This class should be part of dart:isolate.
On 2013/10/14 07:13:45, Lasse Reichstein Nielsen wrote:
> This sentence can be removed now.

Done.

https://codereview.chromium.org/20703003/diff/35001/sdk/lib/isolate/isolate.d...
sdk/lib/isolate/isolate.dart:41: * An enum that enumeratos permissions that are
required to control isolates.
On 2013/10/14 07:13:45, Lasse Reichstein Nielsen wrote:
> "enumerates"

Done.

https://codereview.chromium.org/20703003/diff/35001/sdk/lib/isolate/isolate.d...
sdk/lib/isolate/isolate.dart:86: /**
On 2013/10/14 06:58:12, kasperl wrote:
> I'd prefer to just get rid of the (public) control port and permission stuff
for
> now.
> 
> I'd pick a single method to implement on Isolate and remove the rest. Maybe
the
> nicest of the bunch is being able to listen for uncaught errors.

That would mean that there is no way to send an isolate to another isolate.

https://codereview.chromium.org/20703003/diff/42001/sdk/lib/isolate/isolate.dart
File sdk/lib/isolate/isolate.dart (right):

https://codereview.chromium.org/20703003/diff/42001/sdk/lib/isolate/isolate.d...
sdk/lib/isolate/isolate.dart:62: * takes no arguments. It is illegal to pass a
function closure.
On 2013/10/14 14:26:48, Lasse Reichstein Nielsen wrote:
> illegal -> not allowed

Done.

https://codereview.chromium.org/20703003/diff/42001/sdk/lib/isolate/isolate.d...
sdk/lib/isolate/isolate.dart:64: * The entryPoint function is invoked with the
initial [message].
On 2013/10/14 14:26:48, Lasse Reichstein Nielsen wrote:
> `entryPoint`

changed to "entry-point".

https://codereview.chromium.org/20703003/diff/42001/sdk/lib/isolate/isolate.d...
sdk/lib/isolate/isolate.dart:66: * that the spawner and spawnee can communicate
with each other.
On 2013/10/14 14:26:48, Lasse Reichstein Nielsen wrote:
> Document return value.

Done, although more needs to be done.

https://codereview.chromium.org/20703003/diff/42001/sdk/lib/isolate/isolate.d...
sdk/lib/isolate/isolate.dart:75: * The entry point of the spawned isolate is
automatically set to
On 2013/10/14 14:26:48, Lasse Reichstein Nielsen wrote:
> "... that runs the code from the library with the specified URI.
> 
> The isolate starts executing the top-level "main" function of the library with
> the given URI. Otherwise similar to [spawn]."
> 
> (entryPoint is not specified in this method or the library declaration, it's
> just a name used by "spawn", and it doesn't sound like something you can "set"
-
> the word "set" means too much in Dart to be used informally).

Done.

https://codereview.chromium.org/20703003/diff/42001/sdk/lib/isolate/isolate.d...
sdk/lib/isolate/isolate.dart:127: Future<bool> queryIsPaused() {}
On 2013/10/14 14:26:48, Lasse Reichstein Nielsen wrote:
> drop "query". We just have "isPaused" elsewhere, and the fact that it's async
> shouldn't change that.

Let's discuss this. If we call it "isPaused" it needs to be a getter, and I
believe this would confuse users. While I agree that isPaused should not be a
method, I (currently) prefer to use an action verb to make clear that the return
value is not a bool.

Powered by Google App Engine
This is Rietveld 408576698