Commit Graph

52 Commits

Author SHA1 Message Date
Alexander Aprelev b4c47fd691 [ubsan] Fix parameter type mismatch ubsan for DestroyWatch callback.
Fixes https://github.com/dart-lang/sdk/issues/62365
TEST=ci

Change-Id: I70232a592c3382b1833eeffa499e713ef2cadbc2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/471342
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2026-01-12 09:41:47 -08:00
Slava Egorov c70a4b08a2 [io] Fix Mac OS X file watcher
Fixes bug in commit 25df2b3f11.

The code for converting FSEventStream notification into Dart format 
was checking file existence using relative path instead of absolute
path. This caused it to incorrectly classify rename events which
were creations as deletions.

This was not caught by testing because this was not well covered
by the test and the test closest to checking this was even 
disabled on Mac. CL updates updates the test to cover this better. 

Fixes https://github.com/dart-lang/sdk/issues/61693

TEST=standalone/io/file_system_watcher_test

Change-Id: I2a7c984dfcec0be74c974f13b6ead7d86a6a6964
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/453880
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2025-10-08 02:25:17 -07:00
Slava Egorov 25df2b3f11 [io] Rewrite Mac OS X FS watcher
Watcher used pipes to fit into the "socket"-like implementation used by
other OSes. However it turns out that pipe buffer on Mac OS X is not
necessarily large enough to fit the whole FSEvent structure meaning that
we can't expect to be able to read FSEvents atomically from a pipe.

This situation happens because Mac OS X inherits BSD behavior of
limiting total number of kernel memory reserved for pipe buffers. Once
kern.ipc.maxpipekva limit is crossed pipe buffers no longer grow to 64KB
and remain 512 bytes large (which is absolute minimum allowed by POSIX
which requires writes smaller than PIPE_BUF to be atomic).

So our code needs to be prepared that only half of FSEvent structure
(which is 1032 bytes large) will fit into pipe buffer.

We could fix this by reading each FSEvent in chunks but this seems
ridiculously ineffecient. Instead we rewrite the code to pass file
system events via SendPort instead.

Fixes https://github.com/dart-lang/sdk/issues/61551

TEST=runtime/tests/vm/dart/regress_61551_test.dart

CoreLibraryReviewExempt: VM only changes.
Change-Id: I6a6a696499044832cfb61998bc6a519bbaadf8bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/451260
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2025-10-01 11:28:05 -07:00
Slava Egorov ed6bab847b [io] Rewrite _FileSystemWatcher implementation
Existing implementation is an entangled mess which consists of shared
code residing in the base class which in random places invokes a number
of undocumented poorly named methods overloaded in OS specific
subclasses. Some of these methods mutate static state. There are no
clear lifetime guarantees for different parts of the system (including
comments saying that some values might or might not be valid at certain
points).

The rewrite aims to clean most of this up - sharing everything that can
be shared and moving OS specific logic to clearly documented methods.

Furthermore, we change the code to ensure proper lifetime guarantees -
so we no longer find ourself in situations where we don't know whether
pathId is valid or not.

This refactoring by itself fixes a number of issues, most specifically a
bug where watcher would stop receiving events on Windows because
DirectoryWatchHandle ends up allocated at precisely the same address as
a previous destroyed one - which confuses Dart side to think that newly
created handle is the same as the old one (due to a race between event
handler thread and Dart thread).

We fix Windows lifetime issue by a) not keeping pathId based mapping in
the watcher anymore and b) keeping DirectoryWatchHandler alive until it
is stoped by the Dart side - this is achieved by retaining it after it
is created and releasing it once path is unwatched. This way Dart side
is always sure that pathId values are valid until they are explicitly
released via _unwatchPath - which makes code very uniform.

To make sure that native objects created by _watchPath are released when
surrounding isolate exists abruptly (e.g. via Isolate.exit - without
letting Dart code to shutdown and call _unwatchPath naturally) we attach
NativeFinalizer to them. This fixes the existing leak of file watchers
on Mac OS X - as Node objects it created were not freed if surrounding
isolate exited. Note that inotify descriptors did not leak in the same
way because they were wrapped into sockets.

Finally, this refactoring also make sure that the last subscriber
cancelling subscription on filesystem event stream will get a proper
cancellation future back and can wait for the watcher to shutdown.
Previously implementation used broadcast streams which simply return an
already completed future when subscriber cancels. New implementation
uses Stream.multi instead which gives a better result. Now doing
watch().listen().cancel() returns a future which will only complete once
watcher is fully disposed (e.g. inotify descriptor is closed). Bad
behavior was revealed by analysing standalone/regress_52715 - which
revealed that repeatedly watching and cancelling might flakely cause us
to hit fd limit depending on whether eventhandler thread can keep up
closing file descriptors created by the main thread or not.

Fixes https://github.com/dart-lang/sdk/issues/61378

TEST=standalone/{regress_61378,file_system_watcher_isolate_exit_leak}

CoreLibraryReviewExempt: VM only changes.
Change-Id: I6a6a69642b1f2673f2be78434bc64270846ad8c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/450921
Reviewed-by: Lasse Nielsen <lrn@google.com>
2025-10-01 11:28:05 -07:00
Slava Egorov f434804f6b [io] Simplify Mac OS X FileSystemWatcher
Use a single dispach queue instead of manually managed threads with run
loops.

TEST=ci

Change-Id: I6a6a696489ebd41305027b5cef7fccb73b1f6731
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/452140
Reviewed-by: Alexander Aprelev <aam@google.com>
2025-10-01 11:28:05 -07:00
Ryan Macnak f87a265c3f [io] Fix data race in Mac file watcher.
TEST=tsan
Bug: https://github.com/dart-lang/sdk/issues/61474
Change-Id: I15596b01fab51a8e420aea1dc41868f22785c019
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/449061
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
2025-09-11 07:42:30 -07:00
Vyacheslav Egorov e105029f62 [vm] Move synchronization primitives to platform
This CL also removes ability to assign names to mutexes which was
added in c25ebfff96 but did not yield
any interesting data.

TEST=ci

CoreLibraryReviewExempt: Changes to dart:concurrent only.
Cq-Include-Trybots: luci.dart.try:vm-fuchsia-release-x64-try,vm-win-debug-x64-try,vm-win-release-x64-try,vm-aot-linux-product-x64-try
Change-Id: Id41e1d29832f6008e02f0a571ee67564e1a84224
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/375300
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-08-07 12:59:35 +00:00
Ryan Macnak b68351fbc3 [vm] Update NULL to nullptr in runtime/bin.
TEST=build
Change-Id: Ie3be570c274b0275a995a0f54b5e6ccdfc77ccd3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/292287
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Brian Quinlan <bquinlan@google.com>
2023-04-12 01:11:05 +00:00
Zach Anderson f407419d0a [vm] Reland: Prefix HOST_OS_* and TARGET_OS_* with DART_
This relands https://dart-review.googlesource.com/c/sdk/+/205633
but without renaming TARGET_OS_IPHONE to DART_TARGET_OS_IPHONE.
It also changes uses of TARGET_OS_IOS to
DART_TARGET_OS_MACOS_IOS to be consistent with the rest of the
VM.

TargetConditionals.h for XCode 13 defines several
TARGET_OS_* preprocessor symbols that confuse the
Dart build. There is probably a more targeted fix
for this, but renaming the symbols that Dart uses
will also prevent this problem if more symbols
are added to the platform headers in the future.

See: https://github.com/dart-lang/sdk/issues/46499

TEST=It builds.

Change-Id: Ie775c19dd23cfdf5f65e5ebc6ee4ec3a561676fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205860
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2021-07-02 19:06:45 +00:00
Slava Egorov 42164cc140 Revert "[vm] Prefix HOST_OS_* and TARGET_OS_* with DART_"
This reverts commit aa9201b76b.

Reason for revert: blocks G3 roll (b/192627187)

Original change's description:
> [vm] Prefix HOST_OS_* and TARGET_OS_* with DART_
>
> TargetConditionals.h for XCode 13 defines several
> TARGET_OS_* preprocessor symbols that confuse the
> Dart build. There is probably a more targeted fix
> for this, but renaming the symbols that Dart uses
> will also prevent this problem if more symbols
> are added to the platform headers in the future.
>
> See: https://github.com/dart-lang/sdk/issues/46499
>
> TEST=It builds.
> Change-Id: I3b33a03b4a9a14b76d55fe12f8cdefec4b3c3664
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205633
> Commit-Queue: Zach Anderson <zra@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>

TBR=rmacnak@google.com,zra@google.com,asiva@google.com

Change-Id: Ib06ca418c7e9d3b4df62c72c033cd39f462f7667
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205790
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2021-07-02 14:02:02 +00:00
Zach Anderson aa9201b76b [vm] Prefix HOST_OS_* and TARGET_OS_* with DART_
TargetConditionals.h for XCode 13 defines several
TARGET_OS_* preprocessor symbols that confuse the
Dart build. There is probably a more targeted fix
for this, but renaming the symbols that Dart uses
will also prevent this problem if more symbols
are added to the platform headers in the future.

See: https://github.com/dart-lang/sdk/issues/46499

TEST=It builds.
Change-Id: I3b33a03b4a9a14b76d55fe12f8cdefec4b3c3664
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205633
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-07-02 06:02:48 +00:00
Alexander Aprelev 05e5427800 [io/mac] Ensure FSEventsWatcher::Node is deleted synchronously with Callback that uses it.
This is follow-up to ed82bb6f4c

TEST=tests/standalone/io/file_system_watcher_large_set_test.dart

Change-Id: If02c922eafe1371c6e67196158896b9cb786bfd6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/202312
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2021-06-04 14:26:36 +00:00
Alexander Aprelev ed82bb6f4c [io/file_watcher] Ensure start/stop file watching requests are run on dart thread.
At present start/stop requests are scheduled on RunLoop thread.
This results in deadlocks since same RunLoop thread might be busy
with blocking writes of file watching events, not giving a chance
for Dart to read previously-written events. Reading would unblock
writer.
So this CL moves start/stop requests to run on Dart thread instead.

Fixes https://github.com/dart-lang/sdk/issues/45996

TEST=run analysis_server against flutter_gallery github-backed folder, switch between branches and ensure analyze_server remains responsive

Change-Id: I0464eeecf8e46ba3027fa0ed21cc323495d965c3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/201442
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-05-28 03:39:18 +00:00
Alexander Aprelev 8793e5aa01 Reland "[vm/io] Fix FileSystemWatcher enum name typo."
This reverts commit 34f636ce1d with the fix for the typo in patchset 2.

Change-Id: I419528f866f6edb707ca586f21a2a8c7f09323d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161620
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-09-02 20:41:32 +00:00
Alexander Markov 34f636ce1d Revert "[vm/io] Fix FileSystemWatcher enum name typo."
This reverts commit 0a036db596.

Reason for revert: build fails on android.

Original change's description:
> [vm/io] Fix FileSystemWatcher enum name typo.
> 
> Change-Id: Ie9f2e10847caf794ddc79229ce7bd35a3909896d
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161600
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
> Commit-Queue: Alexander Aprelev <aam@google.com>

TBR=aam@google.com,rmacnak@google.com

Change-Id: Ibffe96077dacd6f7f9c8b383703d77b416a0cf20
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161605
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-09-02 19:05:35 +00:00
Alexander Aprelev 0a036db596 [vm/io] Fix FileSystemWatcher enum name typo.
Change-Id: Ie9f2e10847caf794ddc79229ce7bd35a3909896d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161600
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-09-02 17:21:47 +00:00
Liam Appelbe ec599a5977 [VM] Remove retry logic from close(fd) calls
This covers Linux, Mac, Android, and Fuchsia.

Bug: https://github.com/dart-lang/sdk/issues/35954
Fixes: https://github.com/dart-lang/sdk/issues/35954
Change-Id: I8142332c530be8ad3ce46312a4a5ac750953c288
Reviewed-on: https://dart-review.googlesource.com/c/93320
Commit-Queue: Liam Appelbe <liama@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2019-02-15 23:28:17 +00:00
Ryan Macnak 0f24b9e7ae [standalone] Name dart:io threads, take 2.
Mac's pthread_setname_np assumes the current thread.

Bug: US-588
Change-Id: Ibbddd1f7bffeab10fd470a6176f68b1c0440aa99
Reviewed-on: https://dart-review.googlesource.com/c/93120
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-02-13 20:29:46 +00:00
Ryan Macnak d566a674d0 Revert "[standalone] Name dart:io threads."
This reverts commit cc3218b771.

Reason for revert: Mac build

Original change's description:
> [standalone] Name dart:io threads.
> 
> Change-Id: I5f5248366b39afab96a8b70b4f107ec5134b84f4
> Reviewed-on: https://dart-review.googlesource.com/c/92960
> Reviewed-by: Zach Anderson <zra@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

TBR=rmacnak@google.com,zra@google.com,asiva@google.com

Change-Id: I9071c955d4710f8146a661d15fa980f237b6eb81
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/93064
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-02-13 18:04:49 +00:00
Ryan Macnak cc3218b771 [standalone] Name dart:io threads.
Change-Id: I5f5248366b39afab96a8b70b4f107ec5134b84f4
Reviewed-on: https://dart-review.googlesource.com/c/92960
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2019-02-13 17:23:56 +00:00
Zach Anderson 27c79f9459 [vm] Propagate more UTF8 conversion errors
Change-Id: I8d4f3a892a51bed8b922961bd74bcad727f66508
Reviewed-on: https://dart-review.googlesource.com/73280
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2018-09-06 02:23:21 +00:00
Carlo Bernaschina 05367c3db8 Update iOS FileSystemWatcher::WatchPath signature
TBR=zra@google.com

Review-Url: https://codereview.chromium.org/3011703002 .
2017-08-31 09:46:28 -07:00
Zachary Anderson d0295c873c [dart:io] Namespaces for file IO
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 .
2017-08-30 09:34:36 -07:00
Zachary Anderson 747868f2b1 [dart:io] Remove DART_IO_DISABLED
This was only used by Dartium.

Review-Url: https://codereview.chromium.org/3009523002 .
2017-08-24 11:17:52 -07:00
Zachary Anderson 6cd8a79078 VM: Re-format to use at most one newline between functions
R=asiva@google.com

Review-Url: https://codereview.chromium.org/2974233002 .
2017-07-13 08:08:37 -07:00
Ryan Macnak 877284947b Rename TARGET_OS_* to HOST_OS_*.
Like HOST_ARCH_*, HOST_OS_* describes the OS the VM is running on, which may be different from the OS the VM is generating code for during AOT compilation.

Currently we conflate the two when emitting AOT as assembly, and we get away with it because Flutter only uses assembly for targeting iOS and one can only target iOS from a Mac, but we expect to use assembly for Android as well so native tools can unwind Dart frames.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2750843003 .
2017-03-15 13:11:05 -07:00
Zachary Anderson 479a97b129 clang-format runtime/bin
R=johnmccutchan@google.com

Review URL: https://codereview.chromium.org/2480793002 .
2016-11-04 12:30:56 -07:00
Zachary Anderson 7308e58c3f Really remove io support when dart:io is unsupported.
Previously we would compile in implementaitions of native calls for
IO functions that would never be used. This CL provides implementations
that throw a Dart exception if they're called by mistake. It also uses
a DART_IO_DISABLED preprocessor define to clean up the build files and
check that we're not including code we shouldn't.

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

Review URL: https://codereview.chromium.org/1839463002 .
2016-03-29 11:22:03 -07:00
Zachary Anderson 45661a7091 Cleanup in //runtime/bin
R=iposva@google.com

Review URL: https://codereview.chromium.org/1800863002 .
2016-03-16 10:01:00 -07:00
William Hesse e6b85bb28c Use #if TARGET_OS_IOS instead of #ifdef TARGET_OS_IOS.
New versions of the OS X SDK always define TARGET_OS_IOS, as 0 or 1.

BUG=https://github.com/dart-lang/sdk/issues/24501
BUG=https://github.com/dart-lang/sdk/issues/24453
R=iposva@google.com

Review URL: https://codereview.chromium.org/1388973002 .
2015-10-12 12:38:10 +02:00
Ivan Posva 7158d5fc26 Landing https://codereview.chromium.org/1171223003/ for Chinmay.
BUG=

Review URL: https://codereview.chromium.org//1174343006.
2015-06-13 06:36:24 -07:00
sgjesse@google.com 91e7a32eb5 Remove SetNonBlocking/SetBlocking methods from Socket and add missing close-on-exec
The methods SetNonBlocking/SetBlocking on Sockets where not implemented on Linux
and not used on Windwsm. Removed and call directly to FDUtils when needed.

In Socket::Accept setting close on exec was missing on OS X and Android.

R=kustermann@google.com
BUG=

Review URL: https://codereview.chromium.org//907883002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43627 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-10 07:29:36 +00:00
ajohnsen@google.com cdaf11dc9d Don't use kFSEventStreamCreateFlagNoDefer as it messes with event flushing.
BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//321133002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@37171 260f80e4-7a28-3924-810f-c04153c831b5
2014-06-10 10:44:20 +00:00
ajohnsen@google.com 0c157cd31e Move signal_blocker to platform and use it by default in TEMP_FAILURE_RETRY.
BUG=http://code.google.com/p/dart/issues/detail?id=16927
R=johnmccutchan@google.com, sgjesse@google.com

Review URL: https://codereview.chromium.org//165723007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33745 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-17 13:51:11 +00:00
ajohnsen@google.com 76368bfa29 Really really fix the build...
BUG=

Review URL: https://codereview.chromium.org//144283010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32598 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-12 09:28:55 +00:00
ajohnsen@google.com 9afc9cac70 Fix mac os x build.t
BUG=

Review URL: https://codereview.chromium.org//159723010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32597 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-12 09:16:30 +00:00
ajohnsen@google.com d00f632847 Use Thread::Compare instead of ==.
BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//157813011

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32596 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-12 08:47:01 +00:00
ajohnsen@google.com 9c08471e3a Remove DEBUG ifdefs.
BUG=

Review URL: https://codereview.chromium.org//152883003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32423 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-07 13:18:05 +00:00
ajohnsen@google.com d074156ac9 Move all run-loop calls into the run-loop thread, and use correct memory handling (retain/release).
BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//140183004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32421 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-07 12:49:33 +00:00
ajohnsen@google.com b88a51bd99 Fix file-watcher on mac by always starting/stopping through the run-loop thread.
This also fixes some system error-printing and maybe also early events.

BUG=https://code.google.com/p/dart/issues/detail?id=16216
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//147083015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32355 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-06 13:16:13 +00:00
ajohnsen@google.com 969eaf8068 Fix watch move event when path is a not a file.
BUG=https://code.google.com/p/dart/issues/detail?id=15458
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//110533008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31328 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-20 11:28:53 +00:00
ajohnsen@google.com abdc2ade9d Rewrite file-system-watcher to better handle the different system APIs.
BUG=http://code.google.com/p/dart/issues/detail?id=14941
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//98773002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30848 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-04 10:35:00 +00:00
ajohnsen@google.com 79cf8dc61f Don't report file-system move events on Mac OS, and use no-defer to avoid past events.
Mac OS does not have a proper way to report 'from' and 'to', thus making it impossible to reason the move direction, as other events may shuffle the order, events are received in.

BUG=https://code.google.com/p/dart/issues/detail?id=14806,https://code.google.com/p/dart/issues/detail?id=14793,https://code.google.com/p/dart/issues/detail?id=14849
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//88063002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30710 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-27 11:48:14 +00:00
ajohnsen@google.com 7f9dfb1890 Fix move-watched-dir for MacOS.
BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//46183007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29536 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-30 12:24:10 +00:00
ajohnsen@google.com 2101ba9c12 Add 'isDir' to FileSystemEvent.
BUG=https://code.google.com/p/dart/issues/detail?id=14425
R=whesse@google.com

Review URL: https://codereview.chromium.org//48613002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29371 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-28 17:14:43 +00:00
ajohnsen@google.com 483228ef66 If a move has matching target/destination, signal the event as create or delete.
BUG=https://code.google.com/p/dart/issues/detail?id=14424
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//48513003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29354 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-28 12:07:46 +00:00
ajohnsen@google.com 4894d4548c Fix issue where we would double unwatch the path.
BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//39773002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29164 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-24 10:26:00 +00:00
ajohnsen@google.com 33daee971b Use while(condition) around monitor wait, in file_system_watcher_macos.
This fixes a potential threading-issue, where the wacther could be used before it was fully initialized, if 'wait' woke up before notify.

BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//39713002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29163 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-24 10:24:08 +00:00
ajohnsen@google.com b4be8b8080 Stop watching when removing watched path, for Mac OS X as well.
BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//39683002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29161 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-24 08:42:07 +00:00
ajohnsen@google.com b8d9214b2c Be sure to enter monitor before notifying, in file_system_watcher_macos.
BUG=https://code.google.com/p/dart/issues/detail?id=13065
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//23967004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27178 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-05 08:14:48 +00:00