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

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

Issue 11361190: a === b -> identical(a, b) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/io/timer_impl.dart ('k') | sdk/lib/mirrors/mirrors.dart » ('j') | 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 dfeb2ec3c173ca9f9e1e72249732a139aef523e2..1d0eb28605c30abc73668806e592101ece162657 100644
--- a/sdk/lib/io/websocket_impl.dart
+++ b/sdk/lib/io/websocket_impl.dart
@@ -88,7 +88,7 @@ class _WebSocketProtocolProcessor {
throw new WebSocketException("Protocol error");
}
_currentMessageType = _WebSocketMessageType.TEXT;
- if (onMessageStart !== null) {
+ if (onMessageStart != null) {
onMessageStart(_WebSocketMessageType.TEXT);
}
break;
@@ -98,7 +98,7 @@ class _WebSocketProtocolProcessor {
throw new WebSocketException("Protocol error");
}
_currentMessageType = _WebSocketMessageType.BINARY;
- if (onMessageStart !== null) {
+ if (onMessageStart != null) {
onMessageStart(_WebSocketMessageType.BINARY);
}
break;
@@ -192,7 +192,7 @@ class _WebSocketProtocolProcessor {
case _WebSocketMessageType.TEXT:
case _WebSocketMessageType.BINARY:
- if (onMessageData !== null) {
+ if (onMessageData != null) {
onMessageData(buffer, index, payload);
}
index += payload;
@@ -215,7 +215,7 @@ class _WebSocketProtocolProcessor {
index++;
}
} catch (e) {
- if (onClosed !== null) onClosed(WebSocketStatus.PROTOCOL_ERROR,
+ if (onClosed != null) onClosed(WebSocketStatus.PROTOCOL_ERROR,
"Protocol error");
_state = FAILURE;
}
@@ -226,7 +226,7 @@ class _WebSocketProtocolProcessor {
*/
void closed() {
if (_state == START || _state == CLOSED || _state == FAILURE) return;
- if (onClosed !== null) onClosed(WebSocketStatus.ABNORMAL_CLOSURE,
+ if (onClosed != null) onClosed(WebSocketStatus.ABNORMAL_CLOSURE,
"Connection closed unexpectedly");
_state = CLOSED;
}
@@ -253,14 +253,14 @@ class _WebSocketProtocolProcessor {
if (_isControlFrame()) {
switch (_opcode) {
case _WebSocketOpcode.CLOSE:
- if (onClosed !== null) onClosed(1005, "");
+ if (onClosed != null) onClosed(1005, "");
_state = CLOSED;
break;
case _WebSocketOpcode.PING:
- if (onPing !== null) onPing(null);
+ if (onPing != null) onPing(null);
break;
case _WebSocketOpcode.PONG:
- if (onPong !== null) onPong(null);
+ if (onPong != null) onPong(null);
break;
}
_prepareForNextFrame();
@@ -274,7 +274,7 @@ class _WebSocketProtocolProcessor {
void _messageFrameEnd() {
if (_fin) {
- if (onMessageEnd !== null) onMessageEnd();
+ if (onMessageEnd != null) onMessageEnd();
_currentMessageType = _WebSocketMessageType.NONE;
}
_prepareForNextFrame();
@@ -300,16 +300,16 @@ class _WebSocketProtocolProcessor {
reason = decoder.decoded();
}
}
- if (onClosed !== null) onClosed(status, reason);
+ if (onClosed != null) onClosed(status, reason);
_state = CLOSED;
break;
case _WebSocketOpcode.PING:
- if (onPing !== null) onPing(_controlPayload);
+ if (onPing != null) onPing(_controlPayload);
break;
case _WebSocketOpcode.PONG:
- if (onPong !== null) onPong(_controlPayload);
+ if (onPong != null) onPong(_controlPayload);
break;
}
_prepareForNextFrame();
@@ -372,7 +372,7 @@ class _WebSocketConnectionBase {
processor.onPing = _onWebSocketPing;
processor.onPong = _onWebSocketPong;
processor.onClosed = _onWebSocketClosed;
- if (unparsedData !== null) {
+ if (unparsedData != null) {
processor.update(unparsedData, 0, unparsedData.length);
}
_socket.onData = () {
@@ -386,9 +386,9 @@ class _WebSocketConnectionBase {
if (_closeSent) {
// Got socket close in response to close frame. Don't treat
// that as an error.
- if (_closeTimer !== null) _closeTimer.cancel();
+ if (_closeTimer != null) _closeTimer.cancel();
} else {
- if (_onClosed !== null) _onClosed(WebSocketStatus.ABNORMAL_CLOSURE,
+ if (_onClosed != null) _onClosed(WebSocketStatus.ABNORMAL_CLOSURE,
"Unexpected close");
}
_socket.close();
@@ -409,7 +409,7 @@ class _WebSocketConnectionBase {
}
List<int> data;
int opcode;
- if (message !== null) {
+ if (message != null) {
if (message is String) {
opcode = _WebSocketOpcode.TEXT;
data = _StringEncoders.encoder(Encoding.UTF_8).encodeString(message);
@@ -435,11 +435,11 @@ class _WebSocketConnectionBase {
if (_closeSent) return;
List<int> data;
- if (status !== null) {
+ if (status != null) {
data = new List<int>();
data.add((status >> 8) & 0xFF);
data.add(status & 0xFF);
- if (reason !== null) {
+ if (reason != null) {
data.addAll(
_StringEncoders.encoder(Encoding.UTF_8).encodeString(reason));
}
@@ -451,7 +451,7 @@ class _WebSocketConnectionBase {
// does not take too long.
_socket.outputStream.close();
_socket.outputStream.onClosed = () {
- if (_closeTimer !== null) _closeTimer.cancel();
+ if (_closeTimer != null) _closeTimer.cancel();
_socket.close();
};
_closeTimer = new Timer(5000, (t) {
@@ -489,7 +489,7 @@ class _WebSocketConnectionBase {
}
_onWebSocketMessageEnd() {
- if (_onMessage !== null) {
+ if (_onMessage != null) {
if (_currentMessageType == _WebSocketMessageType.TEXT) {
_onMessage(_decoder.decoded());
} else {
@@ -510,10 +510,10 @@ class _WebSocketConnectionBase {
_onWebSocketClosed(int status, String reason) {
_closeReceived = true;
- if (_onClosed !== null) _onClosed(status, reason);
+ if (_onClosed != null) _onClosed(status, reason);
if (_closeSent) {
// Got close frame in response to close frame. Now close the socket.
- if (_closeTimer !== null) _closeTimer.cancel();
+ if (_closeTimer != null) _closeTimer.cancel();
_socket.close();
} else {
if (status != WebSocketStatus.NO_STATUS_RECEIVED) {
@@ -554,7 +554,7 @@ class _WebSocketConnectionBase {
}
assert(index == headerSize);
_socket.outputStream.write(header);
- if (data !== null) {
+ if (data != null) {
_socket.outputStream.write(data);
}
}
@@ -607,7 +607,7 @@ class _WebSocketHandler implements WebSocketHandler {
// Upgrade the connection and get the underlying socket.
WebSocketConnection conn =
new _WebSocketConnection(response.detachSocket());
- if (_onOpen !== null) _onOpen(conn);
+ if (_onOpen != null) _onOpen(conn);
}
void set onOpen(callback(WebSocketConnection connection)) {
@@ -652,7 +652,7 @@ class _WebSocketClientConnection
_conn.onRequest = _onHttpClientRequest;
_conn.onResponse = _onHttpClientResponse;
_conn.onError = (e) {
- if (_onClosed !== null) {
+ if (_onClosed != null) {
_onClosed(WebSocketStatus.ABNORMAL_CLOSURE, "$e");
}
};
@@ -674,7 +674,7 @@ class _WebSocketClientConnection
}
void _onHttpClientRequest(HttpClientRequest request) {
- if (_onRequest !== null) {
+ if (_onRequest != null) {
_onRequest(request);
}
// Setup the initial handshake.
@@ -688,7 +688,7 @@ class _WebSocketClientConnection
void _onHttpClientResponse(HttpClientResponse response) {
if (response.statusCode != HttpStatus.SWITCHING_PROTOCOLS) {
- if (_onNoUpgrade !== null) {
+ if (_onNoUpgrade != null) {
_onNoUpgrade(response);
} else {
_conn.detachSocket().socket.close();
@@ -706,7 +706,7 @@ class _WebSocketClientConnection
// Connection upgrade successful.
DetachedSocket detached = _conn.detachSocket();
_socketConnected(detached.socket);
- if (_onOpen !== null) _onOpen();
+ if (_onOpen != null) _onOpen();
_startProcessing(detached.unparsedData);
}
@@ -795,21 +795,21 @@ class _WebSocket implements WebSocket {
client.shutdown();
client = null;
_readyState = WebSocket.OPEN;
- if (_onopen !== null) _onopen();
+ if (_onopen != null) _onopen();
};
_wsconn.onMessage = (message) {
- if (_onmessage !== null) {
+ if (_onmessage != null) {
_onmessage(new _WebSocketMessageEvent(message));
}
};
_wsconn.onClosed = (status, reason) {
_readyState = WebSocket.CLOSED;
- if (_onclose !== null) {
+ if (_onclose != null) {
_onclose(new _WebSocketCloseEvent(true, status, reason));
}
};
_wsconn.onNoUpgrade = (response) {
- if (_onclose !== null) {
+ if (_onclose != null) {
_onclose(
new _WebSocketCloseEvent(true,
WebSocketStatus.ABNORMAL_CLOSURE,
« no previous file with comments | « sdk/lib/io/timer_impl.dart ('k') | sdk/lib/mirrors/mirrors.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698