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

Side by Side Diff: samples/total/server/TotalRunner.dart

Issue 9500002: Rename blahHandler to onBlah throughout dart:io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 8 years, 9 months 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 | « samples/total/server/DartCompiler.dart ('k') | tests/standalone/src/ChunkedStreamTest.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 #!/usr/bin/env dart 1 #!/usr/bin/env dart
2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 // for details. All rights reserved. Use of this source code is governed by a 3 // for details. All rights reserved. Use of this source code is governed by a
4 // BSD-style license that can be found in the LICENSE file. 4 // BSD-style license that can be found in the LICENSE file.
5 5
6 #library("total:runner"); 6 #library("total:runner");
7 7
8 #import('dart:io'); 8 #import('dart:io');
9 9
10 typedef void ExitCallback(int status, String exitString); 10 typedef void ExitCallback(int status, String exitString);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 foundExec = dartExec; 49 foundExec = dartExec;
50 } 50 }
51 } 51 }
52 if (foundExec == null) { 52 if (foundExec == null) {
53 print("No executable found on DART_EXECS:\n" + DART_EXECS); 53 print("No executable found on DART_EXECS:\n" + DART_EXECS);
54 exitCallback(1, this); 54 exitCallback(1, this);
55 return; 55 return;
56 } 56 }
57 Process dart = new Process.start(foundExec, [_serverMain]); 57 Process dart = new Process.start(foundExec, [_serverMain]);
58 58
59 dart.exitHandler = (int status) { 59 dart.onExit = (int status) {
60 dart.close(); 60 dart.close();
61 exitCallback(status, this); 61 exitCallback(status, this);
62 }; 62 };
63 63
64 dart.stdout.dataHandler = () => readMore(dart.stdout, new StringBuffer()); 64 dart.stdout.onData = () => readMore(dart.stdout, new StringBuffer());
65 dart.stderr.dataHandler = () => readMore(dart.stderr, new StringBuffer()); 65 dart.stderr.onData = () => readMore(dart.stderr, new StringBuffer());
66 } 66 }
67 67
68 void readMore(InputStream i, StringBuffer readSoFar) { 68 void readMore(InputStream i, StringBuffer readSoFar) {
69 while(i.available() != 0) { 69 while(i.available() != 0) {
70 processBuffer(i.read(), readSoFar); 70 processBuffer(i.read(), readSoFar);
71 } 71 }
72 } 72 }
73 73
74 void processBuffer(List<int> buf, StringBuffer readSoFar) { 74 void processBuffer(List<int> buf, StringBuffer readSoFar) {
75 buf.forEach((int i) { 75 buf.forEach((int i) {
76 if (i != CR && i != LF) { 76 if (i != CR && i != LF) {
77 readSoFar.add(new String.fromCharCodes([i])); 77 readSoFar.add(new String.fromCharCodes([i]));
78 } else { 78 } else {
79 String line = readSoFar.toString(); 79 String line = readSoFar.toString();
80 readSoFar.clear(); 80 readSoFar.clear();
81 if (line.length != 0) { 81 if (line.length != 0) {
82 print(line); 82 print(line);
83 } 83 }
84 } 84 }
85 }); 85 });
86 } 86 }
87 } 87 }
OLDNEW
« no previous file with comments | « samples/total/server/DartCompiler.dart ('k') | tests/standalone/src/ChunkedStreamTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698