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

Side by Side Diff: runtime/bin/vmservice/vmservice.dart

Issue 21880004: Cleanup vm_service library loading. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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
OLDNEW
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:json' as JSON; 8 import 'dart:json' as JSON;
9 // TODO(11927): Factor 'dart:io' dependency into separate library.
10 import 'dart:io';
11 import 'dart:isolate'; 9 import 'dart:isolate';
12 import 'dart:typed_data'; 10 import 'dart:typed_data';
13 import 'dart:utf' as UTF; 11 import 'dart:utf' as UTF;
14 12
13 part 'constants.dart';
14 part 'resources.dart';
15 part 'running_isolate.dart';
16 part 'running_isolates.dart';
17 part 'service_request.dart';
18 part 'service_request_router.dart';
15 19
16 class VmService { 20 class VMService {
17 static VmService _instance; 21 static VMService _instance;
18 RunningIsolates runningIsolates = new RunningIsolates(); 22 RunningIsolates runningIsolates = new RunningIsolates();
19 23
20 void controlMessageHandler(int code, SendPort sp) { 24 void controlMessageHandler(int code, SendPort sp) {
21 switch (code) { 25 switch (code) {
22 case Constants.ISOLATE_STARTUP_MESSAGE_ID: 26 case Constants.ISOLATE_STARTUP_MESSAGE_ID:
23 runningIsolates.isolateStartup(sp); 27 runningIsolates.isolateStartup(sp);
24 break; 28 break;
25 case Constants.ISOLATE_SHUTDOWN_MESSAGE_ID: 29 case Constants.ISOLATE_SHUTDOWN_MESSAGE_ID:
26 runningIsolates.isolateShutdown(sp); 30 runningIsolates.isolateShutdown(sp);
27 break; 31 break;
28 } 32 }
29 } 33 }
30 34
31 void messageHandler(message, SendPort replyTo) { 35 void messageHandler(message, SendPort replyTo) {
32 if (message is List && message.length == 2) { 36 if (message is List && message.length == 2) {
33 controlMessageHandler(message[0], message[1]); 37 controlMessageHandler(message[0], message[1]);
34 } 38 }
35 } 39 }
36 40
37 VmService._internal() { 41 VMService._internal() {
38 port.receive(messageHandler); 42 port.receive(messageHandler);
39 } 43 }
40 44
41 factory VmService() { 45 factory VMService() {
42 if (VmService._instance == null) { 46 if (VMService._instance == null) {
43 VmService._instance = new VmService._internal(); 47 VMService._instance = new VMService._internal();
44 } 48 }
45 return _instance; 49 return _instance;
46 } 50 }
47 } 51 }
48 52
49 void sendServiceMessage(SendPort sp, ReceivePort rp, Object m) 53 void sendServiceMessage(SendPort sp, ReceivePort rp, Object m)
50 native "SendServiceMessage"; 54 native "SendServiceMessage";
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698