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

Side by Side Diff: tests/lib/async/slow_sink_test.dart

Issue 11312122: Change List constructors. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Reupload. Adapt code for List.fixedLength. Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/language/type_vm_test.dart ('k') | tests/standalone/io/file_invalid_arguments_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 import 'dart:async'; 7 import 'dart:async';
8 8
9 const int KB = 1024; 9 const int KB = 1024;
10 const int MB = KB * KB; 10 const int MB = KB * KB;
(...skipping 24 matching lines...) Expand all
35 var current = new Future.immediate(0); 35 var current = new Future.immediate(0);
36 final int bytesPerSecond; 36 final int bytesPerSecond;
37 } 37 }
38 38
39 class DataProvider extends StreamController { 39 class DataProvider extends StreamController {
40 DataProvider(int bytesPerSecond, int runtime) { 40 DataProvider(int bytesPerSecond, int runtime) {
41 const int ms = 5; 41 const int ms = 5;
42 bool run = true; 42 bool run = true;
43 send() { 43 send() {
44 if (!run) return; 44 if (!run) return;
45 var wait = add(new List(bytesPerSecond * ms ~/ 1000)); 45 var wait = add(new List.fixedLength(bytesPerSecond * ms ~/ 1000));
46 if (wait != null) { 46 if (wait != null) {
47 wait.then(() { 47 wait.then(() {
48 new Timer(ms, (_) => send()); 48 new Timer(ms, (_) => send());
49 }); 49 });
50 } else { 50 } else {
51 new Timer(ms, (_) => send()); 51 new Timer(ms, (_) => send());
52 } 52 }
53 } 53 }
54 new Timer(ms, (_) => send()); 54 new Timer(ms, (_) => send());
55 new Timer(runtime, (_) { 55 new Timer(runtime, (_) {
56 run = false; 56 run = false;
57 }); 57 });
58 } 58 }
59 } 59 }
60 60
61 main() { 61 main() {
62 // 0.5 s * 200 MB/s = 100 MB. 62 // 0.5 s * 200 MB/s = 100 MB.
63 new DataProvider(400 * MB, 200).pipe(new SlowSink(100 * MB)); 63 new DataProvider(400 * MB, 200).pipe(new SlowSink(100 * MB));
64 } 64 }
OLDNEW
« no previous file with comments | « tests/language/type_vm_test.dart ('k') | tests/standalone/io/file_invalid_arguments_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698