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

Unified 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: Addressed review comments from ager@ Created 8 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 | « runtime/bin/socket.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket_patch.dart
diff --git a/runtime/bin/socket_patch.dart b/runtime/bin/socket_patch.dart
index 490cca5b84ad52593f34f1ce1b33dfb134189c76..65f4a8a13d2225b4e65e791a7cf6535258eb7bb8 100644
--- a/runtime/bin/socket_patch.dart
+++ b/runtime/bin/socket_patch.dart
@@ -375,6 +375,20 @@ class _Socket extends _SocketBase implements Socket {
_available() native "Socket_Available";
+ List<int> read([int len]) {
+ if (len != null && len <= 0) {
+ throw new SocketIOException("Illegal length $len");
+ }
+ var result = _read(len == null ? -1 : len);
+ if (result is OSError) {
+ _reportError(result, "Read failed");
+ return null;
+ }
+ return result;
+ }
+
+ _read(int len) native "Socket_Read";
+
int readList(List<int> buffer, int offset, int bytes) {
if (!_closed) {
if (bytes == 0) {
« no previous file with comments | « runtime/bin/socket.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698