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

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

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
« no previous file with comments | « runtime/bin/process_patch.dart ('k') | runtime/lib/array.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 patch class ServerSocket { 5 patch class ServerSocket {
6 /* patch */ factory ServerSocket(String bindAddress, int port, int backlog) { 6 /* patch */ factory ServerSocket(String bindAddress, int port, int backlog) {
7 return new _ServerSocket(bindAddress, port, backlog); 7 return new _ServerSocket(bindAddress, port, backlog);
8 } 8 }
9 } 9 }
10 10
(...skipping 27 matching lines...) Expand all
38 static const int _LISTENING_SOCKET = 16; 38 static const int _LISTENING_SOCKET = 16;
39 static const int _PIPE = 17; 39 static const int _PIPE = 17;
40 40
41 static const int _FIRST_EVENT = _IN_EVENT; 41 static const int _FIRST_EVENT = _IN_EVENT;
42 static const int _LAST_EVENT = _CLOSE_EVENT; 42 static const int _LAST_EVENT = _CLOSE_EVENT;
43 43
44 static const int _FIRST_COMMAND = _CLOSE_COMMAND; 44 static const int _FIRST_COMMAND = _CLOSE_COMMAND;
45 static const int _LAST_COMMAND = _SHUTDOWN_WRITE_COMMAND; 45 static const int _LAST_COMMAND = _SHUTDOWN_WRITE_COMMAND;
46 46
47 _SocketBase () { 47 _SocketBase () {
48 _handlerMap = new List(_LAST_EVENT + 1); 48 _handlerMap = new List.fixedLength(_LAST_EVENT + 1);
49 _handlerMask = 0; 49 _handlerMask = 0;
50 _canActivateHandlers = true; 50 _canActivateHandlers = true;
51 _closed = true; 51 _closed = true;
52 _EventHandler._start(); 52 _EventHandler._start();
53 _hashCode = _nextHashCode; 53 _hashCode = _nextHashCode;
54 _nextHashCode = (_nextHashCode + 1) & 0xFFFFFFF; 54 _nextHashCode = (_nextHashCode + 1) & 0xFFFFFFF;
55 } 55 }
56 56
57 // Multiplexes socket events to the socket handlers. 57 // Multiplexes socket events to the socket handlers.
58 void _multiplex(int event_mask) { 58 void _multiplex(int event_mask) {
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 332
333 class _Socket extends _SocketBase implements Socket { 333 class _Socket extends _SocketBase implements Socket {
334 static const HOST_NAME_LOOKUP = 0; 334 static const HOST_NAME_LOOKUP = 0;
335 335
336 // Constructs a new socket. During the construction an asynchronous 336 // Constructs a new socket. During the construction an asynchronous
337 // host name lookup is initiated. The returned socket is not yet 337 // host name lookup is initiated. The returned socket is not yet
338 // connected but ready for registration of callbacks. 338 // connected but ready for registration of callbacks.
339 factory _Socket(String host, int port) { 339 factory _Socket(String host, int port) {
340 Socket socket = new _Socket._internal(); 340 Socket socket = new _Socket._internal();
341 _ensureSocketService(); 341 _ensureSocketService();
342 List request = new List(2); 342 List request = new List.fixedLength(2);
343 request[0] = HOST_NAME_LOOKUP; 343 request[0] = HOST_NAME_LOOKUP;
344 request[1] = host; 344 request[1] = host;
345 _socketService.call(request).then((response) { 345 _socketService.call(request).then((response) {
346 if (socket._isErrorResponse(response)) { 346 if (socket._isErrorResponse(response)) {
347 socket._reportError(response, "Failed host name lookup"); 347 socket._reportError(response, "Failed host name lookup");
348 } else{ 348 } else{
349 var result = socket._createConnect(response, port); 349 var result = socket._createConnect(response, port);
350 if (result is OSError) { 350 if (result is OSError) {
351 socket.close(); 351 socket.close();
352 socket._reportError(result, "Connection failed"); 352 socket._reportError(result, "Connection failed");
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 bool _seenFirstOutEvent = false; 598 bool _seenFirstOutEvent = false;
599 bool _pipe = false; 599 bool _pipe = false;
600 Function _clientConnectHandler; 600 Function _clientConnectHandler;
601 Function _clientWriteHandler; 601 Function _clientWriteHandler;
602 _SocketInputStream _inputStream; 602 _SocketInputStream _inputStream;
603 _SocketOutputStream _outputStream; 603 _SocketOutputStream _outputStream;
604 String _remoteHost; 604 String _remoteHost;
605 int _remotePort; 605 int _remotePort;
606 static SendPort _socketService; 606 static SendPort _socketService;
607 } 607 }
OLDNEW
« no previous file with comments | « runtime/bin/process_patch.dart ('k') | runtime/lib/array.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698