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

Issue 11308154: Stream isolates. (Closed)

Created:
8 years, 1 month ago by floitsch
Modified:
8 years ago
CC:
reviews_dartlang.org, Anton Muhin, podivilov1
Visibility:
Public.

Description

Patch Set 1 #

Patch Set 2 : Removed hack and improved doc. #

Total comments: 43

Patch Set 3 : Fixes and test. #

Total comments: 14
Unified diffs Side-by-side diffs Delta from patch set Stats (+624 lines, -29 lines) Patch
M runtime/lib/isolate_patch.dart View 1 2 1 chunk +9 lines, -8 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/lib/isolate_patch.dart View 1 2 1 chunk +17 lines, -14 lines 0 comments Download
M sdk/lib/async/stream_controller.dart View 1 2 3 chunks +5 lines, -3 lines 0 comments Download
M sdk/lib/isolate/base.dart View 1 2 4 chunks +13 lines, -4 lines 2 comments Download
M sdk/lib/isolate/isolate.dart View 1 chunk +2 lines, -0 lines 0 comments Download
M sdk/lib/isolate/isolate_sources.gypi View 1 chunk +2 lines, -0 lines 0 comments Download
A sdk/lib/isolate/isolate_stream.dart View 1 2 1 chunk +183 lines, -0 lines 6 comments Download
A sdk/lib/isolate/mangler.dart View 1 2 1 chunk +268 lines, -0 lines 4 comments Download
M tests/corelib/stream_controller_test.dart View 1 2 1 chunk +25 lines, -0 lines 0 comments Download
A tests/isolate/stream_mangling_test.dart View 1 2 1 chunk +100 lines, -0 lines 2 comments Download

Messages

Total messages: 8 (0 generated)
floitsch
Somehow the isolate_stream.dart file doesn't get access to "spawnUri" and "port", so the CL is ...
8 years, 1 month ago (2012-11-21 22:06:21 UTC) #1
Lasse Reichstein Nielsen
LGTM if you fix references. https://codereview.chromium.org/11308154/diff/2001/sdk/lib/isolate/isolate_stream.dart File sdk/lib/isolate/isolate_stream.dart (right): https://codereview.chromium.org/11308154/diff/2001/sdk/lib/isolate/isolate_stream.dart#newcode11 sdk/lib/isolate/isolate_stream.dart:11: final IsolateStream stream = ...
8 years, 1 month ago (2012-11-22 10:23:15 UTC) #2
floitsch
Looping in Anton and Pavel (to get a look from an embedder's point of view). ...
8 years, 1 month ago (2012-11-22 11:58:04 UTC) #3
floitsch
Still missing some tests, but close. https://codereview.chromium.org/11308154/diff/2001/sdk/lib/isolate/mangler.dart File sdk/lib/isolate/mangler.dart (right): https://codereview.chromium.org/11308154/diff/2001/sdk/lib/isolate/mangler.dart#newcode23 sdk/lib/isolate/mangler.dart:23: if (_encoded.containsKey(data)) return ...
8 years, 1 month ago (2012-11-22 20:06:12 UTC) #4
Lasse Reichstein Nielsen
https://codereview.chromium.org/11308154/diff/2001/sdk/lib/isolate/mangler.dart File sdk/lib/isolate/mangler.dart (right): https://codereview.chromium.org/11308154/diff/2001/sdk/lib/isolate/mangler.dart#newcode72 sdk/lib/isolate/mangler.dart:72: if (encodedValue != value) needsCopy = true; True. You ...
8 years, 1 month ago (2012-11-23 12:12:38 UTC) #5
Anton Muhin
DBCs https://codereview.chromium.org/11308154/diff/7001/sdk/lib/isolate/isolate_stream.dart File sdk/lib/isolate/isolate_stream.dart (right): https://codereview.chromium.org/11308154/diff/7001/sdk/lib/isolate/isolate_stream.dart#newcode44 sdk/lib/isolate/isolate_stream.dart:44: class IsolateStream extends Stream<dynamic> { just for my ...
8 years ago (2012-11-25 10:23:16 UTC) #6
Ivan Posva
DBC -ip https://codereview.chromium.org/11308154/diff/7001/sdk/lib/isolate/base.dart File sdk/lib/isolate/base.dart (right): https://codereview.chromium.org/11308154/diff/7001/sdk/lib/isolate/base.dart#newcode146 sdk/lib/isolate/base.dart:146: // The VM doesn't support accessing external ...
8 years ago (2012-11-26 18:56:40 UTC) #7
floitsch
8 years ago (2012-11-28 14:13:17 UTC) #8
Message was sent while issue was closed.
TODO is updated in https://codereview.chromium.org//11416240

https://codereview.chromium.org/11308154/diff/7001/sdk/lib/isolate/base.dart
File sdk/lib/isolate/base.dart (right):

https://codereview.chromium.org/11308154/diff/7001/sdk/lib/isolate/base.dart#...
sdk/lib/isolate/base.dart:146: // The VM doesn't support accessing external
globals in the same library. We
On 2012/11/26 18:56:40, Ivan Posva wrote:
> Can you please elaborate what is missing from our tests? There should be no
> reason to not be able to access external from the library.

We cannot access external global variables from within the same library. The VM
will just not see it.
You can test this by adding a ReceivePort get port2 => port in the original code
and try to access it (after having imported dart:async).
Filed issue 6997 and updated TODO with bug-number.

https://codereview.chromium.org/11308154/diff/7001/sdk/lib/isolate/isolate_st...
File sdk/lib/isolate/isolate_stream.dart (right):

https://codereview.chromium.org/11308154/diff/7001/sdk/lib/isolate/isolate_st...
sdk/lib/isolate/isolate_stream.dart:44: class IsolateStream extends
Stream<dynamic> {
On 2012/11/25 10:23:16, Anton Muhin wrote:
> just for my education, what's the benefit of Stream<dynamic> over just Stream?

Semantically it is the same. We (I?) prefer to write it explicitly to show that
I thought of the generic type and didn't just forget it.

https://codereview.chromium.org/11308154/diff/7001/sdk/lib/isolate/isolate_st...
sdk/lib/isolate/isolate_stream.dart:83: dynamic _unmangleMessage(var message) {
On 2012/11/25 10:23:16, Anton Muhin wrote:
> why dynamic return type, not var or just dropped

ditto. To show that I thought about it.

https://codereview.chromium.org/11308154/diff/7001/sdk/lib/isolate/isolate_st...
sdk/lib/isolate/isolate_stream.dart:133: (data) => (data is IsolateSink) ?
["Sink", data._port] : data);
On 2012/11/25 10:23:16, Anton Muhin wrote:
> I am sure you took care of it, but what happens if I pass ["Sink", port] in
> write?

The Encoder/Decoder takes care of this. If the mangler returns an object that is
different from the original it will mark it. Since a message ["Sink", port]
wouldn't be marked it wouldn't go through the demangler.

https://codereview.chromium.org/11308154/diff/7001/sdk/lib/isolate/mangler.dart
File sdk/lib/isolate/mangler.dart (right):

https://codereview.chromium.org/11308154/diff/7001/sdk/lib/isolate/mangler.da...
sdk/lib/isolate/mangler.dart:8: final Map _encoded = new Map();
On 2012/11/25 10:23:16, Anton Muhin wrote:
> why not = {}?
If I'm not wrong that would be a Map<String, dynamic> and not Map<dynamic,
dynamic>.

https://codereview.chromium.org/11308154/diff/7001/sdk/lib/isolate/mangler.da...
sdk/lib/isolate/mangler.dart:16: _IsolateEncoder(this.manglingToken,
mangle(data))
On 2012/11/25 10:23:16, Anton Muhin wrote:
> why not this._mangle here?

This way I get a little bit of typing. The field is just declared as Function,
whereas the parameter is defined as a function that takes exactly one argument.

https://codereview.chromium.org/11308154/diff/7001/tests/isolate/stream_mangl...
File tests/isolate/stream_mangling_test.dart (right):

https://codereview.chromium.org/11308154/diff/7001/tests/isolate/stream_mangl...
tests/isolate/stream_mangling_test.dart:15: Expect.identical(nested, nested[0]);
On 2012/11/25 10:23:16, Anton Muhin wrote:
> again, for my education, why do you use old Expect stuff here?

Two reasons:
* I have never used the new unit-testing framework. (That could be fixed ;)
* for basic tests (in particular the language tests) we don't want to rely on
complicated unit-test frameworks. We want the tests to fail, and not the
framework before it can even execute our tests.
For isolate tests we could however consider using the framework.

Powered by Google App Engine
This is Rietveld 408576698