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

Unified Diff: dart/site/try/src/compilation.dart

Issue 340343006: Send console messages through interaction manager. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add comments. Created 6 years, 6 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 | « no previous file | dart/site/try/src/interaction_manager.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/site/try/src/compilation.dart
diff --git a/dart/site/try/src/compilation.dart b/dart/site/try/src/compilation.dart
index 63595fa7710bb2ddc1912eb8c94ea0cc8b380396..3233487430c672c39b2194f507845601383994b5 100644
--- a/dart/site/try/src/compilation.dart
+++ b/dart/site/try/src/compilation.dart
@@ -71,7 +71,6 @@ class CompilationProcess {
final Element console;
final ReceivePort receivePort = new ReceivePort();
final Set<String> seenMessages = new Set<String>();
- bool isCleared = false;
bool isDone = false;
bool usesDartHtml = false;
Worker worker;
@@ -88,12 +87,6 @@ class CompilationProcess {
return true;
}
- void clear() {
- if (verboseCompiler) return;
- if (!isCleared) console.nodes.clear();
- isCleared = true;
- }
-
void start() {
if (!shouldStartCompilation()) {
receivePort.close();
@@ -101,7 +94,6 @@ class CompilationProcess {
}
if (current != null) current.dispose();
current = this;
- console.nodes.clear();
var options = [
'--analyze-main',
'--disable-type-inference',
@@ -113,9 +105,6 @@ class CompilationProcess {
if (onlyAnalyze) options.add('--analyze-only');
interaction.compilationStarting();
compilerPort.send([['options', options], receivePort.sendPort]);
- console.appendHtml('<i class="icon-spinner icon-spin"></i>');
- console.appendText(' Compiling Dart program...\n');
- outputFrame.style.display = 'none';
receivePort.listen(onMessage);
compilerPort.send([source, receivePort.sendPort]);
}
@@ -146,8 +135,8 @@ class CompilationProcess {
}
onFail(_) {
- clear();
- consolePrint('Compilation failed');
+ // TODO(ahe): Call interaction.onCompilationFailed().
+ interaction.consolePrintLine('Compilation failed');
}
onDone(_) {
@@ -160,7 +149,6 @@ class CompilationProcess {
// web worker. For example, Chrome and Firefox 21.
onUrl(String url) {
objectUrls.add(url);
- clear();
String wrapper = '''
// Fool isolate_helper.dart so it does not think this is an isolate.
var window = self;
@@ -194,8 +182,6 @@ self.importScripts("$url");
// This is called in browsers that do not support creating Object
// URLs in a web worker. For example, Safari and Firefox < 21.
onCode(String code) {
- clear();
-
void retryInIframe(_) {
// The obvious thing would be to call [makeOutputFrame], but
// Safari doesn't support access to Object URLs in an iframe.
@@ -236,7 +222,7 @@ self.importScripts("$url");
void runInWorker(String url, void onError(String errorMessage)) {
worker = new Worker(url)
..onMessage.listen((MessageEvent event) {
- consolePrint(event.data);
+ interaction.consolePrintLine(event.data);
})
..onError.listen((ErrorEvent event) {
worker.terminate();
@@ -250,16 +236,12 @@ self.importScripts("$url");
String kind = diagnostic['kind'];
String message = diagnostic['message'];
if (kind == 'verbose info') {
- if (verboseCompiler) {
- consolePrint(message);
- } else {
- console.appendText('.');
- }
+ interaction.verboseCompilerMessage(message);
return;
}
String uri = diagnostic['uri'];
if (uri != '${PRIVATE_SCHEME}:/main.dart') {
- consolePrint('$uri: [$kind] $message');
+ interaction.consolePrintLine('$uri: [$kind] $message');
return;
}
int begin = diagnostic['begin'];
@@ -272,17 +254,6 @@ self.importScripts("$url");
}
onCrash(data) {
- consolePrint(data);
- }
-
- void consolePrint(message) {
- if (window.parent != window) {
- // Test support.
- // TODO(ahe): Use '/' instead of '*' when Firefox is upgraded to version
- // 30 across build bots. Support for '/' was added in version 29, and we
- // support the two most recent versions.
- window.parent.postMessage('$message\n', '*');
- }
- console.appendText('$message\n');
+ interaction.consolePrintLine(data);
}
}
« no previous file with comments | « no previous file | dart/site/try/src/interaction_manager.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698