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

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

Issue 19622003: VM Service isolate listing (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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/constants.dart ('k') | runtime/bin/vmservice/running_isolate.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/vmservice/resources.dart
diff --git a/runtime/bin/vmservice/resources.dart b/runtime/bin/vmservice/resources.dart
new file mode 100644
index 0000000000000000000000000000000000000000..55a5a74ed77a9cb72b4e8d437504285cf23d9107
--- /dev/null
+++ b/runtime/bin/vmservice/resources.dart
@@ -0,0 +1,45 @@
+// 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.
+
+part of vmservice;
+
+String detectMimeType(String name) {
+ var extension = new Path(name).extension;
+ switch (extension) {
+ case 'html':
+ return 'text/html; charset=UTF-8';
+ case 'dart':
+ return 'application/dart; charset=UTF-8';
+ case 'js':
+ return 'application/javascript; charset=UTF-8';
+ case 'css':
+ return 'text/css; charset=UTF-8';
+ case 'gif':
+ return 'image/gif';
+ case 'png':
+ return 'image/png';
+ case 'jpg':
+ return 'image/jpeg';
+ case 'jpeg':
+ return 'image/jpeg';
+ default:
+ return 'text/plain';
+ }
+}
+
+
+class Resource {
+ final String name;
+ final String mimeType;
+ final List<int> data;
+ Resource(this.name, this.mimeType, this.data);
+ static final Map<String, Resource> resources = new Map<String, Resource>();
+}
+
+
+void _addResource(String name, List<int> data) {
+ var mimeType = detectMimeType(name);
+ Resource resource = new Resource(name, detectMimeType(name), data);
+ Resource.resources[name] = resource;
+}
« no previous file with comments | « runtime/bin/vmservice/constants.dart ('k') | runtime/bin/vmservice/running_isolate.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698