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

Side by Side Diff: sdk/lib/io/process.dart

Issue 13497008: Add more tests and argument check to Process.sleep (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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 | « no previous file | tests/standalone/io/sleep_test.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 part of dart.io; 5 part of dart.io;
6 6
7 // TODO(ager): The only reason for this class is that we 7 // TODO(ager): The only reason for this class is that we
8 // cannot patch a top-level at this point. 8 // cannot patch a top-level at this point.
9 class _ProcessUtils { 9 class _ProcessUtils {
10 external static _exit(int status); 10 external static _exit(int status);
(...skipping 28 matching lines...) Expand all
39 _ProcessUtils._setExitCode(status); 39 _ProcessUtils._setExitCode(status);
40 } 40 }
41 41
42 /** 42 /**
43 * Sleep for the duration specified in [duration]. 43 * Sleep for the duration specified in [duration].
44 * 44 *
45 * Use this with care, as no asynchronous operations can be processed 45 * Use this with care, as no asynchronous operations can be processed
46 * in a isolate while it is blocked in a [sleep] call. 46 * in a isolate while it is blocked in a [sleep] call.
47 */ 47 */
48 void sleep(Duration duration) { 48 void sleep(Duration duration) {
49 _ProcessUtils._sleep(duration.inMilliseconds); 49 int milliseconds = duration.inMilliseconds;
50 if (milliseconds < 0) {
51 throw new ArgumentError("sleep: duration cannot be negative");
52 }
53 _ProcessUtils._sleep(milliseconds);
50 } 54 }
51 55
52 /** 56 /**
53 * [Process] is used to start new processes using the static 57 * [Process] is used to start new processes using the static
54 * [start] and [run] methods. 58 * [start] and [run] methods.
55 */ 59 */
56 abstract class Process { 60 abstract class Process {
57 /** 61 /**
58 * Starts a process running the [executable] with the specified 62 * Starts a process running the [executable] with the specified
59 * [arguments]. Returns a [:Future<Process>:] that completes with a 63 * [arguments]. Returns a [:Future<Process>:] that completes with a
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 /** 274 /**
271 * Contains the system message for the process exception if any. 275 * Contains the system message for the process exception if any.
272 */ 276 */
273 final String message; 277 final String message;
274 278
275 /** 279 /**
276 * Contains the OS error code for the process exception if any. 280 * Contains the OS error code for the process exception if any.
277 */ 281 */
278 final int errorCode; 282 final int errorCode;
279 } 283 }
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/io/sleep_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698