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

Unified Diff: runtime/bin/socket_patch.dart

Issue 311153003: Add Observatory test of io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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/service_object_patch.dart ('k') | tests/standalone/io/observatory.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 4f285503c20c4cf2a2bbe6ef5138b22e70e6e315..7cb36c8305d81e3b38a356f5c18c833cda84797e 100644
--- a/runtime/bin/socket_patch.dart
+++ b/runtime/bin/socket_patch.dart
@@ -286,6 +286,7 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
// Handlers and receive port for socket events from the event handler.
final List eventHandlers = new List(EVENT_COUNT + 1);
RawReceivePort eventPort;
+ bool flagsSent = false;
// The type flags for this socket.
final int typeFlags;
@@ -457,6 +458,7 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
port: port);
}
if (port != 0) socket.localPort = port;
+ socket.connectToEventHandler();
return socket;
});
}
@@ -759,7 +761,8 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
}
void returnTokens(int tokenBatchSize) {
- if (eventPort != null && !isClosing && !isClosed) {
+ if (!isClosing && !isClosed) {
+ assert(eventPort != null);
// Return in batches.
if (tokens == tokenBatchSize) {
assert(tokens < (1 << FIRST_COMMAND));
@@ -782,7 +785,8 @@ class _NativeSocket extends _NativeSocketNativeWrapper with _ServiceObject {
sendWriteEvents = write;
if (read) issueReadEvent();
if (write) issueWriteEvent();
- if (eventPort == null && !isClosing) {
+ if (!flagsSent && !isClosing) {
+ flagsSent = true;
int flags = typeFlags & TYPE_TYPE_MASK;
if (!isClosedRead) flags |= 1 << READ_EVENT;
if (!isClosedWrite) flags |= 1 << WRITE_EVENT;
« no previous file with comments | « runtime/bin/service_object_patch.dart ('k') | tests/standalone/io/observatory.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698