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

Unified Diff: samples/chat/chat_server_lib.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « samples/calculator/tape.dart ('k') | samples/chat/chat_stress_client.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: samples/chat/chat_server_lib.dart
diff --git a/samples/chat/chat_server_lib.dart b/samples/chat/chat_server_lib.dart
index 01164ed8b2ae12d65de40a02b555dd95d7db0bae..7bbf55242fbbacbc2556ef33318a423de1849543 100644
--- a/samples/chat/chat_server_lib.dart
+++ b/samples/chat/chat_server_lib.dart
@@ -3,9 +3,10 @@
// BSD-style license that can be found in the LICENSE file.
library chat_server;
+import 'dart:async';
import 'dart:io';
import 'dart:isolate';
-import 'dart:json';
+import 'dart:json' as json;
import 'dart:math';
void startChatServer() {
@@ -308,7 +309,7 @@ class IsolatedServer {
void _sendJSONResponse(HttpResponse response, Map responseData) {
response.headers.set("Content-Type", "application/json; charset=UTF-8");
- response.outputStream.writeString(JSON.stringify(responseData));
+ response.outputStream.writeString(json.stringify(responseData));
response.outputStream.close();
}
@@ -386,7 +387,7 @@ class IsolatedServer {
input.onClosed = () {
String data = body.toString();
if (data != null) {
- var requestData = JSON.parse(data);
+ var requestData = json.parse(data);
if (requestData["request"] == "join") {
String handle = requestData["handle"];
if (handle != null) {
@@ -419,7 +420,7 @@ class IsolatedServer {
input.onData = () => body.add(input.read());
input.onClosed = () {
String data = body.toString();
- var requestData = JSON.parse(data);
+ var requestData = json.parse(data);
if (requestData["request"] == "leave") {
String sessionId = requestData["sessionId"];
if (sessionId != null) {
@@ -451,7 +452,7 @@ class IsolatedServer {
String data = body.toString();
_messageCount++;
_messageRate.record(1);
- var requestData = JSON.parse(data);
+ var requestData = json.parse(data);
if (requestData["request"] == "message") {
String sessionId = requestData["sessionId"];
if (sessionId != null) {
@@ -486,7 +487,7 @@ class IsolatedServer {
input.onData = () => body.add(input.read());
input.onClosed = () {
String data = body.toString();
- var requestData = JSON.parse(data);
+ var requestData = json.parse(data);
if (requestData["request"] == "receive") {
String sessionId = requestData["sessionId"];
int nextMessage = requestData["nextMessage"];
@@ -638,7 +639,7 @@ class IsolatedServer {
class Rate {
Rate([int timeRange = 1000, int buckets = 10])
: _timeRange = timeRange,
- _buckets = new List(buckets + 1), // Current bucket is not in the sum.
+ _buckets = new List.fixedLength(buckets + 1), // Current bucket is not in the sum.
_currentBucket = 0,
_currentBucketTime = new Date.now().millisecondsSinceEpoch,
_sum = 0 {
« no previous file with comments | « samples/calculator/tape.dart ('k') | samples/chat/chat_stress_client.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698