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

Unified Diff: runtime/bin/socket_impl.dart

Issue 8413034: New OutputStream interface (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments from ager@ Created 9 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.dart ('k') | runtime/bin/socket_stream.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket_impl.dart
diff --git a/runtime/bin/socket_impl.dart b/runtime/bin/socket_impl.dart
index 7c69282485980633d0bcc3784a5e7608035d947d..deee66a5119c27be51cc88d60fd3c03b63176da8 100644
--- a/runtime/bin/socket_impl.dart
+++ b/runtime/bin/socket_impl.dart
@@ -47,7 +47,7 @@ class _SocketBase {
_canActivateHandlers = false;
int event_mask = message[0];
for (int i = _FIRST_EVENT; i <= _LAST_EVENT; i++) {
- if (((event_mask & (1 << i)) != 0) && _handlerMap[i] !== null) {
+ if (((event_mask & (1 << i)) != 0) && _handlerMap[i] != null) {
var handleEvent = _handlerMap[i];
// Unregister the out handler before executing it.
@@ -61,17 +61,17 @@ class _SocketBase {
}
}
_canActivateHandlers = true;
- _doActivateHandlers();
+ _activateHandlers();
}
void _setHandler(int event, void callback()) {
- if (callback === null) {
+ if (callback == null) {
_handlerMask &= ~(1 << event);
} else {
_handlerMask |= (1 << event);
}
_handlerMap[event] = callback;
- _doActivateHandlers();
+ _activateHandlers();
}
void _getPort() native "Socket_GetPort";
@@ -80,7 +80,7 @@ class _SocketBase {
_setHandler(_ERROR_EVENT, callback);
}
- void _doActivateHandlers() {
+ void _activateHandlers() {
if (_canActivateHandlers && (_id >= 0)) {
int data = _handlerMask;
if (_isListenSocket()) data |= (1 << _LISTENING_SOCKET);
@@ -105,16 +105,11 @@ class _SocketBase {
_handler.close();
_handler = null;
_id = -1;
- } else {
+ } else if (_handler != null) {
// This is to support closing sockets created but never assigned
// any actual socket.
- if (_handler === null) {
- throw new
- SocketIOException("Error: close failed - invalid socket handle");
- } else {
- _handler.close();
- _handler = null;
- }
+ _handler.close();
+ _handler = null;
}
}
« no previous file with comments | « runtime/bin/socket.dart ('k') | runtime/bin/socket_stream.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698