| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #library('MandelIsolateTest'); | 5 #library('MandelIsolateTest'); |
| 6 #import('dart:isolate'); | 6 #import('dart:isolate'); |
| 7 #import('TestFramework.dart'); | 7 #import('TestFramework.dart'); |
| 8 | 8 |
| 9 final TERMINATION_MESSAGE = -1; | 9 final TERMINATION_MESSAGE = -1; |
| 10 final N = 100; | 10 final N = 100; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 | 82 |
| 83 class LineProcessorClient { | 83 class LineProcessorClient { |
| 84 | 84 |
| 85 LineProcessorClient(MandelbrotState this._state, int this._id) { | 85 LineProcessorClient(MandelbrotState this._state, int this._id) { |
| 86 _out = new LineProcessor().spawn(); | 86 _out = new LineProcessor().spawn(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 void processLine(int y) { | 89 void processLine(int y) { |
| 90 _out.then((SendPort p) { | 90 _out.then((SendPort p) { |
| 91 p.call(y).receive((List<int> message, SendPort replyTo) { | 91 p.call(y).then((List<int> message) { |
| 92 _state.notifyProcessedLine(this, y, message); | 92 _state.notifyProcessedLine(this, y, message); |
| 93 }); | 93 }); |
| 94 }); | 94 }); |
| 95 } | 95 } |
| 96 | 96 |
| 97 void shutdown() { | 97 void shutdown() { |
| 98 _out.then((SendPort p) { | 98 _out.then((SendPort p) { |
| 99 p.send(TERMINATION_MESSAGE, null); | 99 p.send(TERMINATION_MESSAGE, null); |
| 100 }); | 100 }); |
| 101 } | 101 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 result[x] = i; | 147 result[x] = i; |
| 148 } | 148 } |
| 149 return result; | 149 return result; |
| 150 } | 150 } |
| 151 | 151 |
| 152 } | 152 } |
| 153 | 153 |
| 154 main() { | 154 main() { |
| 155 runTests([test]); | 155 runTests([test]); |
| 156 } | 156 } |
| OLD | NEW |