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

Side by Side Diff: runtime/bin/socket_patch.dart

Issue 11338037: Start reading data from sockets directly into external byte arrays (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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
« lib/io/socket_stream_impl.dart ('K') | « runtime/bin/socket.cc ('k') | no next file » | 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 patch class ServerSocket { 5 patch class ServerSocket {
6 /* patch */ factory ServerSocket(String bindAddress, int port, int backlog) { 6 /* patch */ factory ServerSocket(String bindAddress, int port, int backlog) {
7 return new _ServerSocket(bindAddress, port, backlog); 7 return new _ServerSocket(bindAddress, port, backlog);
8 } 8 }
9 } 9 }
10 10
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 } else { 368 } else {
369 return result; 369 return result;
370 } 370 }
371 } 371 }
372 throw new 372 throw new
373 SocketIOException("Error: available failed - invalid socket handle"); 373 SocketIOException("Error: available failed - invalid socket handle");
374 } 374 }
375 375
376 _available() native "Socket_Available"; 376 _available() native "Socket_Available";
377 377
378 List<int> read([int len]) {
379 if (len != null && len <= 0) {
380 throw new SocketIOException("Illegal length $len");
381 }
382 var result = _read(len == null ? -1 : len);
383 if (result is OSError) {
384 _reportError(result, "Read failed");
385 return null;
386 }
387 return result;
388 }
389
390 _read(int len) native "Socket_Read";
391
378 int readList(List<int> buffer, int offset, int bytes) { 392 int readList(List<int> buffer, int offset, int bytes) {
379 if (!_closed) { 393 if (!_closed) {
380 if (bytes == 0) { 394 if (bytes == 0) {
381 return 0; 395 return 0;
382 } 396 }
383 if (offset < 0) { 397 if (offset < 0) {
384 throw new IndexOutOfRangeException(offset); 398 throw new IndexOutOfRangeException(offset);
385 } 399 }
386 if (bytes < 0) { 400 if (bytes < 0) {
387 throw new IndexOutOfRangeException(bytes); 401 throw new IndexOutOfRangeException(bytes);
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
584 bool _seenFirstOutEvent = false; 598 bool _seenFirstOutEvent = false;
585 bool _pipe = false; 599 bool _pipe = false;
586 Function _clientConnectHandler; 600 Function _clientConnectHandler;
587 Function _clientWriteHandler; 601 Function _clientWriteHandler;
588 _SocketInputStream _inputStream; 602 _SocketInputStream _inputStream;
589 _SocketOutputStream _outputStream; 603 _SocketOutputStream _outputStream;
590 String _remoteHost; 604 String _remoteHost;
591 int _remotePort; 605 int _remotePort;
592 static SendPort _socketService; 606 static SendPort _socketService;
593 } 607 }
OLDNEW
« lib/io/socket_stream_impl.dart ('K') | « runtime/bin/socket.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698