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

Side by Side Diff: lib/runtime/messages_widget.dart

Issue 1131933003: Load time improvements (fixes #140) (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « lib/devc.dart ('k') | lib/runtime/messages_widget.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 /// This library provides a single function called injectLogs which when called 5 /// This library provides a single function called injectLogs which when called
6 /// will request a logs json file and build a small widget out of them which 6 /// will request a logs json file and build a small widget out of them which
7 /// groups the logs by level. 7 /// groups the logs by level.
8 library polymer.build.log_injector; 8 library polymer.build.log_injector;
9 9
10 import 'dart:async'; 10 import 'dart:async';
11 import 'dart:convert'; 11 import 'dart:convert';
12 import 'dart:html'; 12 import 'dart:html';
13 13
14 import 'package:path/path.dart' as path; 14 import 'package:path/path.dart' as path;
15 import 'package:source_span/source_span.dart'; 15 import 'package:source_span/source_span.dart';
16 import 'package:dev_compiler/src/summary.dart'; 16 import 'package:dev_compiler/src/summary.dart';
17 17
18 main() async => displayMessages(await HttpRequest.getString('messages.json')); 18 main() async {
19 await window.animationFrame;
20 displayMessages(await HttpRequest.getString('messages.json'));
21 }
19 22
20 void displayMessages(String data) { 23 void displayMessages(String data) {
21 var summary = GlobalSummary.parse(JSON.decode(data)); 24 var summary = GlobalSummary.parse(JSON.decode(data));
22 var messagesByLevel = _getMessagesByLevel(summary); 25 var messagesByLevel = _getMessagesByLevel(summary);
23 if (messagesByLevel.isEmpty) return; 26 if (messagesByLevel.isEmpty) return;
24 27
25 // Build the wrapper, menu, and content divs. 28 // Build the wrapper, menu, and content divs.
26 var menuWrapper = new DivElement()..classes.add('menu'); 29 var menuWrapper = new DivElement()..classes.add('menu');
27 var contentWrapper = new DivElement()..classes.add('content'); 30 var contentWrapper = new DivElement()..classes.add('content');
28 var wrapperDiv = new DivElement() 31 var wrapperDiv = new DivElement()
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 class _Visitor extends RecursiveSummaryVisitor { 126 class _Visitor extends RecursiveSummaryVisitor {
124 final Map<String, List<MessageSummary>> messagesByLevel = {}; 127 final Map<String, List<MessageSummary>> messagesByLevel = {};
125 128
126 @override 129 @override
127 void visitMessage(MessageSummary message) { 130 void visitMessage(MessageSummary message) {
128 var level = message.level.toLowerCase(); 131 var level = message.level.toLowerCase();
129 messagesByLevel.putIfAbsent(level, () => []); 132 messagesByLevel.putIfAbsent(level, () => []);
130 messagesByLevel[level].add(message); 133 messagesByLevel[level].add(message);
131 } 134 }
132 } 135 }
OLDNEW
« no previous file with comments | « lib/devc.dart ('k') | lib/runtime/messages_widget.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698