Commit graph

112 commits

Author SHA1 Message Date
sgjesse@google.com 218e366f89 Add support for file locking
This adds support for file locking in dart:io.

BUG=http://dartbug.com/17045
R=kustermann@google.com, lrn@google.com

Review URL: https://codereview.chromium.org//833623004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42733 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-09 13:06:37 +00:00
lrn@google.com 6ae29ec58e Create generic check methods for RangeError causing checks.
Use them where appropriate in core libraries.

There are many more possible uses in vm- and dart2js-libraries.

R=sgjesse@google.com

Review URL: https://codereview.chromium.org//745573002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41893 260f80e4-7a28-3924-810f-c04153c831b5
2014-11-21 10:29:15 +00:00
sgjesse@google.com 65e1149f8c Make stdout/stderr async
This makes stdout.write and stderr.write async.

This effectively reverts https://code.google.com/p/dart/source/detail?r=33645

Reapplies r41350 after the dart2js batch-runner have been changed to handle
async stdout/stderr.

R=ricow@google.com
BUG=

Review URL: https://codereview.chromium.org//693793002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41436 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-31 12:11:53 +00:00
sgjesse@google.com b6d16215aa Revert "Make stdout/stderr async"
This reverts r41350.

There are test-failures that needs to be analyzed.

TBR=iposva@google.com, ajohnsen@google.com
BUG=

Review URL: https://codereview.chromium.org//686703002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41353 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-28 09:07:56 +00:00
sgjesse@google.com c50df5e563 Make stdout/stderr async
This makes stdout.write and stderr.write async.

This effectively reverts https://code.google.com/p/dart/source/detail?r=33645

R=iposva@google.com, ajohnsen@google.com
BUG=

Review URL: https://codereview.chromium.org//673193002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41350 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-28 08:53:10 +00:00
ajohnsen@google.com 8b612e8780 Add read/write stats to Socket and RandomAccessFile.
BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//298353002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36738 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-28 13:29:51 +00:00
ajohnsen@google.com 7aed60d005 Show actualy FD for files in Observatory.
BUG=
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org//296403005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36656 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-27 09:18:43 +00:00
johnmccutchan@google.com 19efb28eab Add initial Random Access File information to Observatory
BUG=
R=ajohnsen@google.com

Review URL: https://codereview.chromium.org//291343009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36638 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-26 15:34:31 +00:00
ajohnsen@google.com a8fa03ffbc Clean up readAsLines*.
BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//251583004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@35416 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-25 06:47:26 +00:00
ajohnsen@google.com 50b3d74964 Fix File:openRead and file_input_stream_test.
BUG=
R=ricow@google.com

Review URL: https://codereview.chromium.org//233193004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34929 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-10 15:49:18 +00:00
ajohnsen@google.com 26ee288501 Fix leaking FD from readAs*Sync and writeAs*Sync.
If open was succesfull but the following read/write failed, we would
fail to close the file. We now intercept the error (as we correctly do
in the async case) and close the file before throwing the error to the
user.

BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//230513002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34868 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-09 10:38:32 +00:00
ajohnsen@google.com 402774f9a0 Make File:openRead always have one outstanding read, when invoking callbacks.
This sligly improves latency for reading. Note that pause/resume is less
precise now, but it was never a guarantee exactly _when_ pausing would
take place.

BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//228093003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34814 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-08 08:58:13 +00:00
ajohnsen@google.com 364bd9eeea Don't call read, if last read returned less bytes than was being read.
This speeds up File.openRead, especially for small files.

BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//227733002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34813 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-08 08:47:51 +00:00
ajohnsen@google.com 1eac45f992 Clean up file writing.
BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//219243008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34639 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-02 08:21:55 +00:00
ajohnsen@google.com 45d35b1588 Make non-copying version of BytesBuidler and make file-reads faster.
The non-copying version is internally, as this is always the behaviour
we want, when receiving data from the system.

File-reads are also further improved, by only reading data in chunks, if
initial length is 0. This is a special case where the file can be a
character device. Overall improvement is around a factor of 6.

BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//218493012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@34589 260f80e4-7a28-3924-810f-c04153c831b5
2014-04-01 10:56:19 +00:00
ajohnsen@google.com a08b282ee8 Use a sync-writing StreamConsumer for stdout/stderr.
This makes stdout.write and stderr.write block, until the write is done.

BUG=https://code.google.com/p/dart/issues/detail?id=17020
R=whesse@google.com

Review URL: https://codereview.chromium.org//195893012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33645 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-13 11:20:34 +00:00
ajohnsen@google.com 0f52be7f63 Make std* blocking file-descriptors.
This will most likely be a performance regression when piping, that
we'll have to look into in the future (copying data through
    message-passing).

BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//154273003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32715 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-17 10:06:35 +00:00
lrn@google.com a6d4c0b996 Code cleanup (mostly io lib and some http lib).
- Unused function removed,
- Make properties always appear before methods,
- Use dart idioms where possible.

BUG=
R=ajohnsen@google.com

Review URL: https://codereview.chromium.org//124753002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31602 260f80e4-7a28-3924-810f-c04153c831b5
2014-01-08 12:03:11 +00:00
ajohnsen@google.com fe6b63d5e4 Add File.copy(Sync) to dart:io.
BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//105133004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31125 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-13 12:04:24 +00:00
johnniwinther@google.com 8541952510 Implement least upper bound.
As a side-effect disallow multiple inheritance with different type arguments.

R=karlklose@google.com

Review URL: https://codereview.chromium.org//52263003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30661 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-26 08:32:08 +00:00
sgjesse@google.com 0aa1345b12 Add optional flush argument to some file methods
BUG=http://dartbug.com/8794

R=whesse@google.com, ajohnsen@google.com

Review URL: https://codereview.chromium.org//20745006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29880 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-05 08:46:50 +00:00
whesse@google.com 1e3b58ade0 dart:io | Add 'recursive' flag to File.create and Link.create.
BUG=dartbug.com/12462
R=ajohnsen@google.com

Review URL: https://codereview.chromium.org//52363002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29563 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-30 16:31:53 +00:00
ajohnsen@google.com 253ad80d88 Don't close the _FileStream until all operations are done.
BUG=

Review URL: https://codereview.chromium.org//48113028

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29541 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-30 13:15:32 +00:00
ajohnsen@google.com 7338c0c409 Fix File.openStream where it sometimes would keep the file open.
BUG=

Review URL: https://codereview.chromium.org//46073003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29539 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-30 12:38:00 +00:00
lrn@google.com f0a1c922a2 Reapply "Remove @deprecated features."
R=scheglov@google.com, sgjesse@google.com

Review URL: https://codereview.chromium.org//50413005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29535 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-30 12:09:15 +00:00
ajohnsen@google.com 09e82e02be Let the stream of File:openRead handle cancel correctly.
BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//51883004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29534 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-30 11:44:06 +00:00
ajohnsen@google.com 103eac574c Remove FileException, DirectoryException and LinkException from dart:io and use FileSystemException instaed.
BUG=https://code.google.com/p/dart/issues/detail?id=12461
R=nweiz@google.com, sgjesse@google.com

Review URL: https://codereview.chromium.org//26968003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29168 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-24 12:17:20 +00:00
whesse@google.com bfc3d53dc6 dart:io | Add FileSystemEntity.parent, make File.directory call it.
BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//26001002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28986 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-22 07:32:06 +00:00
floitsch@google.com 4be547c705 Adapt streams for additional stackTrace argument.
R=lrn@google.com

Review URL: https://codereview.chromium.org//25094002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28511 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-11 12:02:20 +00:00
ajohnsen@google.com 8323221e70 Only allow one async operation on RandomAccessFile at a time.
This is to make sure we never have a race-condition on the same
File*/FD. For a File it should be fine, as each operation will open it's
own FD to work on.

BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//24721003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@28088 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-01 11:23:32 +00:00
ajohnsen@google.com 7e75589a5d Fix File stream on cancel.
Before we could end up having both an issued read and a close request.
Given the new nature of our io-service, this could lead to a race
condition between the two.

BUG=https://code.google.com/p/dart/issues/detail?id=12982
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//24667003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27955 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-26 14:34:15 +00:00
ajohnsen@google.com 3e0a59b920 Clean up IOService implementation to be shared between patched and non-patched code.
BUG=

Review URL: https://codereview.chromium.org//24596003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27888 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-25 15:53:54 +00:00
ajohnsen@google.com a347038cd7 Merge services into a shared IOService in dart:io, and use a native port.
BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//24395013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27883 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-25 15:03:24 +00:00
whesse@google.com 4fc5c84809 Recommit add FileSystemEntity.resolveSymbolicLinks
This was reverted in r27481 because of a failure on the debug Windows VM buildbot.

BUG=dartbug.com/1016

Review URL: https://codereview.chromium.org//23480093

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27612 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-18 12:29:47 +00:00
whesse@google.com 31c85401eb Revert "dart:io | Change File.fullPath to FileSystemEntity.resolveSymbolicLinks."
This reverts commit r27475.

BUG=dartbug.com/1016

Review URL: https://codereview.chromium.org//23658048

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27481 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-13 15:00:26 +00:00
whesse@google.com f9ba5f494d dart:io | Change File.fullPath to FileSystemEntity.resolveSymbolicLinks.
BUG=dartbug.com/1016
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//23444037

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27475 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-13 11:15:12 +00:00
whesse@google.com ca27ddeafe Add FileSystemEntity.absolutePath and .isAbsolute properties.
BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//23468027

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27467 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-13 08:56:16 +00:00
ajohnsen@google.com b57176ef54 Throw FileExceptions when in File when reading as String and decoding fails.
BUG=https://code.google.com/p/dart/issues/detail?id=13199
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//23953004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27329 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-10 11:14:31 +00:00
ajohnsen@google.com 47239cb3a2 Move delete/deleteSync up to FileSystemEntity, with a shared documentation.
This also means that FileSystemEntity.delete(recursive: true) now will
delete any object on disk, much like 'rm -r', without the need of
wrapping it in a Directory object.

BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//23889008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27196 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-05 14:54:38 +00:00
ajohnsen@google.com 38bae0af02 Add FileSystemWatcher class to dart:io.
BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//19263003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27048 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-03 12:43:08 +00:00
floitsch@google.com 35d7140e66 Remove Encoding-enum from dart:io and add interface in dart:convert.
BUG= http://dartbug.com/6284
BUG= http://dartbug.com/7966
R=nweiz@google.com, sgjesse@google.com

Review URL: https://codereview.chromium.org//22872012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26632 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-26 10:37:25 +00:00
sgjesse@google.com 38506f9d57 Remove the LineTransformer from dart:io
The LineTransformer has been retired, and is replaced with LineSplitter from dart:convert

R=floitsch@google.com, nweiz@google.com

Review URL: https://codereview.chromium.org//22927016

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26419 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-21 07:35:46 +00:00
sgjesse@google.com 353428a918 Remove the Path class from dart:io
The Path class in dart:io has been deprecated for some time
now. It was scheduled to be removed on August 11th, so here it
goes.

dart:io still uses the Path class internally, but now it is
private. I will trim it down to what is actually used in a
follow-up change.

R=ahe@google.com, devoncarew@google.com, whesse@google.com
BUG=http://dartbug.com/11666

Review URL: https://codereview.chromium.org//23054008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26181 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-15 10:10:53 +00:00
whesse@google.com 48cf6c5ebd Fix some analyzer warnings in dart:io.
BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//22893005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26051 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-13 14:11:33 +00:00
sgjesse@google.com f01310ef85 Add argument check to Directory and Link constructors
These matches the argument check in the File constructor.

Minor refactoring of final fields in File and Directory implementations.

BUG=http://dartbug.com/11976

R=whesse@google.com

Review URL: https://codereview.chromium.org//21520002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25705 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-01 11:32:19 +00:00
ajohnsen@google.com f7d1f50329 Remove _BufferList from dart:io and now use BytesBuilder.
BUG=
R=whesse@google.com

Review URL: https://codereview.chromium.org//18031023

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24941 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-12 10:39:02 +00:00
asiva@google.com 1e0c98714b Make writes consistent across socket and file synchronous/asynchronus writes in terms of truncation semantics (reports an argument error if the list element contains a non byte value).
Remove Common_IsBuiltinList as it is not used anymore

Change synchronous file writes to use Dart_TypedDataAcquireData and
Dart_TypedDataReleaseData since the buffer object is always a Uint8List
instead of the more expensive Dart_ListGetAsBytes.

R=ajohnsen@google.com, iposva@google.com

Review URL: https://codereview.chromium.org//18115002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24620 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-29 18:19:33 +00:00
ajohnsen@google.com f6b8d89968 Add FileException.path and clean up file exceptions.
Now correctly throw ArgumentError and not delayed FileExceptions in case
of invalid arguments.

BUG=https://code.google.com/p/dart/issues/detail?id=3075

Review URL: https://codereview.chromium.org//18090003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24523 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-27 16:42:32 +00:00
sgjesse@google.com 78e9b8ef87 dart:io | Add rename to Link
R=whesse@google.com
BUG=

Review URL: https://codereview.chromium.org//17848003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24468 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-26 14:09:29 +00:00
sgjesse@google.com 7ce40aa3a0 dart:io | Add File.rename
R=ajohnsen@google.com
BUG=

Committed: https://code.google.com/p/dart/source/detail?r=24029

Review URL: https://codereview.chromium.org//17033003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24030 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-14 13:34:54 +00:00