Commit Graph

68 Commits

Author SHA1 Message Date
sgjesse@google.com 471f1c772c Add error handling to directory
The directory object now has error handling like the rest of the
dart:io. The added tests to some extend overlaps with some of the
tests in DirectpryTest.dart, but I found it better to have error tests
in a single place.

I removed a few type checks sitting in the C++ code for the native
functions as for file we currently don't have them. I have opened
issue 2305 regarding where to do type checks for dart:io native
functions.

R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5866 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-27 08:50:35 +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 c143d26700 Start using Dart_SetField and Dart_GetField in the vm.
Review URL: https://chromiumcodereview.appspot.com//9642003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5185 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-08 18:36:56 +00:00
sgjesse@google.com f0f34bf277 Add the ability to get the current directory
Added constructor current to directory. Use like this:

var cwd = Directory.current()

R=ager@google.com

BUG=dart:1793
TEST=tests/standalone/src/io/DirectoryTest.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5087 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-07 13:23:08 +00:00
sgjesse@google.com b52a27889d Use a pool of native ports for directory operations
Each directory object creates a new service port which will start a
new thread. As these service ports are currently never closed this is
a huge problem causing the standalone VM to fail when running out of
threads.

This change uses a pool of native ports for directory operations. This
still ensures that the operations for each directory object are
serialized and limits the number of native ports allocated and thus
threads started.

Even when closing of native ports is possible we might want to keep
some kind of pool like this. The reason for this is that to actually
determine when the native port is not needed any more we need a
finalizer callback on the directory object.

R=ager@google.com

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

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4795 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-01 14:29:12 +00:00
sgjesse@google.com 9390f1577a Run all directory async operations on a separate thread using native ports
R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4390 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-21 11:35:42 +00:00
ager@google.com 641cf84f6a Implement recursive directory deletion.
Additionally, make sure that the handler can be registered after
the operation in file and directory implementation:

  dir.delete();
  dir.deleteHandler = () => print('hest');

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3892 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-03 12:37:30 +00:00
sgjesse@google.com bf67f24098 Move assert.h/assert.cc from runtime/vm to runtime/platform
The purpose of this change is twofold:

1. Source in the bin directory can now use the same assertions as
   source in the vm directory. The ASSERT macro used by the code
   in runtime/bin was just defined to use assert from the standard
   C library.
2. Moving other implementation parts from runtime/vm to
   runtime/platform (e.g. classes Monitor and Mutex) for sharing
   between runtime/bin and runtime/vm will be easier as these
   implementations rely on these assertion macros.

Created two gypi files for the platform directory. One for the
headers and one for the source. The source one is only included
when building the VM library and will be present in libdart.a
when the dart executable is linked.

All the code for asserts is still in the dart namespace.

Also re-arranged the order of includes to be alphabetically in
the files touched.

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

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3335 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-16 12:28:10 +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
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
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
whesse@google.com f40da67d2b Add Directory.createTemp() to asynchronously create a temporary directory.
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1741 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-22 13:06:39 +00:00
ager@google.com 83539ca419 Add type checks to directory listing.
R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@940 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-31 09:37:07 +00:00
ager@google.com 953d2599c1 Add exists, create and delete to directory implementation on Linux and Mac.
All of the directory implementations on Linux and Mac are identical
and uncontroversial. Join the implementations in directory_posix for
now. I will split it into the two files again if it becomes necessary.

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@432 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-14 12:42:44 +00:00
ager@google.com 59135cc57b Clean up directory listing interface.
Remove open and close. A directory instance just holds a string
representing the path to the directory.

R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@362 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-12 10:39:30 +00:00
ager@google.com 023fa46e48 Finish non-recursive synchronous directory listing on Linux and Mac.
Next steps: Testing, Windows support and using isolates to make
listing async.

We should probably change the API to not tie a Directory object
to a given OS directory structure. When spawning an isolate to
perform a listing operation, that will open the directory,
list its contents and close the directory. That way we can
do multiple listing operations with the same Directory object
without having interference.

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

Review URL: https://chromereviews.googleplex.com/3511020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-05 14:33:49 +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