Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 protocol; | 5 library protocol; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 | 9 |
| 10 part 'generated_protocol.dart'; | 10 part 'generated_protocol.dart'; |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 462 json[Notification.EVENT], | 462 json[Notification.EVENT], |
| 463 json[Notification.PARAMS]); | 463 json[Notification.PARAMS]); |
| 464 } | 464 } |
| 465 | 465 |
| 466 /** | 466 /** |
| 467 * Return a table representing the structure of the Json object that will be | 467 * Return a table representing the structure of the Json object that will be |
| 468 * sent to the client to represent this response. | 468 * sent to the client to represent this response. |
| 469 */ | 469 */ |
| 470 Map<String, Object> toJson() { | 470 Map<String, Object> toJson() { |
| 471 Map<String, Object> jsonObject = {}; | 471 Map<String, Object> jsonObject = {}; |
| 472 jsonObject['time'] = new DateTime.now().millisecondsSinceEpoch; | |
|
danrubel
2015/01/23 14:16:53
Good idea, but I already have a pending CL to capt
scheglov
2015/01/23 16:27:40
Done.
| |
| 472 jsonObject[EVENT] = event; | 473 jsonObject[EVENT] = event; |
| 473 if (_params != null) { | 474 if (_params != null) { |
| 474 jsonObject[PARAMS] = _params; | 475 jsonObject[PARAMS] = _params; |
| 475 } | 476 } |
| 476 return jsonObject; | 477 return jsonObject; |
| 477 } | 478 } |
| 478 } | 479 } |
| 479 | 480 |
| 480 /** | 481 /** |
| 481 * Instances of the class [Request] represent a request that was received. | 482 * Instances of the class [Request] represent a request that was received. |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 822 requestId, | 823 requestId, |
| 823 error: new RequestError(RequestErrorCode.UNSUPPORTED_FEATURE, message) ); | 824 error: new RequestError(RequestErrorCode.UNSUPPORTED_FEATURE, message) ); |
| 824 | 825 |
| 825 /** | 826 /** |
| 826 * Return a table representing the structure of the Json object that will be | 827 * Return a table representing the structure of the Json object that will be |
| 827 * sent to the client to represent this response. | 828 * sent to the client to represent this response. |
| 828 */ | 829 */ |
| 829 Map<String, Object> toJson() { | 830 Map<String, Object> toJson() { |
| 830 Map<String, Object> jsonObject = new HashMap<String, Object>(); | 831 Map<String, Object> jsonObject = new HashMap<String, Object>(); |
| 831 jsonObject[ID] = id; | 832 jsonObject[ID] = id; |
| 833 jsonObject['time'] = new DateTime.now().millisecondsSinceEpoch; | |
|
danrubel
2015/01/23 14:16:53
Please remove this as described above.
scheglov
2015/01/23 16:27:40
Done.
| |
| 832 if (error != null) { | 834 if (error != null) { |
| 833 jsonObject[ERROR] = error.toJson(); | 835 jsonObject[ERROR] = error.toJson(); |
| 834 } | 836 } |
| 835 if (_result != null) { | 837 if (_result != null) { |
| 836 jsonObject[RESULT] = _result; | 838 jsonObject[RESULT] = _result; |
| 837 } | 839 } |
| 838 return jsonObject; | 840 return jsonObject; |
| 839 } | 841 } |
| 840 } | 842 } |
| 841 | 843 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 876 hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); | 878 hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); |
| 877 hash = hash ^ (hash >> 11); | 879 hash = hash ^ (hash >> 11); |
| 878 return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); | 880 return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); |
| 879 } | 881 } |
| 880 | 882 |
| 881 static int hash2(a, b) => finish(combine(combine(0, a), b)); | 883 static int hash2(a, b) => finish(combine(combine(0, a), b)); |
| 882 | 884 |
| 883 static int hash4(a, b, c, d) => | 885 static int hash4(a, b, c, d) => |
| 884 finish(combine(combine(combine(combine(0, a), b), c), d)); | 886 finish(combine(combine(combine(combine(0, a), b), c), d)); |
| 885 } | 887 } |
| OLD | NEW |