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

Issue 11337019: Use patching for dart:io. (Closed)

Created:
8 years, 1 month ago by Mads Ager (google)
Modified:
8 years, 1 month ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Use patching for dart:io. This allows the tools such as dartdoc to operate on dart:io in the same way as it does with other code and allows the implemenation of parts of dart:io for dart2js if we ever want to do that. The current patching is very VM specific. I have only moved stuff to patch files when they actually need to be. For Process and Socket everything has to be moved because they use native fields. For the rest, only the individual native calls have been put in patch files. R=sgjesse@google.com,ajohnsen@google.com BUG= Committed: https://code.google.com/p/dart/source/detail?r=14259

Patch Set 1 #

Total comments: 19

Patch Set 2 : Address comments #

Total comments: 13
Unified diffs Side-by-side diffs Delta from patch set Stats (+592 lines, -13037 lines) Patch
M lib/_internal/libraries.dart View 1 chunk +2 lines, -2 lines 0 comments Download
D lib/compiler/implementation/lib/io.dart View 1 chunk +0 lines, -211 lines 0 comments Download
A lib/compiler/implementation/lib/io_patch.dart View 1 chunk +180 lines, -0 lines 2 comments Download
A + lib/io/base64.dart View 1 chunk +1 line, -1 line 0 comments Download
A + lib/io/buffer_list.dart View 0 chunks +-1 lines, --1 lines 0 comments Download
A + lib/io/chunked_stream.dart View 0 chunks +-1 lines, --1 lines 0 comments Download
A + lib/io/common.dart View 1 3 chunks +12 lines, -9 lines 1 comment Download
A + lib/io/directory.dart View 0 chunks +-1 lines, --1 lines 0 comments Download
A + lib/io/directory_impl.dart View 1 7 chunks +14 lines, -15 lines 0 comments Download
A + lib/io/eventhandler.dart View 1 chunk +3 lines, -3 lines 1 comment Download
A + lib/io/file.dart View 0 chunks +-1 lines, --1 lines 0 comments Download
A + lib/io/file_impl.dart View 24 chunks +29 lines, -27 lines 1 comment Download
A + lib/io/http.dart View 2 chunks +2 lines, -2 lines 1 comment Download
A + lib/io/http_impl.dart View 9 chunks +12 lines, -17 lines 0 comments Download
A + lib/io/http_parser.dart View 0 chunks +-1 lines, --1 lines 0 comments Download
A + lib/io/http_session.dart View 1 chunk +1 line, -2 lines 0 comments Download
A + lib/io/http_utils.dart View 0 chunks +-1 lines, --1 lines 0 comments Download
A + lib/io/input_stream.dart View 0 chunks +-1 lines, --1 lines 0 comments Download
A lib/io/io.dart View 1 chunk +53 lines, -0 lines 1 comment Download
A + lib/io/iolib_sources.gypi View 2 chunks +0 lines, -9 lines 0 comments Download
A + lib/io/list_stream.dart View 0 chunks +-1 lines, --1 lines 0 comments Download
A + lib/io/list_stream_impl.dart View 0 chunks +-1 lines, --1 lines 0 comments Download
A + lib/io/mime_multipart_parser.dart View 0 chunks +-1 lines, --1 lines 0 comments Download
A + lib/io/output_stream.dart View 0 chunks +-1 lines, --1 lines 0 comments Download
A + lib/io/path.dart View 0 chunks +-1 lines, --1 lines 0 comments Download
A + lib/io/path_impl.dart View 0 chunks +-1 lines, --1 lines 0 comments Download
A + lib/io/platform.dart View 0 chunks +-1 lines, --1 lines 0 comments Download
A + lib/io/platform_impl.dart View 1 chunk +5 lines, -5 lines 0 comments Download
A + lib/io/process.dart View 1 8 chunks +19 lines, -17 lines 1 comment Download
A + lib/io/socket.dart View 2 chunks +2 lines, -4 lines 0 comments Download
A + lib/io/socket_stream_impl.dart View 1 chunk +1 line, -1 line 0 comments Download
A + lib/io/stdio.dart View 3 chunks +9 lines, -6 lines 1 comment Download
A + lib/io/stream_util.dart View 2 chunks +3 lines, -3 lines 0 comments Download
A + lib/io/string_stream.dart View 2 chunks +2 lines, -2 lines 0 comments Download
A + lib/io/timer_impl.dart View 0 chunks +-1 lines, --1 lines 0 comments Download
A + lib/io/websocket.dart View 0 chunks +-1 lines, --1 lines 0 comments Download
A + lib/io/websocket_impl.dart View 1 chunk +1 line, -0 lines 2 comments Download
D runtime/bin/base64.dart View 1 chunk +0 lines, -104 lines 0 comments Download
M runtime/bin/bin.gypi View 1 7 chunks +39 lines, -1 line 0 comments Download
D runtime/bin/buffer_list.dart View 1 chunk +0 lines, -152 lines 0 comments Download
M runtime/bin/builtin.h View 2 chunks +3 lines, -0 lines 0 comments Download
M runtime/bin/builtin.cc View 2 chunks +15 lines, -7 lines 0 comments Download
M runtime/bin/builtin_nolib.cc View 1 chunk +7 lines, -7 lines 0 comments Download
D runtime/bin/chunked_stream.dart View 1 chunk +0 lines, -138 lines 0 comments Download
D runtime/bin/common.dart View 1 chunk +0 lines, -92 lines 0 comments Download
A + runtime/bin/common_patch.dart View 1 chunk +4 lines, -5 lines 0 comments Download
M runtime/bin/dartutils.h View 1 chunk +1 line, -0 lines 0 comments Download
M runtime/bin/dartutils.cc View 1 chunk +1 line, -0 lines 0 comments Download
D runtime/bin/directory.dart View 1 chunk +0 lines, -204 lines 0 comments Download
D runtime/bin/directory_impl.dart View 1 chunk +0 lines, -294 lines 0 comments Download
A runtime/bin/directory_patch.dart View 1 chunk +16 lines, -0 lines 0 comments Download
D runtime/bin/eventhandler.dart View 1 chunk +0 lines, -27 lines 0 comments Download
A runtime/bin/eventhandler_patch.dart View 1 chunk +30 lines, -0 lines 0 comments Download
D runtime/bin/file.dart View 1 chunk +0 lines, -389 lines 0 comments Download
D runtime/bin/file_impl.dart View 1 chunk +0 lines, -1095 lines 0 comments Download
A runtime/bin/file_patch.dart View 1 chunk +37 lines, -0 lines 0 comments Download
D runtime/bin/http.dart View 1 chunk +0 lines, -1059 lines 0 comments Download
D runtime/bin/http_impl.dart View 1 chunk +0 lines, -2609 lines 0 comments Download
D runtime/bin/http_parser.dart View 1 chunk +0 lines, -733 lines 0 comments Download
A + runtime/bin/http_patch.dart View 1 chunk +3 lines, -3 lines 0 comments Download
D runtime/bin/http_session.dart View 1 chunk +0 lines, -160 lines 0 comments Download
D runtime/bin/http_utils.dart View 1 chunk +0 lines, -357 lines 0 comments Download
D runtime/bin/input_stream.dart View 1 chunk +0 lines, -251 lines 0 comments Download
M runtime/bin/io.dart View 1 chunk +4 lines, -4 lines 2 comments Download
M runtime/bin/io_sources.gypi View 1 chunk +9 lines, -40 lines 0 comments Download
D runtime/bin/list_stream.dart View 1 chunk +0 lines, -55 lines 0 comments Download
D runtime/bin/list_stream_impl.dart View 1 chunk +0 lines, -159 lines 0 comments Download
D runtime/bin/mime_multipart_parser.dart View 1 chunk +0 lines, -331 lines 0 comments Download
D runtime/bin/output_stream.dart View 1 chunk +0 lines, -101 lines 0 comments Download
D runtime/bin/path.dart View 1 chunk +0 lines, -174 lines 0 comments Download
D runtime/bin/path_impl.dart View 1 chunk +0 lines, -244 lines 0 comments Download
D runtime/bin/platform.dart View 1 chunk +0 lines, -36 lines 0 comments Download
D runtime/bin/platform_impl.dart View 1 chunk +0 lines, -57 lines 0 comments Download
A runtime/bin/platform_patch.dart View 1 chunk +13 lines, -0 lines 0 comments Download
D runtime/bin/process.dart View 1 chunk +0 lines, -227 lines 0 comments Download
D runtime/bin/process_impl.dart View 1 chunk +0 lines, -359 lines 0 comments Download
A + runtime/bin/process_patch.dart View 3 chunks +23 lines, -17 lines 0 comments Download
D runtime/bin/socket.dart View 1 chunk +0 lines, -152 lines 0 comments Download
D runtime/bin/socket_impl.dart View 1 chunk +0 lines, -582 lines 0 comments Download
A + runtime/bin/socket_patch.dart View 3 chunks +13 lines, -2 lines 0 comments Download
D runtime/bin/socket_stream_impl.dart View 1 chunk +0 lines, -230 lines 0 comments Download
D runtime/bin/stdio.dart View 1 chunk +0 lines, -76 lines 0 comments Download
A + runtime/bin/stdio_patch.dart View 1 chunk +5 lines, -3 lines 0 comments Download
D runtime/bin/stream_util.dart View 1 chunk +0 lines, -209 lines 0 comments Download
D runtime/bin/string_stream.dart View 1 chunk +0 lines, -532 lines 0 comments Download
D runtime/bin/timer_impl.dart View 1 chunk +0 lines, -200 lines 0 comments Download
D runtime/bin/websocket.dart View 1 chunk +0 lines, -303 lines 0 comments Download
D runtime/bin/websocket_impl.dart View 1 chunk +0 lines, -872 lines 0 comments Download
M tests/standalone/crypto/base64_test.dart View 1 chunk +1 line, -1 line 0 comments Download
M tests/standalone/io/http_date_test.dart View 1 chunk +9 lines, -9 lines 0 comments Download
M tests/standalone/io/http_headers_test.dart View 1 chunk +9 lines, -9 lines 0 comments Download
M tests/standalone/io/http_parser_test.dart View 1 chunk +1 line, -1 line 0 comments Download
M tests/standalone/io/mime_multipart_parser_test.dart View 1 chunk +2 lines, -2 lines 0 comments Download
M tests/standalone/io/url_encoding_test.dart View 1 chunk +9 lines, -9 lines 0 comments Download
M tests/standalone/io/web_socket_protocol_processor_test.dart View 1 chunk +2 lines, -2 lines 0 comments Download
M tools/create_sdk.py View 3 chunks +1 line, -32 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
Mads Ager (google)
This is hard to review, sorry. Overall, the changes are that most dart files from ...
8 years, 1 month ago (2012-10-30 08:58:11 UTC) #1
Søren Gjesse
LGTM! https://codereview.chromium.org/11337019/diff/1/lib/io/common.dart File lib/io/common.dart (right): https://codereview.chromium.org/11337019/diff/1/lib/io/common.dart#newcode92 lib/io/common.dart:92: external static bool _isBuiltinList(List buffer); So externals cannot ...
8 years, 1 month ago (2012-10-30 09:28:32 UTC) #2
Anders Johnsen
LGTM!!! Thank you for doing this cleanup, this is so nice! :) https://codereview.chromium.org/11337019/diff/10001/lib/compiler/implementation/lib/io_patch.dart File lib/compiler/implementation/lib/io_patch.dart ...
8 years, 1 month ago (2012-10-30 10:43:06 UTC) #3
Mads Ager (google)
8 years, 1 month ago (2012-10-30 11:12:40 UTC) #4
Thanks Anders. I agree with the comment about adding documentation to the
eventhandler. Separate patch. :)

https://codereview.chromium.org/11337019/diff/1/lib/io/common.dart
File lib/io/common.dart (right):

https://codereview.chromium.org/11337019/diff/1/lib/io/common.dart#newcode92
lib/io/common.dart:92: external static bool _isBuiltinList(List buffer);
On 2012/10/30 09:28:32, Søren Gjesse wrote:
> So externals cannot be top level functions?

At this point at least they cannot, no. I'll add a comment here as I did the
other place where I had to do this.

https://codereview.chromium.org/11337019/diff/1/lib/io/directory_impl.dart
File lib/io/directory_impl.dart (right):

https://codereview.chromium.org/11337019/diff/1/lib/io/directory_impl.dart#ne...
lib/io/directory_impl.dart:23: external static _createTemp(String template);
On 2012/10/30 09:28:32, Søren Gjesse wrote:
> Should we use void where there is no return type?

There is a return value but it can be either an OSError or a result I believe.
We could use 'dynamic' as the return type but I prefer to just leave out the
type annotation in that case.

https://codereview.chromium.org/11337019/diff/1/lib/io/directory_impl.dart#ne...
lib/io/directory_impl.dart:181: _exceptionFromResponse(response, String message)
{
On 2012/10/30 09:28:32, Søren Gjesse wrote:
> _exceptionFromResponse -> _exceptionOrErrorFromResponse ?

Done.

https://codereview.chromium.org/11337019/diff/1/lib/io/file_impl.dart
File lib/io/file_impl.dart (right):

https://codereview.chromium.org/11337019/diff/1/lib/io/file_impl.dart#newcode349
lib/io/file_impl.dart:349: // TODO(ager): The only reason for this class is that
the patching
On 2012/10/30 09:28:32, Søren Gjesse wrote:
> Answers previous comment. Then add a TODO there as well.

Done.

https://codereview.chromium.org/11337019/diff/1/lib/io/io.dart
File lib/io/io.dart (right):

https://codereview.chromium.org/11337019/diff/1/lib/io/io.dart#newcode22
lib/io/io.dart:22: #source('base64.dart');
On 2012/10/30 09:28:32, Søren Gjesse wrote:
> Shouldn't we change this to the new syntax and use part instead of #source?

Yes, but I'd like to postpone that to a separate change. This is getting massive
and we need to use part of as well.

https://codereview.chromium.org/11337019/diff/1/lib/io/process.dart
File lib/io/process.dart (right):

https://codereview.chromium.org/11337019/diff/1/lib/io/process.dart#newcode5
lib/io/process.dart:5: class _ProcessUtils {
On 2012/10/30 09:28:32, Søren Gjesse wrote:
> TODO?

Done.

https://codereview.chromium.org/11337019/diff/1/runtime/bin/bin.gypi
File runtime/bin/bin.gypi (right):

https://codereview.chromium.org/11337019/diff/1/runtime/bin/bin.gypi#newcode1
runtime/bin/bin.gypi:1: 
On 2012/10/30 09:28:32, Søren Gjesse wrote:
> Accidental edit?

Yes, thanks!

https://codereview.chromium.org/11337019/diff/1/runtime/bin/common_patch.dart
File runtime/bin/common_patch.dart (left):

https://codereview.chromium.org/11337019/diff/1/runtime/bin/common_patch.dart...
runtime/bin/common_patch.dart:5: library hi;
On 2012/10/30 09:28:32, Søren Gjesse wrote:
> Interesting OLD file :-)

I need to play with the similarity setting when using git cl upload. :-)

https://codereview.chromium.org/11337019/diff/1/tools/create_sdk.py
File tools/create_sdk.py (right):

https://codereview.chromium.org/11337019/diff/1/tools/create_sdk.py#newcode226
tools/create_sdk.py:226: for library in ['_internal', 'collection', 'core',
'coreimpl', 'crypto', 'io',
On 2012/10/30 09:28:32, Søren Gjesse wrote:
> Nice!

Yes! :)

https://codereview.chromium.org/11337019/diff/10001/lib/io/websocket_impl.dart
File lib/io/websocket_impl.dart (right):

https://codereview.chromium.org/11337019/diff/10001/lib/io/websocket_impl.dar...
lib/io/websocket_impl.dart:211: break;
On 2012/10/30 10:43:06, ajohnsen wrote:
> This looks wrong to me. If you break here, the 'hack' will not do the correct
> thing. Remove hack? Or is there a bug associated with this change?

This is the end of a switch case, so the only thing we are breaking out from is
the switch. :)

https://codereview.chromium.org/11337019/diff/10001/runtime/bin/io.dart
File runtime/bin/io.dart (right):

https://codereview.chromium.org/11337019/diff/10001/runtime/bin/io.dart#newcode9
runtime/bin/io.dart:9: #library("dart:io");
On 2012/10/30 10:43:06, ajohnsen wrote:
> Afaik, this is not how we do this. It should just be 'io'. Maybe we should
agree
> on how all 'dart:...' libraries should be defined?

I'm making this consistent with what is in the lib/foo/foo.dart files. This
makes it look right in dartdoc among other things.

Powered by Google App Engine
This is Rietveld 408576698