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

Side by Side Diff: samples/chat/chat_server_lib.dart

Issue 14150002: Remove StreamSink(replaced by EventSink) and make IOSink extend EventSink. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library chat_server; 5 library chat_server;
6 import 'dart:async'; 6 import 'dart:async';
7 import 'dart:io'; 7 import 'dart:io';
8 import 'dart:isolate'; 8 import 'dart:isolate';
9 import 'dart:json' as json; 9 import 'dart:json' as json;
10 import 'dart:math'; 10 import 'dart:math';
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 void redirectPageHandler(HttpRequest request, 310 void redirectPageHandler(HttpRequest request,
311 HttpResponse response, 311 HttpResponse response,
312 String redirectPath) { 312 String redirectPath) {
313 if (_redirectPage == null) { 313 if (_redirectPage == null) {
314 _redirectPage = redirectPageHtml.codeUnits; 314 _redirectPage = redirectPageHtml.codeUnits;
315 } 315 }
316 response.statusCode = HttpStatus.FOUND; 316 response.statusCode = HttpStatus.FOUND;
317 response.headers.set( 317 response.headers.set(
318 "Location", "http://$_host:$_port/${redirectPath}"); 318 "Location", "http://$_host:$_port/${redirectPath}");
319 response.contentLength = _redirectPage.length; 319 response.contentLength = _redirectPage.length;
320 response.writeBytes(_redirectPage); 320 response.add(_redirectPage);
321 response.close(); 321 response.close();
322 } 322 }
323 323
324 // Serve the content of a file. 324 // Serve the content of a file.
325 void fileHandler( 325 void fileHandler(
326 HttpRequest request, HttpResponse response, [String fileName = null]) { 326 HttpRequest request, HttpResponse response, [String fileName = null]) {
327 final int BUFFER_SIZE = 4096; 327 final int BUFFER_SIZE = 4096;
328 if (fileName == null) { 328 if (fileName == null) {
329 fileName = request.uri.path.substring(1); 329 fileName = request.uri.path.substring(1);
330 } 330 }
(...skipping 22 matching lines...) Expand all
353 } 353 }
354 354
355 // Serve the not found page. 355 // Serve the not found page.
356 void _notFoundHandler(HttpRequest request, HttpResponse response) { 356 void _notFoundHandler(HttpRequest request, HttpResponse response) {
357 if (_notFoundPage == null) { 357 if (_notFoundPage == null) {
358 _notFoundPage = notFoundPageHtml.codeUnits; 358 _notFoundPage = notFoundPageHtml.codeUnits;
359 } 359 }
360 response.statusCode = HttpStatus.NOT_FOUND; 360 response.statusCode = HttpStatus.NOT_FOUND;
361 response.headers.set("Content-Type", "text/html; charset=UTF-8"); 361 response.headers.set("Content-Type", "text/html; charset=UTF-8");
362 response.contentLength = _notFoundPage.length; 362 response.contentLength = _notFoundPage.length;
363 response.writeBytes(_notFoundPage); 363 response.add(_notFoundPage);
364 response.close(); 364 response.close();
365 } 365 }
366 366
367 // Unexpected protocol data. 367 // Unexpected protocol data.
368 void _protocolError(HttpRequest request, HttpResponse response) { 368 void _protocolError(HttpRequest request, HttpResponse response) {
369 response.statusCode = HttpStatus.INTERNAL_SERVER_ERROR; 369 response.statusCode = HttpStatus.INTERNAL_SERVER_ERROR;
370 response.contentLength = 0; 370 response.contentLength = 0;
371 response.close(); 371 response.close();
372 } 372 }
373 373
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 } 671 }
672 } 672 }
673 673
674 int _timeRange; 674 int _timeRange;
675 List<int> _buckets; 675 List<int> _buckets;
676 int _currentBucket; 676 int _currentBucket;
677 int _currentBucketTime; 677 int _currentBucketTime;
678 num _bucketTimeRange; 678 num _bucketTimeRange;
679 int _sum; 679 int _sum;
680 } 680 }
OLDNEW
« no previous file with comments | « runtime/bin/socket_patch.dart ('k') | sdk/lib/_internal/compiler/implementation/lib/isolate_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698