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

Side by Side Diff: utils/archive/entry.dart

Issue 11865005: Remove Futures class, move methods to Future. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
« no previous file with comments | « utils/apidoc/apidoc.dart ('k') | utils/archive/input_stream.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 entry; 5 library entry;
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 import 'archive.dart' as archive; 8 import 'archive.dart' as archive;
9 import 'entry_request.dart'; 9 import 'entry_request.dart';
10 import 'read_request.dart' as read; 10 import 'read_request.dart' as read;
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 */ 207 */
208 Future<CompleteArchiveEntry> readAll() { 208 Future<CompleteArchiveEntry> readAll() {
209 var stream = openInputStream(); 209 var stream = openInputStream();
210 var buffer = <int>[]; 210 var buffer = <int>[];
211 var completer = new Completer<List<int>>(); 211 var completer = new Completer<List<int>>();
212 212
213 stream.onData = () => buffer.addAll(stream.read()); 213 stream.onData = () => buffer.addAll(stream.read());
214 stream.onError = completer.completeError; 214 stream.onError = completer.completeError;
215 stream.onClosed = () => completer.complete(buffer); 215 stream.onClosed = () => completer.complete(buffer);
216 216
217 return Futures.wait([call(CLONE, _id), completer.future]) 217 return Future.wait([call(CLONE, _id), completer.future])
218 .then((list) => new CompleteArchiveEntry._(list[0], list[1])); 218 .then((list) => new CompleteArchiveEntry._(list[0], list[1]));
219 } 219 }
220 220
221 /** 221 /**
222 * Set a property value with index [value] on the local representation of the 222 * Set a property value with index [value] on the local representation of the
223 * archive entry and on the native representation. 223 * archive entry and on the native representation.
224 */ 224 */
225 void _set(int requestType, int index, value) { 225 void _set(int requestType, int index, value) {
226 _properties[index] = value; 226 _properties[index] = value;
227 // Since the native code processes messages in order, the SET_* messages 227 // Since the native code processes messages in order, the SET_* messages
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 class CompleteArchiveEntry extends ArchiveEntry { 328 class CompleteArchiveEntry extends ArchiveEntry {
329 /** The contents of the entry as bytes. */ 329 /** The contents of the entry as bytes. */
330 final List<int> contentBytes; 330 final List<int> contentBytes;
331 331
332 /** The contents of the entry as a string. */ 332 /** The contents of the entry as a string. */
333 String get contents => new String.fromCharCodes(contentBytes); 333 String get contents => new String.fromCharCodes(contentBytes);
334 334
335 CompleteArchiveEntry._(List properties, this.contentBytes) 335 CompleteArchiveEntry._(List properties, this.contentBytes)
336 : super.internal(properties, null); 336 : super.internal(properties, null);
337 } 337 }
OLDNEW
« no previous file with comments | « utils/apidoc/apidoc.dart ('k') | utils/archive/input_stream.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698