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

Side by Side Diff: pkg/scheduled_test/lib/src/descriptor/async.dart

Issue 12853005: Change the way Patterns work in scheduled_test/descriptor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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) 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 library descriptor.async; 5 library descriptor.async;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io' as io; 8 import 'dart:io' as io;
9 9
10 import '../../descriptor.dart' as descriptor; 10 import '../../descriptor.dart' as descriptor;
11 import '../../scheduled_test.dart'; 11 import '../../scheduled_test.dart';
12 import '../utils.dart'; 12 import '../utils.dart';
13 import 'utils.dart';
14 13
15 /// A descriptor that wraps a [Future<Entry>] and forwards all asynchronous 14 /// A descriptor that wraps a [Future<Entry>] and forwards all asynchronous
16 /// operations to the result of the future. It's designed for use when the 15 /// operations to the result of the future. It's designed for use when the
17 /// full filesystem description isn't known when initializing the schedule. 16 /// full filesystem description isn't known when initializing the schedule.
18 /// 17 ///
19 /// Async descriptors don't support [load], since their names aren't 18 /// Async descriptors don't support [load], since their names aren't
20 /// synchronously available. 19 /// synchronously available.
21 class Async extends descriptor.Entry { 20 class Async extends descriptor.Entry {
22 /// The [Future] that will complete to the [Entry] this descriptor is 21 /// The [Future] that will complete to the [Entry] this descriptor is
23 /// wrapping. 22 /// wrapping.
24 final Future<descriptor.Entry> future; 23 final Future<descriptor.Entry> future;
25 24
26 Async(this.future) 25 Async(this.future)
27 : super('<async descriptor>'); 26 : super('<async descriptor>');
28 27
29 Future create([String parent]) => 28 Future create([String parent]) =>
30 schedule(() => future.then((entry) => entry.create(parent))); 29 schedule(() => future.then((entry) => entry.create(parent)));
31 30
32 Future validate([String parent]) => 31 Future validate([String parent]) => schedule(() => validateNow(parent));
33 schedule(() => future.then((entry) => entry.validate(parent))); 32
33 Future validateNow([String parent]) =>
34 future.then((entry) => entry.validateNow(parent));
34 35
35 Stream<List<int>> load(String path) => errorStream("Async descriptors don't " 36 Stream<List<int>> load(String path) => errorStream("Async descriptors don't "
36 "support load()."); 37 "support load().");
37 38
38 Stream<List<int>> read() => errorStream("Async descriptors don't support " 39 Stream<List<int>> read() => errorStream("Async descriptors don't support "
39 "read()."); 40 "read().");
40 41
41 String describe() => "async descriptor"; 42 String describe() => "async descriptor";
42 } 43 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698