OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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:async'; | 6 import 'dart:async'; |
7 import 'dart:isolate'; | 7 import 'dart:isolate'; |
8 import 'dart:math'; | 8 import 'dart:math'; |
9 import '../../pkg/unittest/lib/unittest.dart'; | 9 import '../../pkg/unittest/lib/unittest.dart'; |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 void _validateResult() { | 60 void _validateResult() { |
61 // TODO(ngeoffray): Implement this. | 61 // TODO(ngeoffray): Implement this. |
62 _validated.complete(true); | 62 _validated.complete(true); |
63 } | 63 } |
64 | 64 |
65 void _printResult() { | 65 void _printResult() { |
66 var output = new StringBuffer(); | 66 var output = new StringBuffer(); |
67 for (int i = 0; i < _result.length; i++) { | 67 for (int i = 0; i < _result.length; i++) { |
68 List<int> line = _result[i]; | 68 List<int> line = _result[i]; |
69 for (int j = 0; j < line.length; j++) { | 69 for (int j = 0; j < line.length; j++) { |
70 if (line[j] < 10) output.add("0"); | 70 if (line[j] < 10) output.write("0"); |
71 output.add(line[j]); | 71 output.write(line[j]); |
72 } | 72 } |
73 output.add("\n"); | 73 output.write("\n"); |
74 } | 74 } |
75 // print(output); | 75 // print(output); |
76 } | 76 } |
77 | 77 |
78 List<List<int>> _result; | 78 List<List<int>> _result; |
79 List<LineProcessorClient> _lineProcessedBy; | 79 List<LineProcessorClient> _lineProcessedBy; |
80 int _sent; | 80 int _sent; |
81 int _missing; | 81 int _missing; |
82 Completer<bool> _validated; | 82 Completer<bool> _validated; |
83 } | 83 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 void processLines() { | 134 void processLines() { |
135 port.receive((message, SendPort replyTo) { | 135 port.receive((message, SendPort replyTo) { |
136 if (message == TERMINATION_MESSAGE) { | 136 if (message == TERMINATION_MESSAGE) { |
137 assert(replyTo == null); | 137 assert(replyTo == null); |
138 port.close(); | 138 port.close(); |
139 } else { | 139 } else { |
140 replyTo.send(processLine(message), null); | 140 replyTo.send(processLine(message), null); |
141 } | 141 } |
142 }); | 142 }); |
143 } | 143 } |
OLD | NEW |