Commit Graph

3601 Commits

Author SHA1 Message Date
ager@google.com d5696e2026 Change the behavior of open on files to not truncate by default
when opening for writing.

We have an explicit truncate method in the API and truncating
the file is a bit hostile to users who want to modify or append
to an existing file. :-)

R=whesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2941 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-04 12:23:01 +00:00
sgjesse@google.com 6b197bb454 Make sure to close when _BaseDataInputStream reaches the end
This will close the opened file used by a FileInputStream when the
input stream is read to the end.

Should get rid of the current Windows buildbot redness.

R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2907 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-03 12:26:48 +00:00
sgjesse@google.com 18aba0fd29 Handle reading byte past the end of file
When reading a byte past the end of file an error is now triggered.

R=ager@google.com

BUG=dart:1017

TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2906 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-03 11:16:56 +00:00
sgjesse@google.com 959977140b Refactor the file input stream
Inherit FileInputStream from _BaseDataInputStream.

R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2904 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-03 10:17:17 +00:00
sgjesse@google.com 0010d34ced Fix checked mode failure
TBR=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2895 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-02 13:10:48 +00:00
sgjesse@google.com 8055ffeb77 Add close to input stream and cleanup socket and streams
* All input streams now have a close method for just cutting
  the stream
* Removed interfaces FileInputStream and FileOutputStream
* Added exceptions to socket to avoid mixing stream and non-stream
  use of the same socket
* Added special handling of the socket connect handler callback

R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2893 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-02 13:00:59 +00:00
ager@google.com 27508f3eb1 Change the process API to be completely asynchronous.
Some of the implementation is still not asynchronous but the API is
now prepared for it.

This is a breaking change for the dart test scripts. Once the
change has its final form I will add new stable builds of the
VM to the changelist for running tests.

R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2753 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-22 13:43:43 +00:00
iposva@google.com 5b509684e3 - Fix outdated use of factory clause.
- Update error messages.
Review URL: http://codereview.chromium.org//8949043

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2707 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-21 17:26:02 +00:00
sgjesse@google.com 7014704266 Fix list output stream
The write and writeFrom where missing their boolean return value.

R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2687 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-21 08:33:02 +00:00
sgjesse@google.com 3ebb36c77f Implement list based output stream and add pipe to list based input streams
R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2641 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-20 16:03:29 +00:00
sgjesse@google.com bcd4584f59 Add input streams based on supplying data from lists
Two new streams are added ListInputStream and
DynamicListInputStream. ListInputStream takes all the data in the
stream in the constructor whereas DynamicListInputStream can get data
added dynamically using the write method and have end of stream
indicated using the method markEndOfStream.

In a separate change I expect to have the current FileInputStream be
based on the _BaseDataInputStream as it currently used the same logic
with the sync file API.

R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2621 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-20 10:07:02 +00:00
ager@google.com 47a7c9bcdb Undo change that converted exit code 255 to -1.
It seems that most systems do not perform that conversion and it
could therefore be confusing.

Simplify the crash handling in the test scripts accordingly.

R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2620 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-20 10:06:35 +00:00
ager@google.com 1a9631d322 Fix type typo. :-)
R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2618 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-20 09:38:20 +00:00
ager@google.com 46ba817562 Add asynchronous versions of the methods on Directory.
For now, use an isolate to make the operations async from the
point of view of the main Dart thread.

Clean up the directory tests a bit by removing code that didn't do anything and by removing file testing that is already covered by the file tests.

R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2617 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-20 09:28:28 +00:00
asiva@google.com bde808f44b Changes to create an application snapshot which can be layered on top
after an isolate is created and initialized.

Added an option --use_script_snapshot which creates a snapshot of the specified script in an isolate, shuts that down and restarts on a new isolate and loads the script from the snapshot buffer and executes it.
Review URL: http://codereview.chromium.org//8970004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2609 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-20 02:04:24 +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 0a3bf1c3eb Add pipe to input stream
Using the pipe method the data from an input stream can be piped
directly to an output stream.

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

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2564 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-19 09:14:19 +00:00
turnidge@google.com 0b833d4977 Add support for interrupting an isolate in the vm. Interrupts are
implemented by extending the existing support for stack overflow
checking in the vm.  When an interrupt is scheduled for an isolate, we
overwrite the isolate's stack limit with a value guaranteed to cause a
stack overflow.

We support multiple kinds of interrupts, encoded in the low bits of
the stack limit.

Add Dart_InterruptIsolate and Dart_InterruptIsolateCallback to the
dart embedding api to allow the embedder to request and handle
interrupts.

Add EXPECT_SUBSTRING(needle, haystack) testing macro.
Review URL: http://codereview.chromium.org//8851008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2529 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-16 18:41:20 +00:00
iposva@google.com 1329070b37 Fix bug 846:
- Only execute timers which were pending prior to the wakeup to
  avoid busy looping.
- Prevent double notification for timers.
Review URL: http://codereview.chromium.org//8973005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2500 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-16 01:25:47 +00:00
sgjesse@google.com 5b74b0065a Update comments for streams
R=whesse@google.com, ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2426 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-14 13:41:35 +00:00
sgjesse@google.com 9f92d783ef Change temp dir generation on Windows to use UUIDs instead of random numbers
This avoids having to generate random numbers for all platforms as
only Windows was using them. Also when the andom number generator is
deterministic the Windows implementation using random numbers could
end up running out of temporary files.

R=whesse@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2417 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-14 07:25:09 +00:00
sgjesse@google.com f2bda92a66 Add support for getting OS error information for creating temporary directories
R=whesse@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2385 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-13 14:22:50 +00:00
cshapiro@google.com aae8784962 Add an interface for retrieving the value of unsigned 64-bit integers.
With this change, IntegerValue is renamed to IntegerToInt64 for symmetry
with the new IntegerToUint64 interface.  Also uses of UInt64 have been
replaced with Uint64 for naming consistency.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2317 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-09 17:25:44 +00:00
sgjesse@google.com 8871567117 Don't treat stdin from a terminal differently from piped input
Both piped input (when using the "<" to pipe in a file) and terminal
input from stdin can set POLLIN with 0 bytes available without POLLHUP
when end of file is reached.

R=ager@google.com

BUG=dart:782
TEST=none

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2311 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-09 14:11:47 +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
ager@google.com 64ca753193 Split File into File and RandomAccessFile.
Update all users of the API.

R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2272 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-08 19:37:17 +00:00
ager@google.com 422ab9a7cf Make the write end of the interrupt pipe in the eventhandler blocking on mac and linux.
The messages written are small control messages that we do want to succeed now.

R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2246 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-08 13:44:06 +00:00
sgjesse@google.com a2b669273a Only schedule one data callback at the time for chunked input stream
R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2228 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-08 08:38:11 +00:00
hausner@google.com 9159389495 First bits of external debugger API
The debugger API is in a separate set of files. Embedders do not have
to include the debug api if they don't need to.
Review URL: http://codereview.chromium.org//8826007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2198 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-07 22:13:49 +00:00
sgjesse@google.com 3d8e19a43f Simulate data and close callbacks on a synchronous file input stream
A input stream obtained from File.openInputStream() can now be used
with code that expects data and close callbacks.

Before the input stream obtained from File.openInputStream() did not
generate any callbacks.

R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2166 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-07 08:57:31 +00:00
sgjesse@google.com 837702ee34 Fix running tests with --checked
TBR=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2164 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-07 08:34:17 +00:00
sgjesse@google.com 731e8d91af Add chunked input stream
The chunked input stream can deliver data fron an input stream as
fixed sized blocks of data.

R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2163 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-07 08:00:19 +00:00
asiva@google.com 4505063244 Restore the rule to build a no snapshot binary of dart as Srdjan feels it is still needed for debugging some corelib issues.
Review URL: http://codereview.chromium.org//8805014

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2088 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-05 21:11:00 +00:00
ager@google.com 456d63c6ab Add support for client/dartc compilation only tests.
These tests do not fit in that nicely. They have an interesting
way of finding out what are test cases. They use the .dart
suffix in the status file.

Implement directory createTempSync.

R=whesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2067 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-05 13:34:12 +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
asiva@google.com f556b81f0f Refactor the gypi files to eliminate some redundancy.
Review URL: http://codereview.chromium.org//8772016

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1999 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-01 23:04:22 +00:00
podivilov@google.com c692646f07 Introduce Dart_SetVMFlags API function.
It should be possible to set command line arguments without providing isolate init callback.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1972 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-01 11:59:35 +00:00
ager@google.com a7e26a2575 Fix HTTP sample implementation to actually wait for connections before attempting to write.
R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1971 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-01 11:44:29 +00:00
asiva@google.com b53c955b37 - Refactor the isolate callback mechanism to also include creation of the
isolate, this enables creation of isolates using a snapshot
- remove source buffers of corelib, coreimpl-lib and builtin-lib from the binary
Review URL: http://codereview.chromium.org//8673002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1958 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-01 00:30:25 +00:00
ager@google.com 3653ebdd17 Only report poll failures when it is something we cannot recover from.
R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1922 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-30 13:32:26 +00:00
sgjesse@google.com 286d5dff90 Change handling of accepting socket connections
The accept method have been removed from the ServerSocket class and
the signature for the connectionHandler callback have been changed to
provide the accepted socket as an argument.

This is to avoid the possibility for accept to return null even in the
case of pending connection. This could happen if an error like EAGAIN,
EWOULDBLOCK and EINTR was returned by it OS accept call and previously
there was no way of propagating this without returning null from the
Dart call to accept.

R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1889 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-29 12:02:01 +00:00
ager@google.com 946b015d0a Fix memory leak in MacOS process handling.
Report error for failing writes. We used to enter a poll loop
because we kept on attempting to write.

Currently the error handling in the socket interface is inconsistent.
We have a big TODO item on general error handling including the socket
interface.

R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1887 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-29 10:10:07 +00:00
iposva@google.com d2069f9ff2 - Remove the redundant dart_bin executable.
Review URL: http://codereview.chromium.org//8682031

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1828 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-24 01:03:21 +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
ager@google.com fed5e6d99c Add truncate operation to File API.
R=whesse@google.com
BUG=264
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1800 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-23 15:42:20 +00:00
sgjesse@google.com d7c8c1f1e4 Fix a number of issues with the process handling
1. Ignore the signal SIGPIPE on Linux and Mac OS

When reading from or writing to a closed pipe the signal SIGPIPE
is raised. The default handling of this is to terminate the
program. When signal SIGPIPE is ignored the read and write
returns EPIPE.

2. Wrong return type for stdio getter

3. When there is an error on a socket mark it as closed

4. Mark the pipe used for process exit status as a one way pipe

5. Add tests to test stdin, stdout and stderr in Dart scripts

R=ager@google.com

BUG=dart:536, dart:454
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1793 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-23 14:49:18 +00:00
ager@google.com 5d7ee32c6e Update test scripts to deal with current VM behavior on optional constructor arguments.
Find binaries in tests based on the platform we are running on.

R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1779 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-23 10:22:48 +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