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

Unified Diff: runtime/observatory/lib/src/elements/json_view.dart

Issue 839543002: Revert "Build Observatory with runtime" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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
Index: runtime/observatory/lib/src/elements/json_view.dart
diff --git a/runtime/observatory/lib/src/elements/json_view.dart b/runtime/observatory/lib/src/elements/json_view.dart
deleted file mode 100644
index 141098d466856a952300622222ebc59b9bf92b6d..0000000000000000000000000000000000000000
--- a/runtime/observatory/lib/src/elements/json_view.dart
+++ /dev/null
@@ -1,95 +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 json_view_element;
-
-import 'package:polymer/polymer.dart';
-import 'observatory_element.dart';
-import 'package:observatory/service.dart';
-
-class JsonPrettyPrinter {
- String prettyPrint(ServiceMap map) {
- _buffer.clear();
- _buffer.write('{\n');
- _printMap(map, 0);
- _buffer.write('}\n');
- return _buffer.toString();
- }
-
- void _printMap(ObservableMap map, int depth) {
- if (_seen.contains(map)) {
- return;
- }
- _seen.add(map);
- for (var k in map.keys) {
- var v = map[k];
- if (v is Map) {
- _writeIndent(depth);
- _buffer.write('"$k": {\n');
- _printMap(v, depth + 1);
- _writeIndent(depth);
- _buffer.write('}\n');
- } else if (v is List) {
- _writeIndent(depth);
- _buffer.write('"$k": [\n');
- _printList(v, depth + 1);
- _writeIndent(depth);
- _buffer.write(']\n');
- } else {
- _writeIndent(depth);
- _buffer.write('"$k": $v');
- _buffer.write('\n');
- }
- }
- _seen.remove(map);
- }
-
- void _printList(ObservableList list, int depth) {
- if (_seen.contains(list)) {
- return;
- }
- _seen.add(list);
- for (var v in list) {
- if (v is Map) {
- _writeIndent(depth);
- _buffer.write('{\n');
- _printMap(v, depth + 1);
- _writeIndent(depth);
- _buffer.write('}\n');
- } else if (v is List) {
- _writeIndent(depth);
- _buffer.write('[\n');
- _printList(v, depth + 1);
- _writeIndent(depth);
- _buffer.write(']\n');
- } else {
- _writeIndent(depth);
- _buffer.write(v);
- _buffer.write('\n');
- }
- }
- _seen.remove(list);
- }
-
- void _writeIndent(int depth) {
- const tab = ' '; // 2 spaces.
- _buffer.write(tab * depth);
- }
-
- final _buffer = new StringBuffer();
- final _seen = new Set();
-}
-
-
-@CustomTag('json-view')
-class JsonViewElement extends ObservatoryElement {
- @published ServiceMap map;
- @observable String mapAsString;
- JsonViewElement.created() : super.created();
-
- void mapChanged(oldValue) {
- var jpp = new JsonPrettyPrinter();
- mapAsString = jpp.prettyPrint(map);
- }
-}
« no previous file with comments | « runtime/observatory/lib/src/elements/isolate_view.html ('k') | runtime/observatory/lib/src/elements/json_view.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698