Commit Graph

33 Commits

Author SHA1 Message Date
nweiz@google.com 637f6fe616 Fix the definition of kIllegalPort in dart_api.h.
Declaring a variable directly in a header will cause C to be unable to link
multiple object files that both include that header, even if that variable is
const.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10135 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-01 18:47:33 +00:00
ager@google.com 52230ca22b Support posting of external data into dart as external uint8 arrays through the Dart API.
The native ports use the snapshot reader to create the dart objects. Added support for reading external arrays from snapshots but no support for writing them. The only way an external array is written to a snapshot is through the api message writer.

This allows dart:io to avoid one copy of data read from files and sockets. This change only contains one use of the new API.

R=asiva@google.com,iposva@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9281 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-02 07:22:32 +00:00
ager@google.com 379695ee2b Implement File.lastModified.
R=sgjesse@google.com,ajohnsen@google.com
BUG=dartbug/2988
TEST=standalone/io/file*

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7945 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-24 13:10:02 +00:00
ager@google.com 169e2ae549 Finish file 'fuzzer' and fix issues.
- One integer extraction issue.
- Changed to using nativeport.call().transform to make sure that exceptions during the processing of the reply are propagated to the future.

R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7843 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-22 09:52:36 +00:00
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
ager@google.com aba2e48950 Support length operation without opening file.
Use fstat instead of multiple seek calls to get length of
opened files.

R=sgjesse@google.com
BUG=dartbug.com/1592
TEST=standalone/io/File*Test

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6459 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-12 11:47:32 +00:00
asiva@google.com 333d2695ef Fix build break when compiling with gcc 4.6:
../runtime/bin/file.cc: In function 'void Builtin_File_Flush(Dart_NativeArguments)':
../runtime/bin/file.cc:356:12: error: variable 'return_value' set but not used [-Werror=unused-but-set-variable]
cc1plus: all warnings being treated as errors
Review URL: https://chromiumcodereview.appspot.com//9837102

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5923 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-28 02:32:22 +00:00
sgjesse@google.com cdc29b23f0 Add error handling to random access file
Now all both sync and async methods on File and RandomAccessFile
should have correct error handling.

Changed readByte and readByteSync to return -1 instead of
reporting an error when end of file is reached. It seems to make
the most sense.

The amount of boiler-plate code in both the native functions and
native port functions in file.cc is growing. Maybe we should
consider some refactoring, e.g. with a table of the expected
argument types for each native port functions together with known
position of the FILE* argument.

R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5812 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-26 05:54:49 +00:00
sgjesse@google.com 84836f8c56 Error reporting on File in dart:io
This implements consistent error reporting on all methods on File in dart:io. The async onError method is called with an exception argument which is the same exception as would have been thrown from the corresponding sync method.

The one method on Directory which already did this has been updated as well.

R=ager@google.com

BUG=none
TEST=tests/standalone/src/io/FileTest.dart, tests/standalone/src/io/FileInvalidArgumentsTest.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5396 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-13 13:00:47 +00:00
turnidge@google.com 48de07fb60 Start using Dart_PropagateError in the runtime/bin directory.
Review URL: https://chromiumcodereview.appspot.com//9657001

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5197 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-08 23:06:44 +00:00
sgjesse@google.com 096badbb62 Use a pool of native ports for file operations
See description on https://chromiumcodereview.appspot.com/9568010/

R=ager@google.com

BUG=none
TEST=tests/standalone/src/ManyFileOperationsTest.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4854 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-02 07:29:20 +00:00
sgjesse@google.com 5a38a88099 Port async file operations to be using native ports instead or an isolate
R=ager@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4520 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 11:11:48 +00:00
ager@google.com 7e4a36278f Implement File.directory() and File.directorySync() to get
containing directory for a file.

BUG=dart:1618
TEST=standalone/FileTest

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4464 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-22 16:18:39 +00:00
ager@google.com e2c233c750 Disallow opening of directories as files.
R=sgjesse@google.com
BUG=1614
TEST=tests/standalone/src/FileTest.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4387 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-21 07:22:20 +00:00
sgjesse@google.com b4d571dcdd Handle stdio redirection in standalone VM
The recent change to epoll on Linux and kqueue on Mac OS for getting
notifications from file descriptors caused the redirection of stdin,
stdout and stderr for the stand alone VM to stop working.

On Linux epoll failed when file descriptor 0, 1 or 2 redirected from
or to a file war registered. On Mac OS there was just no events
generated from kqueue.

The streams created for stdio, stdout and stderr is now of the correct
type and for file redirections no longer a socket object holding a
file descriptor for a regular file.

Added testing of stdio redirection using both pipes and files. These
tests are currently skipped on Windows.

Fixed handlin of short socket read when reading the process exit code.

Always close the socket port when not waiting for any events.

R=iposva@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4226 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-14 15:20:27 +00:00
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 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
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
ager@google.com eb2ed9e25f Implement delete on File objects.
R=whesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1652 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-18 12:27:56 +00:00
ager@google.com 7124c5046b Test for immutable Lists in ListSet API methods.
Using the file and socket API it was possible to modify immutable
arrays.

R=sgjesse@google.com,turnidge@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1604 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-17 06:57:39 +00:00
ager@google.com c4fb2b2f4d Implement setPosition on File to seek to a byte position.
R=sgjesse@google.com
BUG=dart:263
TEST=standalone/FileTest

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1573 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-16 15:50:55 +00:00
turnidge@google.com 8c64adf13e Deal with unhandled exceptions the same way in all Dart api functions.
--

Terminology change: invalid handles are now called error handles.

Unhandled exceptions used to be a kind of valid handle.  Now they are
a kind of error handle.

For the Dart_Invoke* functions, this means that the standard
error-checking blob drops from two tests to one test and is
harder to mess up.

Many other Dart api functions (Dart_ToString, for example) previously
dealt with unhandled exceptions by turning them into terse error
messages.  Now these functions preserve information about the
exceptions and generate better error messages.

Changed Dart_HandleMessage to return success/failure.  It seemed to fit.

--

Details:

Dart_IsValid becomes Dart_IsError (negated sense).

Dart_GetError now knows how to print a stack trace semi-nicely.

Dart_ExceptionOccurred -> Dart_IsUnhandledException.

Renamed ApiFailure class to ApiError to fit better.

ApiError now has a "data" pointer that points to either an error
message string or to an unhandled exception object.

Documentation changes aplenty.
Review URL: http://codereview.chromium.org//8501034

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1470 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-11 19:31:04 +00:00
ager@google.com 68166663f9 Renaming Array -> List in the VM API.
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1195 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-04 12:25:53 +00:00
ager@google.com 026a56f666 Implement fullPath method on File objects.
R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1134 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-03 08:28:16 +00:00
ager@google.com f74ecd22fd Implemented File create API.
R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1095 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-02 15:57:54 +00:00
ager@google.com 5b5c36e253 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=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1012 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-01 14:07:30 +00:00
ager@google.com d864b5e1f6 First round of changes to the file interface.
Have both async and sync version for the file operations. The
thinking is that once you have used an async operation you will
not be allowed to use a sync one. Only sync versions currently
implemented.

Instead of having one input and one output stream associated with a
file we create new streams whenever needed. These get their own
underlying file descriptor so they do not interfere. This means
that FileStreams have to be explicitly closed.

R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@819 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-27 13:33:18 +00:00
turnidge@google.com e756497a78 Refactor the dart api a bit:
- Dart_Result is gone.  Dart_Handle mostly replaces it.
- Name/signature changes
  - IsValidResult -> IsValid
  - GetErrorCString -> GetError
  - many more...
- Make details of persistent handle freelist private.
- Add persistent "True" handle to api state.

Things I am not doing in this changelist:

- Documentation updates
Review URL: http://codereview.chromium.org//8380020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@778 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-26 20:38:41 +00:00
ager@google.com 86284155b9 Improve error handling in the process library.
Verify that the arguments have the types expected by the
implementation. Require a List instance containing builtin
Strings as the arguments. Require a builtin String path.

R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@690 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-25 12:16:04 +00:00
dgrove@google.com 4c0f559d23 Initial checkin.
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-05 05:20:07 +00:00