Commit Graph

65 Commits

Author SHA1 Message Date
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
ager@google.com c44170ebd5 Reapply change to use system code page on Windows to fix Pub.
This time with correct null termination of the char* that
we convert.

R=sgjesse@google.com
BUG=dartbug.com/7180

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15860 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-07 20:14:37 +00:00
rnystrom@google.com cf5ab6030e Revert "By default use current code page on Windows for decoding string"
This reverts commit c247cd299958d0ee713dcfef8aaf44d230a3a7e0.

Revert "Fix memory leaks in system string patch"

This reverts commit 5e533a0c383518fc1851fbdc01a796f7d6b077f8.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15854 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-07 18:49:52 +00:00
ager@google.com 2d5c3b2101 Fix memory leaks in system string patch
R=sgjesse@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15846 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-07 13:30:17 +00:00
ager@google.com 66f08dcabf By default use current code page on Windows for decoding string
data from processes.

R=sgjesse@google.com
BUG=dartbug.com/7180

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15844 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-07 12:51:49 +00:00
ager@google.com 6236cd51a5 Use native fields for process pid and fix bug that allowed killing
a process before it was started.

We should make the change to make Process.start return a future that
does not complete unless the process is actually started. That would
have avoided this issue as well.

R=sgjesse@google.com
BUG=dartbug.com/5301

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12691 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-21 11:07:36 +00:00
ager@google.com c6aea6b1eb Use native wrapper fields to store socket ids.
This relies on landing the change to fix implicit super constructors
for subclasses of something that has native fields.

R=sgjesse@google.com
BUG=dartbug.com/5301

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12684 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-21 08:19:01 +00:00
ager@google.com 0d14ec42be Guard against integer overflow in process constructor.
I have set an arbitrary limit of around one million arguments. I
see no reasonable use of the Process API where that would be a
problem.

R=whesse@google.com,turnidge@google.com
BUG=dartbug.com/1751
TEST=None, can't happen right now but might in the future.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9583 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-12 08:35:10 +00:00
ajohnsen@google.com c54800f942 Give Process.kill an optional argument to specify which signal to send.
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8541 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-12 12:00:50 +00:00
ager@google.com 501a0dd907 Add test that passes invalid arguments to socket methods and fix
issues encountered.

The fuzzing is not as systematic as for some of the other
APIs. However, a lot of checking is going on in the Dart code so
forcing issues required a bit of work making objects act like lists
and integers.

Additionally, fix a memory leak in process implementation.

R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8088 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-30 08:17:25 +00:00