* Switch to `std::unique_ptr<wchar_t[]>` to represent a
dynamically strings instead of wrappers like
`StringRAII` and `Utf8ToWideScope`;
* Avoid back and forth conversion between UTF8 and UTF16:
convert to UTF16 first then work on that. This also simplifies
code - previously it tried to work with strings allocated in
different ways uniformly, which is actually unnecessary if
resulting string needs to be converted to UTF16 (and allocated
with `malloc`) anyway;
* Fix a bug in `File::CreateLink`: it was handling relative
links with long paths incorrectly. Change file_long_path_test
to cover this case and make it run on non-Windows systems as
well to ensure that all behavior that can match actually
matches.
TEST=ci
Change-Id: I1279aff1d2cdace5e2ce8633c2f7ea69a34fe41a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356680
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reason for revert: Breaking API change blocks Flutter rolls. Reverting
to reconsider, work around, etc..
Revert "[ VM ] Fixed issue where backing array was deleted from an ExternalTypedData before the ExternalTypedData was used."
This reverts commit 916b9da48d.
Revert "[ VM ] Fixed tests for non-UTF8 paths on Windows / Macos."
This reverts commit 6327fe91c2.
Revert "[ VM ] Fix failing tests on Windows bots after non-UTF-8 paths change."
This reverts commit b51f4b7956.
Revert "[ VM ] Updated non-UTF-8 tests to expect exceptions on OSX/iOS."
This reverts commit bcb36247d2.
Revert "Revert "[ VM ] Updated non-UTF-8 tests to expect exceptions on OSX/iOS.""
This reverts commit 24450c79a5.
Change-Id: I756f74f4acdde168d0984fe130f05f9252366334
Reviewed-on: https://dart-review.googlesource.com/55441
Reviewed-by: Todd Volkert <tvolkert@google.com>
Commit-Queue: Zach Anderson <zra@google.com>
Reland "Fix issues with FileSystemEntities which have non-UTF8 paths causing exceptions to be thrown when converting to/from a Dart VM String."
This reverts commit 4f549e2900.
Change-Id: Ia27c8c300beb178fa7b08ffe0bfcb2d61f65bbb5
Reviewed-on: https://dart-review.googlesource.com/55271
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Fuchsia requires the ability to sandbox Isolates w.r.t. file IO.
When a new Isolate starts, Fuchsia will pass the Isolate an object
called a namespace. We can translate the namespace object into a
file descriptor suitable for passing to the *at() family of
POSIX file system calls. The file system calls will then
have visibility only into the specified namespace.
We also plumb Namespaces through on all the other platforms as well to
make the change easier to test and so that in the future we can
implement e.g. per-isolate cwds.
This change adds a new internal class to dart:io called _Namespace,
which is implemented in a patch file. See:
sdk/lib/io/namespace_impl.dart
runtime/bin/namespace_patch.dart
The embedder can set up a non-default namespace by calling
_Namespace._setupNamespace during Isolate setup.
Instances of _Namespace have a native field that holds a pointer
to a native Namespace object. See:
runtime/bin/namespace.h
Calls from e.g. file_impl.dart are now also passed a
_Namespace object. The implementations in e.g. file.cc and
file_linux.cc then extract the namespace, and use it to compute a
file descriptor and path suitable for passing to e.g. openat().
related US-313
R=asiva@google.com, rmacnak@google.com
Review-Url: https://codereview.chromium.org/3007703002 .
i.e. #ifndef VM_WHATEVER -> #ifndef RUNTIME_VM_WHATEVER
This lets us remove a hack from the PRESUBMIT.py script that existed
for reasons that are no longer valid, and sets us up to add some
presubmit checks for the GN build.
R=asiva@google.com, rmacnak@google.com
Review URL: https://codereview.chromium.org/2450713004 .
Also some style cleanups.
Decided to fix these leaks by using Dart_ScopeAllocate
instead of malloc and new. Leaks are noted in the CL.
I haven't finished looking over all the code in
//runtime/bin yet, but this CL was getting big.
Review URL: https://codereview.chromium.org/1781883002 .
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
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
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
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