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

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

Issue 16125005: Make new StreamController be async by default. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/indexed_db/dartium/indexed_db_dartium.dart ('k') | sdk/lib/io/file_impl.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 part of dart.io; 5 part of dart.io;
6 6
7 class _Directory implements Directory { 7 class _Directory implements Directory {
8 static const CREATE_REQUEST = 0; 8 static const CREATE_REQUEST = 0;
9 static const DELETE_REQUEST = 1; 9 static const DELETE_REQUEST = 1;
10 static const EXISTS_REQUEST = 2; 10 static const EXISTS_REQUEST = 2;
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 const int LIST_DIRECTORY = 1; 240 const int LIST_DIRECTORY = 1;
241 const int LIST_LINK = 2; 241 const int LIST_LINK = 2;
242 const int LIST_ERROR = 3; 242 const int LIST_ERROR = 3;
243 const int LIST_DONE = 4; 243 const int LIST_DONE = 4;
244 244
245 const int RESPONSE_TYPE = 0; 245 const int RESPONSE_TYPE = 0;
246 const int RESPONSE_PATH = 1; 246 const int RESPONSE_PATH = 1;
247 const int RESPONSE_COMPLETE = 1; 247 const int RESPONSE_COMPLETE = 1;
248 const int RESPONSE_ERROR = 2; 248 const int RESPONSE_ERROR = 2;
249 249
250 var controller = new StreamController<FileSystemEntity>(); 250 var controller = new StreamController<FileSystemEntity>(sync: true);
251 251
252 List request = [ _Directory.LIST_REQUEST, path, recursive, followLinks ]; 252 List request = [ _Directory.LIST_REQUEST, path, recursive, followLinks ];
253 ReceivePort responsePort = new ReceivePort(); 253 ReceivePort responsePort = new ReceivePort();
254 // Use a separate directory service port for each listing as 254 // Use a separate directory service port for each listing as
255 // listing operations on the same directory can run in parallel. 255 // listing operations on the same directory can run in parallel.
256 _Directory._newServicePort().send(request, responsePort.toSendPort()); 256 _Directory._newServicePort().send(request, responsePort.toSendPort());
257 responsePort.receive((message, replyTo) { 257 responsePort.receive((message, replyTo) {
258 if (message is !List || message[RESPONSE_TYPE] is !int) { 258 if (message is !List || message[RESPONSE_TYPE] is !int) {
259 responsePort.close(); 259 responsePort.close();
260 controller.addError(new DirectoryIOException("Internal error")); 260 controller.addError(new DirectoryIOException("Internal error"));
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 331
332 void _ensureDirectoryService() { 332 void _ensureDirectoryService() {
333 if (_directoryService == null) { 333 if (_directoryService == null) {
334 _directoryService = _newServicePort(); 334 _directoryService = _newServicePort();
335 } 335 }
336 } 336 }
337 337
338 final String _path; 338 final String _path;
339 SendPort _directoryService; 339 SendPort _directoryService;
340 } 340 }
OLDNEW
« no previous file with comments | « sdk/lib/indexed_db/dartium/indexed_db_dartium.dart ('k') | sdk/lib/io/file_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698