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

Unified Diff: runtime/bin/socket_stream.dart

Issue 8226016: Add the ability to run tests with several sets of VM flags (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments from ngeoffray@ Created 9 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | runtime/tests/dart/src/EchoServerStreamReadUntilTest.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket_stream.dart
diff --git a/runtime/bin/socket_stream.dart b/runtime/bin/socket_stream.dart
index 2368bc5c62c465df888c749a2038028d4f09b256..7bcd72e84700e5ee401fd7ee7025f4b7c2ed02d8 100644
--- a/runtime/bin/socket_stream.dart
+++ b/runtime/bin/socket_stream.dart
@@ -97,16 +97,19 @@ class SocketInputStream implements InputStream {
void readUntil(List<int> pattern, void callback(List<int> resultBuffer)) {
void doRead() {
List<int> newBuffer;
- if (_buffer != null) {
- newBuffer = _buffer;
- } else {
- int size = _socket.available();
- List<int> buffer = new List<int>(size);
- int result = _socket.readList(buffer, 0, size);
+ int available = _socket.available();
+ if (available > 0) {
+ List<int> buffer = new List<int>(available);
+ int result = _socket.readList(buffer, 0, buffer.length);
if (result > 0) {
// TODO(hpayer): Avoid copying of data before pattern matching.
newBuffer = _getBufferedData(buffer, result);
}
+ } else if (_buffer != null) {
+ newBuffer = _buffer;
+ } else {
+ _socket.setDataHandler(doRead);
+ return;
}
int index = _matchPattern(newBuffer, pattern, 0);
« no previous file with comments | « no previous file | runtime/tests/dart/src/EchoServerStreamReadUntilTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698