| OLD | NEW |
| 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 vmservice; | 5 library vmservice; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 import 'dart:isolate'; | 9 import 'dart:isolate'; |
| 10 import 'dart:typed_data'; | 10 import 'dart:typed_data'; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 assert(message is List); | 99 assert(message is List); |
| 100 if (message is List && message.length == 4) { | 100 if (message is List && message.length == 4) { |
| 101 _controlMessageHandler(message[0], message[1], message[2], message[3]); | 101 _controlMessageHandler(message[0], message[1], message[2], message[3]); |
| 102 } else if (message is List && message.length == 2) { | 102 } else if (message is List && message.length == 2) { |
| 103 _eventMessageHandler(message[0], message[1]); | 103 _eventMessageHandler(message[0], message[1]); |
| 104 } else { | 104 } else { |
| 105 Logger.root.severe('Unexpected message: $message'); | 105 Logger.root.severe('Unexpected message: $message'); |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 | 108 |
| 109 void _notSupported(_) { |
| 110 throw new UnimplementedError('Service script loading not supported.'); |
| 111 } |
| 112 |
| 109 VMService._internal() | 113 VMService._internal() |
| 110 : eventPort = isolateLifecyclePort { | 114 : eventPort = isolateLifecyclePort { |
| 115 scriptLoadPort.handler = _notSupported; |
| 111 eventPort.handler = messageHandler; | 116 eventPort.handler = messageHandler; |
| 112 } | 117 } |
| 113 | 118 |
| 114 factory VMService() { | 119 factory VMService() { |
| 115 if (VMService._instance == null) { | 120 if (VMService._instance == null) { |
| 116 VMService._instance = new VMService._internal(); | 121 VMService._instance = new VMService._internal(); |
| 117 _onStart(); | 122 _onStart(); |
| 118 } | 123 } |
| 119 return _instance; | 124 return _instance; |
| 120 } | 125 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 | 157 |
| 153 void _registerIsolate(int port_id, SendPort sp, String name) { | 158 void _registerIsolate(int port_id, SendPort sp, String name) { |
| 154 var service = new VMService(); | 159 var service = new VMService(); |
| 155 service.runningIsolates.isolateStartup(port_id, sp, name); | 160 service.runningIsolates.isolateStartup(port_id, sp, name); |
| 156 } | 161 } |
| 157 | 162 |
| 158 void _setEventMask(int mask) | 163 void _setEventMask(int mask) |
| 159 native "VMService_SetEventMask"; | 164 native "VMService_SetEventMask"; |
| 160 | 165 |
| 161 void _onStart() native "VMService_OnStart"; | 166 void _onStart() native "VMService_OnStart"; |
| OLD | NEW |