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

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

Issue 1904553006: Fix strong mode errors in dart:io. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comment.~ Created 4 years, 7 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
« sdk/lib/io/stdio.dart ('K') | « sdk/lib/io/string_transformer.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/websocket_impl.dart
diff --git a/sdk/lib/io/websocket_impl.dart b/sdk/lib/io/websocket_impl.dart
index 0972e84be2e3c547b7ee315470b94933f41ff392..206ec2f2ec6480942f4972403ba6769bc3b0448f 100644
--- a/sdk/lib/io/websocket_impl.dart
+++ b/sdk/lib/io/websocket_impl.dart
@@ -58,7 +58,8 @@ class _CompressionMaxWindowBits {
* will lead to undefined behaviour.
*/
// TODO(ajohnsen): make this transformer reusable?
-class _WebSocketProtocolTransformer implements StreamTransformer, EventSink {
+class _WebSocketProtocolTransformer
+ implements StreamTransformer, EventSink<Uint8List> {
static const int START = 0;
static const int LEN_FIRST = 1;
static const int LEN_REST = 2;
@@ -996,6 +997,7 @@ class _WebSocketImpl extends Stream with _ServiceObject implements WebSocket {
return request.close();
}).then((response) {
+
void error(String message) {
// Flush data.
response.detachSocket().then((socket) {
@@ -1003,6 +1005,7 @@ class _WebSocketImpl extends Stream with _ServiceObject implements WebSocket {
});
throw new WebSocketException(message);
}
+
if (response.statusCode != HttpStatus.SWITCHING_PROTOCOLS ||
response.headers[HttpHeaders.CONNECTION] == null ||
!response.headers[HttpHeaders.CONNECTION]
@@ -1032,7 +1035,7 @@ class _WebSocketImpl extends Stream with _ServiceObject implements WebSocket {
_WebSocketPerMessageDeflate deflate =
negotiateClientCompression(response, compression);
- return response.detachSocket().then((socket) =>
+ return response.detachSocket().then/*<WebSocket>*/((socket) =>
new _WebSocketImpl._fromSocket(
socket, protocol, compression, false, deflate));
});
@@ -1060,8 +1063,7 @@ class _WebSocketImpl extends Stream with _ServiceObject implements WebSocket {
return DEFAULT_WINDOW_BITS;
}
- o = int.parse(o, onError: (s) => DEFAULT_WINDOW_BITS);
- return o;
+ return int.parse(o, onError: (s) => DEFAULT_WINDOW_BITS);
}
return new _WebSocketPerMessageDeflate(
@@ -1216,9 +1218,9 @@ class _WebSocketImpl extends Stream with _ServiceObject implements WebSocket {
String get _serviceTypePath => 'io/websockets';
String get _serviceTypeName => 'WebSocket';
- Map _toJSON(bool ref) {
+ Map<String, dynamic> _toJSON(bool ref) {
var name = '${_socket.address.host}:${_socket.port}';
- var r = {
+ var r = <String, dynamic>{
'id': _servicePath,
'type': _serviceType(ref),
'name': name,
« sdk/lib/io/stdio.dart ('K') | « sdk/lib/io/string_transformer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698