| 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 // VMOptions=--old_gen_heap_size=32 | 5 // VMOptions=--old_gen_heap_size=32 |
| 6 | 6 |
| 7 library slow_consumer_test; |
| 8 |
| 7 import 'dart:async'; | 9 import 'dart:async'; |
| 8 import 'dart:isolate'; | 10 import 'dart:isolate'; |
| 9 | 11 |
| 10 const int KB = 1024; | 12 const int KB = 1024; |
| 11 const int MB = KB * KB; | 13 const int MB = KB * KB; |
| 12 const int GB = KB * KB * KB; | 14 const int GB = KB * KB * KB; |
| 13 | 15 |
| 14 class SlowConsumer extends StreamConsumer { | 16 class SlowConsumer extends StreamConsumer { |
| 15 var current = new Future.immediate(0); | 17 var current = new Future.immediate(0); |
| 16 final int bytesPerSecond; | 18 final int bytesPerSecond; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // file). If the consumer doesn't pause the data-provider it will run out of | 85 // file). If the consumer doesn't pause the data-provider it will run out of |
| 84 // heap-space. | 86 // heap-space. |
| 85 | 87 |
| 86 new DataProvider(800 * MB, 100 * MB, 1 * MB) | 88 new DataProvider(800 * MB, 100 * MB, 1 * MB) |
| 87 .pipe(new SlowConsumer(200 * MB)) | 89 .pipe(new SlowConsumer(200 * MB)) |
| 88 .then((count) { | 90 .then((count) { |
| 89 port.close(); | 91 port.close(); |
| 90 Expect.equals(100 * MB, count); | 92 Expect.equals(100 * MB, count); |
| 91 }); | 93 }); |
| 92 } | 94 } |
| OLD | NEW |