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

Unified Diff: sdk/lib/io/websocket_impl.dart

Issue 11886038: Change the WebSocket implementation to use Socket.read instead of Socket.readList (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added test Created 7 years, 11 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
Index: sdk/lib/io/websocket_impl.dart
diff --git a/sdk/lib/io/websocket_impl.dart b/sdk/lib/io/websocket_impl.dart
index c660740f0f7543b25769d409d9e1e9c70705919d..65c4ca48f26b9907d7d47b1b469d6e41e53fc815 100644
--- a/sdk/lib/io/websocket_impl.dart
+++ b/sdk/lib/io/websocket_impl.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -62,9 +62,9 @@ class _WebSocketProtocolProcessor {
/**
* Process data received from the underlying communication channel.
*/
- void update(List<int> buffer, int offset, int count) {
- int index = offset;
- int lastIndex = offset + count;
+ void update(List<int> buffer) {
+ int index = 0;
+ int lastIndex = buffer.length;
try {
if (_state == CLOSED) {
throw new WebSocketException("Data on closed connection");
@@ -375,13 +375,10 @@ class _WebSocketConnectionBase {
processor.onPong = _onWebSocketPong;
processor.onClosed = _onWebSocketClosed;
if (unparsedData != null) {
- processor.update(unparsedData, 0, unparsedData.length);
+ processor.update(unparsedData);
}
_socket.onData = () {
- int available = _socket.available();
- List<int> data = new List<int>.fixedLength(available);
- int read = _socket.readList(data, 0, available);
- processor.update(data, 0, read);
+ processor.update(_socket.read());
};
_socket.onClosed = () {
processor.closed();

Powered by Google App Engine
This is Rietveld 408576698