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

Issue 8431028: Implement async file API on top of isolates. (Closed)

Created:
9 years, 1 month ago by Mads Ager (google)
Modified:
9 years, 1 month ago
Reviewers:
Søren Gjesse
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Implement async file API on top of isolates. This is not going to be efficient but will give us the right semantics of the operations. We should be using native async operations for this. Fixed a bug in VM implementation of List.setRange. R=sgjesse@google.com BUG= TEST= Committed: https://code.google.com/p/dart/source/detail?r=1012

Patch Set 1 #

Patch Set 2 : Line length. #

Total comments: 12

Patch Set 3 : Address comments. #

Patch Set 4 : Rebase #

Patch Set 5 : Rebase again. #

Patch Set 6 : Fix type mismatch. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+692 lines, -120 lines) Patch
M runtime/bin/builtin_in.cc View 1 chunk +3 lines, -3 lines 0 comments Download
M runtime/bin/directory_impl.dart View 1 chunk +1 line, -0 lines 0 comments Download
M runtime/bin/file.cc View 11 chunks +32 lines, -28 lines 0 comments Download
M runtime/bin/file.dart View 1 2 5 chunks +14 lines, -12 lines 0 comments Download
M runtime/bin/file_impl.dart View 1 2 3 chunks +466 lines, -76 lines 0 comments Download
M runtime/lib/array.dart View 1 2 1 chunk +1 line, -1 line 0 comments Download
M tests/corelib/corelib.status View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M tests/corelib/src/ListSetRangeTest.dart View 2 chunks +10 lines, -0 lines 0 comments Download
M tests/standalone/src/DirectoryInvalidArgumentsTest.dart View 1 chunk +4 lines, -0 lines 0 comments Download
M tests/standalone/src/FileTest.dart View 1 2 3 4 5 6 chunks +160 lines, -0 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Mads Ager (google)
9 years, 1 month ago (2011-11-01 12:19:19 UTC) #1
Søren Gjesse
lgtm http://codereview.chromium.org/8431028/diff/2001/runtime/bin/file_impl.dart File runtime/bin/file_impl.dart (right): http://codereview.chromium.org/8431028/diff/2001/runtime/bin/file_impl.dart#newcode93 runtime/bin/file_impl.dart:93: Instead of using a Map for the operations ...
9 years, 1 month ago (2011-11-01 13:22:49 UTC) #2
Mads Ager (google)
9 years, 1 month ago (2011-11-01 14:04:31 UTC) #3
http://codereview.chromium.org/8431028/diff/2001/runtime/bin/file_impl.dart
File runtime/bin/file_impl.dart (right):

http://codereview.chromium.org/8431028/diff/2001/runtime/bin/file_impl.dart#n...
runtime/bin/file_impl.dart:93: 
On 2011/11/01 13:22:49, Søren Gjesse wrote:
> Instead of using a Map for the operations one could consider using:
> 
> class FileOperation {
>   static int EXISTS = 0;
>   static int OPEN = 1;
>   ...
> 
>   abstract int get type();
>   var reply;
> }
> 
> class FileExitsOperation {
>   FileExitsOperation(String this._name);
>   int get type() => FileOperation.EXISTS
>   String get name() => _name;
>   String _name;
> }
> 
> class FileOpenOperation {
>   FileOpenOperation(String this._name);
>   int get type() => FileOperation.OPEN
>   String get name() => _name;
>   String _name;
> }
> 
> ...

Yes, that would be cleaner. I would like to do that in a separate change.

http://codereview.chromium.org/8431028/diff/2001/runtime/bin/file_impl.dart#n...
runtime/bin/file_impl.dart:155: var buffer = new List(bytes);
On 2011/11/01 13:22:49, Søren Gjesse wrote:
> Can't we just call writeByteSync in a try catch block and reply with the
> exception if any? Now we are duplicating the arguments checking.

Unfortunately not. In order to call writeByteSync we would need the file object.
I will extract read/write list parameter checking into a separate function to
share the code.

http://codereview.chromium.org/8431028/diff/2001/runtime/bin/file_impl.dart#n...
runtime/bin/file_impl.dart:312: "mixed use of synchronous and asynchronous
API");
On 2011/11/01 13:22:49, Søren Gjesse wrote:
> Uppercase M in mixed.

Thanks, done throughout the file.

http://codereview.chromium.org/8431028/diff/2001/runtime/bin/file_impl.dart#n...
runtime/bin/file_impl.dart:423: var errorHandler =
On 2011/11/01 13:22:49, Søren Gjesse wrote:
> is "var errorHandler" actually used?

Done.

http://codereview.chromium.org/8431028/diff/2001/runtime/bin/file_impl.dart#n...
runtime/bin/file_impl.dart:507: var errorHandler =
On 2011/11/01 13:22:49, Søren Gjesse wrote:
> var errorHandler used?

Done.

http://codereview.chromium.org/8431028/diff/2001/tests/standalone/src/FileTes...
File tests/standalone/src/FileTest.dart (right):

http://codereview.chromium.org/8431028/diff/2001/tests/standalone/src/FileTes...
tests/standalone/src/FileTest.dart:124: static int testReadWrite() {
On 2011/11/01 13:22:49, Søren Gjesse wrote:
> As discussed offline add an error handler to ensure that no error is
> encountered. That goes for all async tests.

Done.

Powered by Google App Engine
This is Rietveld 408576698