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

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

Issue 10990083: Reapply change to hide VM-only List implementation classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix dart:io perf regression. 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/bin/process_impl.dart ('k') | runtime/lib/array.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 5
6 class _SocketBase extends NativeFieldWrapperClass1 { 6 class _SocketBase extends NativeFieldWrapperClass1 {
7 // Bit flags used when communicating between the eventhandler and 7 // Bit flags used when communicating between the eventhandler and
8 // dart code. The EVENT flags are used to indicate events of 8 // dart code. The EVENT flags are used to indicate events of
9 // interest when sending a message from dart code to the 9 // interest when sending a message from dart code to the
10 // eventhandler. When receiving a message from the eventhandler the 10 // eventhandler. When receiving a message from the eventhandler the
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 } 397 }
398 if (offset < 0) { 398 if (offset < 0) {
399 throw new IndexOutOfRangeException(offset); 399 throw new IndexOutOfRangeException(offset);
400 } 400 }
401 if (bytes < 0) { 401 if (bytes < 0) {
402 throw new IndexOutOfRangeException(bytes); 402 throw new IndexOutOfRangeException(bytes);
403 } 403 }
404 if ((offset + bytes) > buffer.length) { 404 if ((offset + bytes) > buffer.length) {
405 throw new IndexOutOfRangeException(offset + bytes); 405 throw new IndexOutOfRangeException(offset + bytes);
406 } 406 }
407 // When using the Dart C API to access raw data, using a ByteArray is 407 var fastBuffer = _ensureFastAndSerializableBuffer(buffer, offset, bytes);
408 // currently much faster. This function will make a copy of the 408 var result = _writeList(fastBuffer[0], fastBuffer[1], bytes);
409 // supplied List to a ByteArray if it isn't already.
410 List outBuffer;
411 int outOffset = offset;
412 if (buffer is Uint8List || buffer is ObjectArray) {
413 outBuffer = buffer;
414 } else {
415 outBuffer = new Uint8List(bytes);
416 outOffset = 0;
417 int j = offset;
418 for (int i = 0; i < bytes; i++) {
419 int value = buffer[j];
420 if (value is! int) {
421 throw new FileIOException(
422 "List element is not an integer at index $j");
423 }
424 outBuffer[i] = value;
425 j++;
426 }
427 }
428 var result = _writeList(outBuffer, outOffset, bytes);
429 if (result is OSError) { 409 if (result is OSError) {
430 _reportError(result, "Write failed"); 410 _reportError(result, "Write failed");
431 // If writing fails we return 0 as the number of bytes and 411 // If writing fails we return 0 as the number of bytes and
432 // report the error on the error handler. 412 // report the error on the error handler.
433 result = 0; 413 result = 0;
434 } 414 }
435 return result; 415 return result;
436 } 416 }
437 throw new SocketIOException("writeList failed - invalid socket handle"); 417 throw new SocketIOException("writeList failed - invalid socket handle");
438 } 418 }
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 bool _seenFirstOutEvent = false; 567 bool _seenFirstOutEvent = false;
588 bool _pipe = false; 568 bool _pipe = false;
589 Function _clientConnectHandler; 569 Function _clientConnectHandler;
590 Function _clientWriteHandler; 570 Function _clientWriteHandler;
591 SocketInputStream _inputStream; 571 SocketInputStream _inputStream;
592 SocketOutputStream _outputStream; 572 SocketOutputStream _outputStream;
593 String _remoteHost; 573 String _remoteHost;
594 int _remotePort; 574 int _remotePort;
595 static SendPort _socketService; 575 static SendPort _socketService;
596 } 576 }
OLDNEW
« no previous file with comments | « runtime/bin/process_impl.dart ('k') | runtime/lib/array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698