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

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

Issue 10787021: Fix type checking of void type. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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/vm/snapshot_test.cc ('k') | tests/co19/co19-runtime.status » ('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 #library("chat_server"); 5 #library("chat_server");
6 #import("dart:io"); 6 #import("dart:io");
7 #import("dart:isolate"); 7 #import("dart:isolate");
8 #import("dart:json"); 8 #import("dart:json");
9 9
10 class ChatServer extends IsolatedServer { 10 class ChatServer extends IsolatedServer {
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 51 }
52 52
53 53
54 class User { 54 class User {
55 User(this._handle) { 55 User(this._handle) {
56 // TODO(sgjesse) Generate more secure and unique session id's. 56 // TODO(sgjesse) Generate more secure and unique session id's.
57 _sessionId = "a${(Math.random() * 1000000).toInt()}"; 57 _sessionId = "a${(Math.random() * 1000000).toInt()}";
58 markActivity(); 58 markActivity();
59 } 59 }
60 60
61 void markActivity() => _lastActive = new Date.now(); 61 void markActivity() { _lastActive = new Date.now(); }
62 Duration idleTime(Date now) => now.difference(_lastActive); 62 Duration idleTime(Date now) => now.difference(_lastActive);
63 63
64 String get handle() => _handle; 64 String get handle() => _handle;
65 String get sessionId() => _sessionId; 65 String get sessionId() => _sessionId;
66 66
67 String _handle; 67 String _handle;
68 String _sessionId; 68 String _sessionId;
69 Date _lastActive; 69 Date _lastActive;
70 } 70 }
71 71
(...skipping 11 matching lines...) Expand all
83 Message(this._from, this._message) 83 Message(this._from, this._message)
84 : _received = new Date.now(), _type = MESSAGE; 84 : _received = new Date.now(), _type = MESSAGE;
85 Message.leave(this._from) 85 Message.leave(this._from)
86 : _received = new Date.now(), _type = LEAVE; 86 : _received = new Date.now(), _type = LEAVE;
87 Message.timeout(this._from) 87 Message.timeout(this._from)
88 : _received = new Date.now(), _type = TIMEOUT; 88 : _received = new Date.now(), _type = TIMEOUT;
89 89
90 User get from() => _from; 90 User get from() => _from;
91 Date get received() => _received; 91 Date get received() => _received;
92 String get message() => _message; 92 String get message() => _message;
93 void set messageNumber(int n) => _messageNumber = n; 93 void set messageNumber(int n) { _messageNumber = n; }
94 94
95 Map toMap() { 95 Map toMap() {
96 Map map = new Map(); 96 Map map = new Map();
97 map["from"] = _from.handle; 97 map["from"] = _from.handle;
98 map["received"] = _received.toString(); 98 map["received"] = _received.toString();
99 map["type"] = _typeName[_type]; 99 map["type"] = _typeName[_type];
100 if (_type == MESSAGE) map["message"] = _message; 100 if (_type == MESSAGE) map["message"] = _message;
101 map["number"] = _messageNumber; 101 map["number"] = _messageNumber;
102 return map; 102 return map;
103 } 103 }
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 } 679 }
680 } 680 }
681 681
682 int _timeRange; 682 int _timeRange;
683 List<int> _buckets; 683 List<int> _buckets;
684 int _currentBucket; 684 int _currentBucket;
685 int _currentBucketTime; 685 int _currentBucketTime;
686 num _bucketTimeRange; 686 num _bucketTimeRange;
687 int _sum; 687 int _sum;
688 } 688 }
OLDNEW
« no previous file with comments | « runtime/vm/snapshot_test.cc ('k') | tests/co19/co19-runtime.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698