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

Side by Side Diff: tools/testing/dart/drt_updater.dart

Issue 10392023: Change dart:io to use Future for one-shot operations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Adding stable test binaries Created 8 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 | Annotate | Revision Log
« no previous file with comments | « tools/testing/bin/windows/dart.exe ('k') | tools/testing/dart/test_runner.dart » ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #library("drt_updater"); 5 #library("drt_updater");
6 6
7 #import("dart:io"); 7 #import("dart:io");
8 #import("dart:builtin"); 8 #import("dart:builtin");
9 9
10 class _DartiumUpdater { 10 class _DartiumUpdater {
11 String name; 11 String name;
12 String script; 12 String script;
13 String option; 13 String option;
14 14
15 bool isActive = false; 15 bool isActive = false;
16 bool updated = false; 16 bool updated = false;
17 List onUpdated; 17 List onUpdated;
18 18
19 Process _updatingProcess; 19 Process _updatingProcess;
20 20
21 _DartiumUpdater(this.name, this.script, [this.option = null]); 21 _DartiumUpdater(this.name, this.script, [this.option = null]);
22 22
23 void update() { 23 void update() {
24 if (!isActive) { 24 if (!isActive) {
25 isActive = true; 25 isActive = true;
26 print('Updating $name.'); 26 print('Updating $name.');
27 onUpdated = [() {updated = true;} ]; 27 onUpdated = [() {updated = true;} ];
28 _updatingProcess = new Process.start('python', _getUpdateCommand); 28 _updatingProcess = Process.start('python', _getUpdateCommand);
29 _updatingProcess.onExit = _onUpdatedHandler; 29 _updatingProcess.onExit = _onUpdatedHandler;
30 _updatingProcess.onError = (error) { 30 _updatingProcess.onError = (error) {
31 print("Error starting $script process: $error"); 31 print("Error starting $script process: $error");
32 _onUpdatedHandler(-1); // Continue anyway. 32 _onUpdatedHandler(-1); // Continue anyway.
33 }; 33 };
34 } 34 }
35 } 35 }
36 36
37 List<String> get _getUpdateCommand() { 37 List<String> get _getUpdateCommand() {
38 String scriptPath = new Options().script.replaceAll('\\', '/'); 38 String scriptPath = new Options().script.replaceAll('\\', '/');
(...skipping 27 matching lines...) Expand all
66 // Download the default Dartium from Google Storage. 66 // Download the default Dartium from Google Storage.
67 if (_dartiumUpdater === null) { 67 if (_dartiumUpdater === null) {
68 _dartiumUpdater = new _DartiumUpdater('Dartium Chrome', 'get_drt.py', 68 _dartiumUpdater = new _DartiumUpdater('Dartium Chrome', 'get_drt.py',
69 '--dartium'); 69 '--dartium');
70 } 70 }
71 return _dartiumUpdater; 71 return _dartiumUpdater;
72 } else { 72 } else {
73 return null; 73 return null;
74 } 74 }
75 } 75 }
OLDNEW
« no previous file with comments | « tools/testing/bin/windows/dart.exe ('k') | tools/testing/dart/test_runner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698