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

Unified Diff: runtime/bin/socket_patch.dart

Issue 11606020: Reapply "Fixes to eventhandler and HTTP"" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove invalid assert (fixes Windows test) Created 8 years 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.cc ('k') | sdk/lib/io/http_impl.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/socket_patch.dart
diff --git a/runtime/bin/socket_patch.dart b/runtime/bin/socket_patch.dart
index 23edced3827c28622e041684692ae690b0d9473e..3b502a2f32aee80a8670f375b6dd0c956a0d909c 100644
--- a/runtime/bin/socket_patch.dart
+++ b/runtime/bin/socket_patch.dart
@@ -66,8 +66,10 @@ class _SocketBase extends NativeFieldWrapperClass1 {
var eventHandler = _handlerMap[i];
if (eventHandler != null || i == _ERROR_EVENT) {
- // Unregister the out handler before executing it.
- if (i == _OUT_EVENT) _setHandler(i, null);
+ // Unregister the out handler before executing it. There is
+ // no need to notify the eventhandler as handlers are
+ // disabled while the event is handled.
+ if (i == _OUT_EVENT) _setHandler(i, null, notifyEventhandler: false);
// Don't call the in handler if there is no data available
// after all.
@@ -87,7 +89,9 @@ class _SocketBase extends NativeFieldWrapperClass1 {
_activateHandlers();
}
- void _setHandler(int event, Function callback) {
+ void _setHandler(int event,
+ Function callback,
+ {bool notifyEventhandler: true}) {
if (callback == null) {
_handlerMask &= ~(1 << event);
} else {
@@ -103,7 +107,7 @@ class _SocketBase extends NativeFieldWrapperClass1 {
_handler.close();
_handler = null;
} else {
- _activateHandlers();
+ if (notifyEventhandler) _activateHandlers();
}
}
« no previous file with comments | « runtime/bin/socket.cc ('k') | sdk/lib/io/http_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698