Zachary Anderson
9ce608e89d
[dart:io] Adds ProcessInfo.{max,current}Rss. Adds OS::MaxRSS on Fuchsia.
...
R=rmacnak@google.com
Review-Url: https://codereview.chromium.org/2822943002 .
2017-04-17 14:41:40 -07:00
Zachary Anderson
8c9c54d833
[dart:io] Don't close stdin with a socket finalizer
...
If an Isolate touches the 'stdio' getter, a _NativeSocket with
attached finalizer is created for it. Previously, when such an
Isolate exited, the finalizer would close the underlying
file descriptor. This CL changes the finalizer for stdin such
that the native objects will be cleaned up, but the underlying
file descriptor will not be closed. The underlying file
descriptor will now only be closed if the stdin stream
subscription is explicitly canceled.
Accessing the stdin getter after the stream is explicitly
canceled will result in a FileSystemException.
See also: https://github.com/dart-lang/test/issues/583
fixes #29229
R=rmacnak@google.com
Review-Url: https://codereview.chromium.org/2791423002 .
2017-04-04 13:57:42 -07:00
Zachary Anderson
89dba57bcf
[dart:io] Adds a finalizer to _NativeSocket to avoid socket leaks
...
The finalizer sends the "close" message to the EventHandler for the
file descriptor in the _NativeSocket's native field. To avoid races and
spurious messages, this CL stores a pointer to a wrapper object in the
native field instead of the file descriptor. All messsages about the
_NativeSocket sent to the EventHandler use the wrapper object instead of
the file descriptor. When the EventHandler closes the file, the file
descriptor in the wrapper object is set to -1 so that the finalizer will
instead do nothing.
On Windows, there is another level of indirection since the OS HANDLEs
were already wrapped in various kinds of Handle objects. As an additional
complication, ClientSocket close on Windows is asynchronous, so the
EventHandler may shutdown before all of the ClientSocket Handles can be
destroyed.
related #27898 , #28081
R=johnmccutchan@google.com
Review-Url: https://codereview.chromium.org/2760293002 .
2017-03-28 07:44: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
Ryan Macnak
4d65db8a95
Don't use IsolateData for the exit hook as multiple embedders share the dart/bin while using different isolate data structures.
...
Issue flutter/flutter#6506
R=asiva@google.com
Review URL: https://codereview.chromium.org/2463923002 .
2016-10-31 15:56:25 -07:00
Ryan Macnak
5ee94eb837
Generate an app snapshot even if the training run does a hard exit.
...
(As the analyzer and pub do.)
R=asiva@google.com
Review URL: https://codereview.chromium.org/2426843002 .
2016-10-19 09:37:47 -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
Zachary Anderson
c75a817ee0
Fixes some memory leaks in //runtime/bin
...
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 .
2016-03-14 11:08:52 -07:00
Todd Turnidge
4e3643f445
Prefer Dart_SetReturnValue over Dart_PropagateError when it makes sense.
...
BUG=
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org/1665993002 .
2016-02-03 15:41:54 -08:00
Ivan Posva
6249c2bcf3
- Remove the legacy debug protocol.
...
BUG=
R=hausner@google.com
Review URL: https://codereview.chromium.org/1497033003 .
2015-12-03 17:46:02 -08:00
Zachary Anderson
2c5044b671
Don't do clean shutdown on Process.exit()
...
BUG=
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org/1428923003 .
2015-11-03 14:10:42 -08:00
Zachary Anderson
3563dc0fb0
Use ExitProcess on Windows.
...
Even after joining threads, it is still possible for the exit code to be
polluted. NaCL uses ExitProcess to avoid this problem:
https://code.google.com/p/chromium/codesearch#chromium/src/native_client/src/shared/platform/win/nacl_exit.c
This change also cleans up thread local storage for the last Thread.
BUG=
R=iposva@google.com
Review URL: https://codereview.chromium.org/1410293006 .
2015-10-29 23:35:46 -07:00
John McCutchan
4b4e836960
Fix build breakage encountered by Flutter
...
BUG=
Review URL: https://codereview.chromium.org//1376143004 .
2015-10-01 07:18:27 -07:00
Zachary Anderson
a580bafc5d
Disable shutdown
...
BUG=
Review URL: https://codereview.chromium.org//1350713004 .
2015-09-16 15:51:10 -07:00
Zachary Anderson
7093f2996b
VM thread shutdown.
...
BUG=
R=iposva@google.com , turnidge@google.com
Review URL: https://codereview.chromium.org//1275353005 .
2015-09-15 12:49:52 -07:00
Zachary Anderson
98384272a5
Don't stop the event handler.
...
The EventHandler can't be stopped until Dart_Cleanup shuts down all isolates and cleans up all VM thread pool threads.
TBR
BUG=
Review URL: https://codereview.chromium.org//1325963002 .
2015-09-01 20:33:38 -07:00
Zachary Anderson
9395a5b86f
Join embedder threads on Windows.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//1291163002 .
2015-09-01 17:53:03 -07:00
Zachary Anderson
d4d89d6f12
Reverts VM thread cleanup
...
BUG=
Review URL: https://codereview.chromium.org//1275853008 .
2015-08-07 19:10:31 -07:00
Zachary Anderson
55bfb3d54b
Clean VM thread shutdown:
...
Second attempt at: https://codereview.chromium.org/1177153005/
This time with fixed error propagation in the embedder.
R=turnidge@google.com
Review URL: https://codereview.chromium.org//1279733003 .
2015-08-07 18:42:00 -07:00
Zachary Anderson
4ca87e6d88
Revert VM thread cleanup
...
TBR
BUG=
Review URL: https://codereview.chromium.org//1270323002 .
2015-08-05 01:27:01 -07:00
Zachary Anderson
174d552574
Enables clean VM shutdown.
...
. Disables isolate spawning during Dart_Cleanup.
. Adds a static call Isolate::KillAllIsolates, which sends the
OOB Kill message to all isolates when called from
Dart_Cleanup.
. Modifies thread pool shutdown to block until all threads have
exited.
. Fixes tests.
BUG=
R=turnidge@google.com
Review URL: https://codereview.chromium.org//1177153005 .
2015-08-04 23:29:25 -07:00
Soren Gjesse
0415d9271d
Improve the encoding/decoding to/from system encoding on Windows
...
On Windows the dart:io SYSTEM_ENCODING is now also working with strings
which have null characters in them. Previously the string would be
terminated at the null character.
BUG=https://github.com/dart-lang/sdk/issues/23295
R=kustermann@google.com , lrn@google.com
Review URL: https://codereview.chromium.org//1194883002 .
2015-06-24 10:36:05 +02:00
sgjesse@google.com
833e5d9aee
Add support for killing a process with a given PID to dart:io
...
R=lrn@google.com , kustermann@google.com
BUG=
Review URL: https://codereview.chromium.org//895623002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43455 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-04 08:20:33 +00:00
sgjesse@google.com
9aa4805e21
Add an option for starting a detached process with stdio connected
...
R=lrn@google.com , kustermann@google.com
BUG=
Review URL: https://codereview.chromium.org//890633002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43393 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-03 13:38:38 +00:00
sgjesse@google.com
042462d69b
Refactor the process creation code on POSIX platforms
...
This moved the process creation code to a class, and splits the
single function used before into several methods operation on instance
variables.
The refactor revealed at least one leaked file descriptor.
R=kustermann@google.com
BUG=
Review URL: https://codereview.chromium.org//884143002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43280 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-29 13:06:40 +00:00
sgjesse@google.com
f6a10fbdf1
Add support for starting a detached process
...
BUG=http://dartbug.com/20970
R=kustermann@google.com , lrn@google.com
Review URL: https://codereview.chromium.org//798743004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43070 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-22 11:49:39 +00:00
iposva@google.com
5a383e7add
- Make sure that the threads for dart::bin are in the correct namespace.
...
R=asiva@google.com
Review URL: https://codereview.chromium.org//471743002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39233 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-14 00:06:04 +00:00
johnmccutchan@google.com
b3f2fb14d0
Reduce CPU usage when no isolates need to be profiled (e.g. when an isolate calls readLineSync or sleep the isolate owns the thread but is blocked).
...
This CL does the following:
- Introduces two new API entry points: Dart_IsolateBlocked and Dart_IsolateUnblocked.
- The thread interrupter thread goes into a deep sleep if no isolates need to be profiled (not scheduled on a thread or are in a blocking call).
- When an isolate unblocks, the thread interrupter thread resumes regular interrupts.
- dart:io readLineSync and sleep mark that they are making a blocking call.
This fixes https://code.google.com/p/dart/issues/detail?id=18126 reducing CPU usage to 0% when waiting for stdin or sleeping.
R=ajohnsen@google.com , iposva@google.com
Review URL: https://codereview.chromium.org//297183003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36632 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-26 11:53:49 +00:00
ajohnsen@google.com
09a4f24413
Add exitCode getter counterpart to the existing setter in dart:io.
...
BUG=https://code.google.com/p/dart/issues/detail?id=16217
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//200233002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33737 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-17 10:40:19 +00:00
ajohnsen@google.com
0f52be7f63
Make std* blocking file-descriptors.
...
This will most likely be a performance regression when piping, that
we'll have to look into in the future (copying data through
message-passing).
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//154273003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32715 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-17 10:06:35 +00:00
ajohnsen@google.com
38d0fad2c7
Signal handling, take 2.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//119093007
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31276 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-19 15:07:48 +00:00
ajohnsen@google.com
f24f568571
Revert "Signal handling."
...
This reverts commit r31270.
BUG=
Review URL: https://codereview.chromium.org//105083009
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31275 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-19 14:03:15 +00:00
ajohnsen@google.com
e8d9794c70
Signal handling.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//108003009
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31270 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-19 13:08:26 +00:00
johnmccutchan@google.com
919dc2d6eb
* Introduce ThreadInterrupter which calls a TLS set callback when thread is interrupted.
...
* Threads can only register and unregister themselves with ThreadInterrupter.
* Profiler is no longer involved in interrupting threads. It's just a callback and the buffer.
* Profiler operates lock free using an atomic operation to reserve sample in sample buffer.
* Linux, Mac, and Windows done.
R=asiva@google.com
Review URL: https://codereview.chromium.org//109803002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31170 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-16 18:52:15 +00:00
sgjesse@google.com
72d2ca28c9
Cleanup the getting and setting of the socket file descriptor
...
R=ajohnsen@google.com
Review URL: https://codereview.chromium.org//81013002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@30524 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-21 15:22:35 +00:00
ajohnsen@google.com
b71e57617e
Always mark stdout and stderr as blocking on exit.
...
This is required by some shell systems, such as Emacs.
BUG=https://code.google.com/p/dart/issues/detail?id=14301
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//59393003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29895 260f80e4-7a28-3924-810f-c04153c831b5
2013-11-05 11:57:52 +00:00
sgjesse@google.com
264611807f
Get rid of some downcasts
...
R=whesse@google.com
BUG=
Review URL: https://codereview.chromium.org//23540002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26697 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-27 09:13:21 +00:00
sgjesse@google.com
a4e6a23195
Remove bogus Dart_ExitScope calls
...
When the Dart_EnterScope/Dart_ExitScope calls where removed some
Dart_ExitScope calls in error returns where not removed.
R=whesse@google.com
BUG=
Review URL: https://codereview.chromium.org//22890003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26108 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-14 08:07:29 +00:00
sgjesse@google.com
959456533f
Add Process.runSync for running processes synchronously
...
BUG=http://dartbug.com/1707
R=whesse@google.com
Review URL: https://codereview.chromium.org//21816002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26052 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-13 14:12:31 +00:00
asiva@google.com
b4d9e0d620
Auto create ApiLocalScope before calling native functions, this ensures that
...
native functions do not have to call Dart_EnterScope/Dart_ExitScope
when they callback into the VM.
Remove Dart_EnterScope/Dart_ExitScope calls around native functions in 'bin'
directory.
R=regis@google.com , srdjan@google.com
Review URL: https://codereview.chromium.org//22303002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25827 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-06 19:27:48 +00:00
ajohnsen@google.com
900dba8e03
Remove static mutexes/monitors from dart:io.
...
BUG=
R=whesse@google.com
Review URL: https://codereview.chromium.org//18080010
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24576 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-28 08:44:15 +00:00
smok@google.com
ebbc2020a2
Put everything in runtime/bin into '::dart::bin' namespace.
...
Review URL: https://codereview.chromium.org//14341015
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22032 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-25 14:22:30 +00:00
sgjesse@google.com
cf64f0ad79
Add access to process id for both current process and processes started
...
BUG=https://code.google.com/p/dart/issues/detail?id=9129
R=ajohnsen@google.com
Review URL: https://codereview.chromium.org//14322011
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21611 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-17 10:15:29 +00:00
sgjesse@google.com
e10bc2d3e0
Reapply "Add a sleep function to dart:io"
...
This reapplies r20952, r20953, r20954 together with hiding sleep from
dart:io in a number of tests.
R=ager@google.com
Review URL: https://codereview.chromium.org//13704003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20964 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-05 13:04:26 +00:00
sgjesse@google.com
22a06ceeea
Revert r20952, r20953, r20954
...
Too many failures due to conflicting top level sleep methods.
TBR=ager@google.com
BUG=
Review URL: https://codereview.chromium.org//13565005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20955 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-05 10:06:56 +00:00
sgjesse@google.com
b81606254e
Add a sleep function to dart:io
...
The sleep function is a top-level function.
R=ager@google.com
BUG=https://code.google.com/p/dart/issues/detail?id=9254
Review URL: https://codereview.chromium.org//13641005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20952 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-05 09:35:37 +00:00
sgjesse@google.com
488b016a2f
Merge IO v2 branch to bleeding edge
...
R=ager@google.com , ajohnsen@google.com , whesse@google.com
BUG=
Review URL: https://codereview.chromium.org//12316036
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18820 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-21 11:58:11 +00:00
ager@google.com
6d0f985432
Add exitCode setter to set the exit code returned by the Dart VM
...
standalone binary on normal termination.
This is needed to be able to set the exit code without cutting
off pending asynchronous operations.
R=sgjesse@google.com ,rnystrom@google.com
BUG=
Review URL: https://codereview.chromium.org//11665004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16435 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-21 10:36:52 +00:00
ager@google.com
8a14c1c319
Use FormatMessageW for Windows error messages to handle internationalized messages correctly.
...
R=sgjesse@google.com
BUG=dartbug.com/6986
Review URL: https://codereview.chromium.org//11558012
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16041 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-12 14:39:21 +00:00