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

Side by Side Diff: runtime/bin/socket_impl.dart

Issue 9289042: Minor changes to the dart:io library files. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 5
6 class _SocketBase { 6 class _SocketBase {
7 // Bit flags used when communicating between the eventhandler and 7 // Bit flags used when communicating between the eventhandler and
8 // dart code. The EVENT flags are used to indicate events of 8 // dart code. The EVENT flags are used to indicate events of
9 // interest when sending a message from dart code to the 9 // interest when sending a message from dart code to the
10 // eventhandler. When receiving a message from the eventhandler the 10 // eventhandler. When receiving a message from the eventhandler the
(...skipping 20 matching lines...) Expand all
31 static final int _LAST_EVENT = _CLOSE_EVENT; 31 static final int _LAST_EVENT = _CLOSE_EVENT;
32 32
33 static final int _FIRST_COMMAND = _CLOSE_COMMAND; 33 static final int _FIRST_COMMAND = _CLOSE_COMMAND;
34 static final int _LAST_COMMAND = _SHUTDOWN_WRITE_COMMAND; 34 static final int _LAST_COMMAND = _SHUTDOWN_WRITE_COMMAND;
35 35
36 _SocketBase () { 36 _SocketBase () {
37 _handlerMap = new List(_LAST_EVENT + 1); 37 _handlerMap = new List(_LAST_EVENT + 1);
38 _handlerMask = 0; 38 _handlerMask = 0;
39 _canActivateHandlers = true; 39 _canActivateHandlers = true;
40 _id = -1; 40 _id = -1;
41 EventHandler._start(); 41 _EventHandler._start();
42 } 42 }
43 43
44 // Multiplexes socket events to the socket handlers. 44 // Multiplexes socket events to the socket handlers.
45 void _multiplex(List<int> message) { 45 void _multiplex(List<int> message) {
46 assert(message.length == 1); 46 assert(message.length == 1);
47 _canActivateHandlers = false; 47 _canActivateHandlers = false;
48 int event_mask = message[0]; 48 int event_mask = message[0];
49 for (int i = _FIRST_EVENT; i <= _LAST_EVENT; i++) { 49 for (int i = _FIRST_EVENT; i <= _LAST_EVENT; i++) {
50 if (((event_mask & (1 << i)) != 0)) { 50 if (((event_mask & (1 << i)) != 0)) {
51 if ((i == _CLOSE_EVENT) && this is _Socket && _id >= 0) { 51 if ((i == _CLOSE_EVENT) && this is _Socket && _id >= 0) {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 _handler.close(); 156 _handler.close();
157 _handler = null; 157 _handler = null;
158 _id = -1; 158 _id = -1;
159 } 159 }
160 160
161 void _sendToEventHandler(int data) { 161 void _sendToEventHandler(int data) {
162 if (_handler === null) { 162 if (_handler === null) {
163 _handler = new ReceivePort(); 163 _handler = new ReceivePort();
164 _handler.receive((var message, ignored) { _multiplex(message); }); 164 _handler.receive((var message, ignored) { _multiplex(message); });
165 } 165 }
166 EventHandler._sendData(_id, _handler, data); 166 _EventHandler._sendData(_id, _handler, data);
167 } 167 }
168 168
169 abstract bool _isListenSocket(); 169 abstract bool _isListenSocket();
170 abstract bool _isPipe(); 170 abstract bool _isPipe();
171 171
172 // Socket id is set from native. -1 indicates that the socket was closed. 172 // Socket id is set from native. -1 indicates that the socket was closed.
173 int _id; 173 int _id;
174 174
175 // Dedicated ReceivePort for socket events. 175 // Dedicated ReceivePort for socket events.
176 ReceivePort _handler; 176 ReceivePort _handler;
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 bool _seenFirstOutEvent = false; 455 bool _seenFirstOutEvent = false;
456 bool _closedRead = false; 456 bool _closedRead = false;
457 bool _closedWrite = false; 457 bool _closedWrite = false;
458 bool _pipe = false; 458 bool _pipe = false;
459 Function _clientConnectHandler; 459 Function _clientConnectHandler;
460 Function _clientWriteHandler; 460 Function _clientWriteHandler;
461 SocketInputStream _inputStream; 461 SocketInputStream _inputStream;
462 SocketOutputStream _outputStream; 462 SocketOutputStream _outputStream;
463 } 463 }
464 464
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698