Commit Graph

28 Commits

Author SHA1 Message Date
ager@google.com a47410bbed Reland: Add more API fuzzing and fix the issues encountered.
Only change from original code review is the closing of files
opened in the test.

- Fixed integer checks in a couple of places.
- Added closed checks to async operations.

More changes like this coming but I'm splitting the work up to not
make the review too large.

R=sgjesse@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10414021

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7790 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-21 10:52:01 +00:00
ager@google.com 330aa1ab66 Revert "Add more API fuzzing and fix the issues encountered."
I know what is wrong but don't have the time to fix it right now.
I open a lot of files that are not closed and therefore the directory
cannot be deleted on Windows. Will fix ASAP.

R=sgjesse@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10398053

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7684 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-16 13:02:48 +00:00
ager@google.com ceb6a9b621 Add more API fuzzing and fix the issues encountered.
- Fixed integer checks in a couple of places.
- Added closed checks to async operations.

More changes like this coming but I'm splitting the work up to not
make the review too large.

R=sgjesse@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//10382194

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7683 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-16 12:52:10 +00:00
cshapiro@google.com 1472427af8 Revert "Revert "Implement {Int,Uint}{8,16,32,64} and Float{32,64} typed arrays.""
This reverts commit 63480a81fccbde001494dd535cd06a8fa02ed261.

Review URL: https://chromiumcodereview.appspot.com//10379018

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7352 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-04 23:16:09 +00:00
sgjesse@google.com 33565cd64a Change the error handling in dart:io
1. Change the argument on all onError handlers from Exception to
Dynamic

2. Throw an exception if an error ocours and there is no error handler
present for handling it.

For sockets there is the complication that an error on a socket is
reported to the socket error handler, and each of the stream error
handlers. The solution to this is to throw an exception if there was
no error handler on either the socket or one of the streams.

Fixed a number of bugs in tests revealed by errors no longer being
silently ignored.

R=ager@google.com

BUG=none
TEST=tests/standalone/src/io/*

Review URL: https://chromiumcodereview.appspot.com//10173024

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6994 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-26 08:12:17 +00:00
ager@google.com 65e9e8436c Fix typo that has crept into string input stream.
Add regression test.

R=sgjesse@google.com
BUG=dartbug.com/2322
TEST=standalone/io/StringStreamTest.dart

Review URL: https://chromiumcodereview.appspot.com//9864051

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5904 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-27 20:28:19 +00:00
sgjesse@google.com 7fa9f1fe88 Add error handling to socket streams
Change the streams onError callbacks to get an Exception argument on
all streams.

Added actual error handling to the socket streams.

As it is difficult to determine where an error should be reported I
decided to call all the registered onError callbacks, that is on the
socket itself and on both input and output stream.

Did some additional cleanup of the naming of OnError argument in some tests.

R=ager@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9812007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5717 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-21 14:40:15 +00:00
sgjesse@google.com 4491ea144d Add writeString method to OutputStream
All output streams now supports writeString which takes the encoding
to be used when transforming the string into a sequence of bytes.

This change also introduces an Encoding interface and Encodings class
as a repository for the supported encodings. Currently this is only
UTF-8, ISO-8859-1 and ASCII. All methods in dart:io which previously
used a String to represent the encoding now uses objects implementing
Encoding.

In this change dart:io is still using the internal UTF-8 encoder used
by the HTTP implementation. I will look into using the one in dart:utf
in a separate change.

R=ager@google.com

BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9653026

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5231 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-09 13:49:20 +00:00
sgjesse@google.com ac12107c2f Add method available to StringInputStream
The StringInputStream did not have any way for checking the number of
available characters. Added method available like on a binary
InputStream.

R=ager@google.com

BUG=dart:1945
TEST=tests/standalone/src/io/StringStreamTest.dart

Review URL: https://chromiumcodereview.appspot.com//9546003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5021 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-06 12:42:30 +00:00
ager@google.com b2b123d24b Update Timer API to take the callback as the last parameter.
This makes the code easier to read when the callback actually does
work:

  new Timer(1000, (t) {
    // do
    // lots
    // of
    // stuff
  });

Also, it is more consistent with the rest of the APIs.

R=sgjesse@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9597015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4945 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-05 12:43:41 +00:00
ager@google.com 242bba108b Reapply dart:io API changes.
R=sgjesse@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9568004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4790 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-01 10:07:35 +00:00
ager@google.com fd31551ca4 Revert "Rename blahHandler to onBlah throughout dart:io."
D'oh! I need to update the test binaries as well. Reverting, building
and putting back in again.

R=sgjesse@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9570004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4785 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-01 09:43:15 +00:00
ager@google.com 40e0bceab5 Rename blahHandler to onBlah throughout dart:io.
Additionally, change all single-shot methods to take their callback as an argument instead of registering it on the object.

I have attempted to find all uses in the repo but there might
be some firefighting to do when this lands.

R=sgjesse@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9500002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4784 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-01 09:36:04 +00:00
ager@google.com 103804d7f2 Make FileInputStream and FileOutputStream actually asynchronous.
Use the async API of the underlying file.

This also means that openInputStream and openOutputStream can
directly return the stream without performing IO. I'll do that
change as a follow-up.

R=sgjesse@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9474004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4662 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-28 08:38:25 +00:00
ager@google.com b1c88f1d23 Fix a couple of minor issues in IO libraries.
- Wrong type in createTempHandler callback.
- Missing implementation of errorHandler setter on StringInputStreams.

R=sgjesse@google.com
BUG=
TEST=

Review URL: https://chromiumcodereview.appspot.com//9117029

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3541 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-24 12:30:12 +00:00
ager@google.com 1aaa58f803 Make the repeating argument to timers optional.
R=sgjesse@google.com
BUG=
TEST=

Review URL: http://codereview.chromium.org//8992007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2577 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-19 12:34:12 +00:00
sgjesse@google.com 8f1b82458f Improve the event handling for string input stream
1. The string input stream now calls the data or line handler if there
   is still data available after returning from the data or line
   handler. These callbacks are scheduled on the event loop.

2. The reading of data is now throtteld so that calls to read or
   readLine will not eagerly try to read from the wrapped input
   stream. After each call to read the data handler is installed if
   no more buffered data is available. Also when the data handler
   is called the data handler on the wrapped input stream is
   un-installed if no more data is required for the current data or
   line handler.

One side effect of this change is that just reading from an input
stream obtained from a file is no longer possible. One will have to
set up a data handler callback of some kind before any calls to read
will return data. We can of cause change this to allow synchronous
usage of an input stream obtained from a file (maybe with an optional
argument to openInputStream).

Fixed a related throtteling issue with the chunked input stream.

R=ager@google.com

BUG=
TEST=

Review URL: http://codereview.chromium.org//8885032

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2310 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-09 14:08:47 +00:00
sgjesse@google.com a9fecab434 Fix performance of readLine
Using getRange to chop off the front of the list of char codes for
each line read was to slow. Use an offset into the list instead and
throw away the list when all char codes have been read.

R=ager@google.com

BUG=
TEST=

Review URL: http://codereview.chromium.org//8769039

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2023 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-02 14:38:46 +00:00
sgjesse@google.com 775438288d Add line handler to string stream
This adds the line handler to the string stream to provide callbacks
when a line is known to be available.

This change also refactors parts of the string stream to avoid
converting decoded char codes to a string before checking for line
break sequences. With this change the string decoder tracks all line
breaks.

There is still room for improvement as e.g. the coping of the list of
char codes when reading lines can be avoided by using anoher offset.

R=ager@google.com

BUG=
TEST=

Review URL: http://codereview.chromium.org//8772008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2016 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-02 11:59:02 +00:00
hausner@google.com 45fff0023d Undo some of the initializing formal change 1755
I didn't undo those initializing formas that are initializing a private field.
Review URL: http://codereview.chromium.org//8677027

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1824 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-23 23:44:14 +00:00
whesse@google.com a24a40da90 Fix excess memory usage problem in StringInputStream.
BUG=dart:555
TEST=

Review URL: http://codereview.chromium.org//8639004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1777 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-23 09:10:38 +00:00
hausner@google.com b9cf297c15 Initializing formals can't be optional parameters
Add new error message to VM compiler.
Remove all optional initializing formals from library
and tests.
Review URL: http://codereview.chromium.org//8619008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1755 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-22 19:09:54 +00:00
sgjesse@google.com 841221a47d Merge the two buffer list implementations
R=ager@google.com

BUG=
TEST=

Review URL: http://codereview.chromium.org//8506005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1342 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-09 10:52:20 +00:00
sgjesse@google.com 19bab0d5d9 Fix build
TBR=whesse@google.com

BUG=
TEST=

Review URL: http://codereview.chromium.org//8494009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1255 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-07 14:02:22 +00:00
sgjesse@google.com 77e1072eeb Change the handling of the close event in the StringInputStream
When the underlying InputStream issues a close event keep track of
when the final string data have been read from the
StringInputStream. When all string data have been read schedule a
callback of the close event.

R=whesse@google.com

BUG=
TEST=

Review URL: http://codereview.chromium.org//8477026

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1253 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-07 13:51:37 +00:00
srdjan@google.com 8d69118676 More strict non-equal cleanups in library code
Review URL: http://codereview.chromium.org//8413018

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@892 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-28 15:21:42 +00:00
srdjan@google.com 959f4b519d Use strict equality when comparing with null, especially when null is a default value.
Review URL: http://codereview.chromium.org//8400038

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@859 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-27 22:11:16 +00:00
sgjesse@google.com 00a00bcdb4 This contains a new InputStream and StringInputStream interfaces.
The readUntil is only supported through readLine on the StringInputStream.

The StringInputStream implementation in string_stream.dart could live outside the VM as it is plain Dart code.

BUG=
TEST=

Review URL: http://codereview.chromium.org//8318009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@747 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-26 13:17:28 +00:00