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

Unified Diff: runtime/bin/vmservice/vmservice.dart

Issue 125103004: Move service into VM (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/vmservice/running_isolates.dart ('k') | runtime/bin/vmservice/vmservice_io.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/vmservice/vmservice.dart
diff --git a/runtime/bin/vmservice/vmservice.dart b/runtime/bin/vmservice/vmservice.dart
deleted file mode 100644
index 553242800cca94dde459c15b0703ebc0f13a835e..0000000000000000000000000000000000000000
--- a/runtime/bin/vmservice/vmservice.dart
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library vmservice;
-
-import 'dart:async';
-import 'dart:convert';
-import 'dart:isolate';
-import 'dart:typed_data';
-
-part 'client.dart';
-part 'constants.dart';
-part 'resources.dart';
-part 'running_isolate.dart';
-part 'running_isolates.dart';
-part 'message.dart';
-part 'message_router.dart';
-
-class VMService extends MessageRouter {
- static VMService _instance;
- /// Collection of currently connected clients.
- final Set<Client> clients = new Set<Client>();
- /// Collection of currently running isolates.
- RunningIsolates runningIsolates = new RunningIsolates();
- /// Isolate startup and shutdown messages are sent on this port.
- final RawReceivePort receivePort;
-
- void controlMessageHandler(int code, int port_id, SendPort sp, String name) {
- switch (code) {
- case Constants.ISOLATE_STARTUP_MESSAGE_ID:
- runningIsolates.isolateStartup(port_id, sp, name);
- break;
- case Constants.ISOLATE_SHUTDOWN_MESSAGE_ID:
- runningIsolates.isolateShutdown(port_id, sp);
- break;
- }
- }
-
- void _addClient(Client client) {
- clients.add(client);
- }
-
- void _removeClient(Client client) {
- clients.remove(client);
- }
-
- void messageHandler(message) {
- assert(message is List);
- assert(message.length == 4);
- if (message is List && message.length == 4) {
- controlMessageHandler(message[0], message[1], message[2], message[3]);
- }
- }
-
- VMService._internal() : receivePort = new RawReceivePort() {
- receivePort.handler = messageHandler;
- }
-
- factory VMService() {
- if (VMService._instance == null) {
- VMService._instance = new VMService._internal();
- }
- return _instance;
- }
-
- void _clientCollection(Message message) {
- var members = [];
- var result = {};
- clients.forEach((client) {
- members.add(client.toJson());
- });
- result['type'] = 'ClientList';
- result['members'] = members;
- message.setResponse(JSON.encode(result));
- }
-
- Future<String> route(Message message) {
- if (message.completed) {
- return message.response;
- }
- if ((message.path.length == 1) && (message.path[0] == 'clients')) {
- _clientCollection(message);
- return message.response;
- }
- return runningIsolates.route(message);
- }
-}
-
-void sendServiceMessage(SendPort sp, Object m)
- native "VMService_SendServiceMessage";
« no previous file with comments | « runtime/bin/vmservice/running_isolates.dart ('k') | runtime/bin/vmservice/vmservice_io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698