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

Side by Side Diff: dart/pkg/dart2js_incremental/lib/compiler.dart

Issue 847573003: Push updates to browser. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Update package:browser version. 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 unified diff | Download patch | Annotate | Revision Log
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 import 'dart:io'; 5 import 'dart:io';
6 6
7 import 'dart:async' show 7 import 'dart:async' show
8 EventSink, 8 EventSink,
9 Future, 9 Future,
10 Stream, 10 Stream,
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 try { 85 try {
86 diagnosticHandler(uri, begin, end, message, kind); 86 diagnosticHandler(uri, begin, end, message, kind);
87 } catch (e) { 87 } catch (e) {
88 String name = diagnosticHandler.provider.relativizeUri(uri); 88 String name = diagnosticHandler.provider.relativizeUri(uri);
89 print('$name@$begin+${end - begin}: [$kind] $message}'); 89 print('$name@$begin+${end - begin}: [$kind] $message}');
90 } 90 }
91 } 91 }
92 92
93 Future inputProvider(Uri uri) { 93 Future inputProvider(Uri uri) {
94 if (uri.scheme == "file") { 94 if (uri.scheme == "file") {
95 watcher.watchFile(uri); 95 if (!'$uri'.startsWith('$libraryRoot')) {
96 watcher.watchFile(uri);
97 }
96 } 98 }
97 return diagnosticHandler.provider(uri); 99 return diagnosticHandler.provider(uri);
98 } 100 }
99 101
100 while (true) { 102 while (true) {
101 Stopwatch sw = new Stopwatch()..start(); 103 Stopwatch sw = new Stopwatch()..start();
102 IncrementalCompiler compiler = new IncrementalCompiler( 104 IncrementalCompiler compiler = new IncrementalCompiler(
103 libraryRoot: libraryRoot, 105 libraryRoot: libraryRoot,
104 packageRoot: packageRoot, 106 packageRoot: packageRoot,
105 inputProvider: inputProvider, 107 inputProvider: inputProvider,
(...skipping 10 matching lines...) Expand all
116 controller.add( 118 controller.add(
117 new CompilerEvent( 119 new CompilerEvent(
118 IncrementalKind.ERROR, compiler, outputProvider.output, sw)); 120 IncrementalKind.ERROR, compiler, outputProvider.output, sw));
119 } 121 }
120 122
121 while (await watcher.hasChanges()) { 123 while (await watcher.hasChanges()) {
122 try { 124 try {
123 Map<Uri, Uri> changes = watcher.readChanges(); 125 Map<Uri, Uri> changes = watcher.readChanges();
124 126
125 sw = new Stopwatch()..start(); 127 sw = new Stopwatch()..start();
126 await compiler.compileUpdates(changes); 128 String updates = await compiler.compileUpdates(changes);
127 sw.stop(); 129 sw.stop();
128 130
129 controller.add( 131 controller.add(
130 new CompilerEvent( 132 new CompilerEvent(
131 IncrementalKind.INCREMENTAL, compiler, outputProvider.output, 133 IncrementalKind.INCREMENTAL, compiler, outputProvider.output,
132 sw)); 134 sw, updates: updates));
133 135
134 } on IncrementalCompilationFailed catch (error, trace) { 136 } on IncrementalCompilationFailed catch (error, trace) {
135 controller.addError(error, trace); 137 controller.addError(error, trace);
136 break; 138 break;
137 } 139 }
138 } 140 }
139 } 141 }
140 } 142 }
141 143
142 /// Output provider which collects output in [output]. 144 /// Output provider which collects output in [output].
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 187
186 class CompilerEvent { 188 class CompilerEvent {
187 final IncrementalKind kind; 189 final IncrementalKind kind;
188 190
189 final IncrementalCompiler compiler; 191 final IncrementalCompiler compiler;
190 192
191 final Map<String, String> _output; 193 final Map<String, String> _output;
192 194
193 final Stopwatch stopwatch; 195 final Stopwatch stopwatch;
194 196
195 CompilerEvent(this.kind, this.compiler, this._output, this.stopwatch); 197 final String updates;
198
199 CompilerEvent(
200 this.kind, this.compiler, this._output, this.stopwatch, {this.updates});
196 201
197 String operator[](String key) => _output[key]; 202 String operator[](String key) => _output[key];
198 } 203 }
OLDNEW
« no previous file with comments | « dart/pkg/browser/pubspec.yaml ('k') | dart/pkg/dart2js_incremental/lib/dart2js_incremental.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698