| 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 | |
| 113 VMService._internal() | 109 VMService._internal() |
| 114 : eventPort = isolateLifecyclePort { | 110 : eventPort = isolateLifecyclePort { |
| 115 scriptLoadPort.handler = _notSupported; | |
| 116 eventPort.handler = messageHandler; | 111 eventPort.handler = messageHandler; |
| 117 } | 112 } |
| 118 | 113 |
| 119 factory VMService() { | 114 factory VMService() { |
| 120 if (VMService._instance == null) { | 115 if (VMService._instance == null) { |
| 121 VMService._instance = new VMService._internal(); | 116 VMService._instance = new VMService._internal(); |
| 122 _onStart(); | 117 _onStart(); |
| 123 } | 118 } |
| 124 return _instance; | 119 return _instance; |
| 125 } | 120 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 152 |
| 158 void _registerIsolate(int port_id, SendPort sp, String name) { | 153 void _registerIsolate(int port_id, SendPort sp, String name) { |
| 159 var service = new VMService(); | 154 var service = new VMService(); |
| 160 service.runningIsolates.isolateStartup(port_id, sp, name); | 155 service.runningIsolates.isolateStartup(port_id, sp, name); |
| 161 } | 156 } |
| 162 | 157 |
| 163 void _setEventMask(int mask) | 158 void _setEventMask(int mask) |
| 164 native "VMService_SetEventMask"; | 159 native "VMService_SetEventMask"; |
| 165 | 160 |
| 166 void _onStart() native "VMService_OnStart"; | 161 void _onStart() native "VMService_OnStart"; |
| OLD | NEW |