Commit graph

2506 commits

Author SHA1 Message Date
Zach Anderson cc10a46a1d [dart:io][windows] Set the last error when a signal is unsupported
fixes #28603

R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2779373004 .
2017-03-29 15:39:43 -07:00
Zach Anderson 141b6351ba [dart:io][windows] Use WriteFile instead of _write
This CL changes File::Write on Windows to call directly to WriteFile()
instead of using _write(). This avoids a number of complexities:
1. Don't need to bother with text vs. binary mode.
2. Don't need to check both errno and GetLastError if _write() fails.
3. Don't need to convert to a wchar_t* for console output since we've
   already set the code page to UTF8.

fixes #29101

R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2761673002 .
2017-03-29 13:19:25 -07:00
Ryan Macnak 9575657668 AOT compiler changes for dart_content_handler:
- Move some misplaced entry points from the vm list to the standalone embedder list.
 - Add missing libdart_with_precompiler to GN.
 - Add ability to reference the root library in treeshaking roots without knowing its URI (as ::).

R=zra@google.com

Review-Url: https://codereview.chromium.org/2786483002 .
2017-03-29 10:12:05 -07:00
Zachary Anderson 7c8a0a7fe1 Fix Dartium build
Review-Url: https://codereview.chromium.org/2778953005 .
2017-03-28 08:42:30 -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
P.Y. Laligand 8f03520d2b New dart CLI option to create a snapshot depfile. (#29165) 2017-03-27 06:44:21 -07:00
Ryan Macnak a42b802bcc Standalone support for AOT as dylibs on Fuchsia.
BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2774993002 .
2017-03-24 14:52:18 -07:00
Ryan Macnak 442d177d3d Make gen_snapshot quiet for the Fuchsia build.
R=zra@google.com

Review-Url: https://codereview.chromium.org/2774523002 .
2017-03-22 18:14:49 -07:00
Ryan Macnak 38da7d4858 Fix Dartium build.
Review-Url: https://codereview.chromium.org/2774533002 .
2017-03-22 18:05:54 -07:00
Ryan Macnak 2aecd5e588 Make --trace-loading great again.
R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2775463002 .
2017-03-22 17:06:42 -07:00
Zachary Anderson 6f45ea2247 [vm service] Have HTTP server retry binding for 10 seconds
This is for Fuchsia, where Flutter apps may start before the network
stack has finished initializing.

R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2772463003 .
2017-03-22 14:20:39 -07:00
Jacob Richman a129931cda The formatter struggles a bit with these files.
BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2765523003 .
2017-03-21 18:00:52 -07:00
Jacob Richman 4360e99d18 Revert "Fix observatory tests broken by running dartfmt."
This reverts commit b1f7e6d94673b098c93c187fe3efc45c15f27edc.

BUG=

Committed: 62be0eacfb
Review-Url: https://codereview.chromium.org/2767533002 .
2017-03-21 10:07:26 -07:00
Jacob Richman 62be0eacfb Revert "Fix observatory tests broken by running dartfmt."
This reverts commit b1f7e6d94673b098c93c187fe3efc45c15f27edc.

BUG=

Review-Url: https://codereview.chromium.org/2767533002 .
2017-03-20 22:19:22 -07:00
Jacob Richman 88f8aacd5f Re-apply rolled back CL to apply dartfmt to runtime.
Fix observatory tests broken by running dartfmt due to line and column changes.
Temporarily reverted formatting for evaluate_activation_test.dart as dartfmt doesn't yet handle multitests.

BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2759973004 .
2017-03-20 21:44:59 -07:00
Ryan Macnak ea4744a06f Revert "Run dartfmt on all files under runtime."
This reverts commit 15f393f189.

The change caused many service test failures due to changed line numbers.

TBR=jacobr@google.com

Review-Url: https://codereview.chromium.org/2762583003 .
2017-03-20 13:42:55 -07:00
Zach Anderson 0140775f90 [dart:io][windows] Don't enable ENABLE_VIRTUAL_TERMINAL_INPUT
fixes #29104

R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2763543003 .
2017-03-20 13:35:24 -07:00
Jacob Richman 15f393f189 Run dartfmt on all files under runtime.
I've omitted files where the formatter output is significantly uglier
than the original code and I'll send those files in a separate CL
with options for how to make the code look reasonable while still
taking advantage of the formatter.

BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2751423005 .
2017-03-20 13:13:50 -07:00
John McCutchan a4adbffb50 Remove legacy restart code
Also fixes #29092 by threading Error objects back to the message handler.

BUG=
R=asiva@google.com, rmacnak@google.com

Review-Url: https://codereview.chromium.org/2759533002 .
2017-03-20 08:47:39 -07:00
Zach Anderson 8fdab25117 [dart:io][windows] Stdout.supportsAnsiEscapes is false when not connected to a terminal
Review-Url: https://codereview.chromium.org/2760503003 .
2017-03-17 13:07:42 -07:00
Zach Anderson b3093ecee6 [dart:io] Move Platform.ansiSupported to {Stdin,Stdout}.supportsAnsiEscapes
On Windows, some Windows 10 builds support only ANSI output, but not
input, so these need to be separated.

I'm also improving the detection on Mac and Linux to avoid hardcoding
the result. Instead, supportsAnsiEscapes will be true if isatty() and
the TERM environment variable contains the string 'xterm'.

related #28614

R=lrn@google.com

Review-Url: https://codereview.chromium.org/2753233002 .
2017-03-17 12:35:36 -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
Zach Anderson 607df1c822 [dart:io][windows] Reset the console on ctrl-c
fixes #28995

R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2750833003 .
2017-03-15 10:17:53 -07:00
Zach Anderson a8bf498e56 [dart:io] Adds Platform.ansiSupported
This is so that flutter_tool can determine whether it can print
ANSI codes to the terminal on windows.

fixes #28614,#28984

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2739683005 .
2017-03-15 08:51:50 -07:00
Zachary Anderson 2388040784 [Fuchsia] vmservice creates a file in /tmp named with its port.
This is to allow the flutter_tool to quickly query a Fuchsia
device for the open vmservice ports.

R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2738373003 .
2017-03-10 14:32:38 -08:00
Zachary Anderson 7114d6cdcd [dart:io] Eagerly deallocate SSLFilter internals
related #29006

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2741063003 .
2017-03-10 10:23:48 -08:00
Zachary Anderson e73edbc5d1 [Fuchsia] Bind Observatory to ipv4 any
Also fix a command line argument for creating the test image.

R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2740203002 .
2017-03-09 12:50:41 -08:00
John McCutchan 5128636521 Support DevFS paths encoded as URIs
Fixes #28972

Note that the path handling logic in DevFS is now complicated with three
possible sources of path information. After we roll this we should clean it
up and unify on Uri encoding

BUG=
R=turnidge@google.com

Review-Url: https://codereview.chromium.org/2733413003 .
2017-03-08 15:41:11 -08:00
Zach Anderson c3577833be Fix Windows dartium build
Review-Url: https://codereview.chromium.org/2738913002 .
2017-03-08 12:15:35 -08:00
Zach Anderson 92b746cd43 [dart:io][windows] Set Console VT modes
Though, apparently this only works for Windows 10. Windows 7 doesn't support the needed VT modes.

related #28984,#28614

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2734323002 .
2017-03-08 11:02:37 -08:00
Zachary Anderson cbc9564f59 Use set_min_proto_version instead of set_min_version.
To align better with OpenSSL 1.1.0, BoringSSL is transitioning the APIs
from SSL_CTX_set_min_version to (the longer but more
upstream-compatible) SSL_CTX_set_min_proto_version.

BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2727663007 .
2017-03-06 08:49:44 -08:00
Ryan Macnak f10d354e98 Add --print-dependencies to gen_snapshot
Needed to fix https://github.com/flutter/flutter/issues/8514.

BUG=
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2730943003 .
2017-03-03 13:28:24 -08:00
Vyacheslav Egorov a5e1f89583 VM: Fix an app-jit related shutdown race.
IsolateData contains AppSnapshot which might own some HeapPage-s, so we can't
destroy IsolateData in the Dart_IsolateShutdownCallback, because some thread
running in the isolate (e.g. background compiler) might still touch
thoses pages or objects they host.

We need to delay destruction of AppSnapshot until after the isolate shutdown.

Current API does not allow that, so we introduce a new isolate lifecycle
callback - Dart_IsolateCleanupCallback, which is invoked at the end of the
isolote lifecycle when things like background compiler have been stopped
and no Dart code is supposed to run.

BUG=
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2720723005 .
2017-02-28 21:10:04 +01:00
John McCutchan 7e55c12e03 Add SILENT_OBSERVATORY environment variable to Observatory web server
BUG=
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2715423002 .
2017-02-28 07:33:33 -08:00
Ryan Macnak c4f6728027 gen_snapshot:
- Consistently accept hypens or underscores in option names.
 - Replace --snapshot_kind=none with --dependencies-only, since the former is ambiguous as to whether an existing core snapshot needs to be read. Important when using an embedder-specific dart: library.
 - Don't try to canonicalize file paths for the snapshot pieces since this fails if there isn't already a file on disk.

R=asiva@google.com, goderbauer@google.com

Review-Url: https://codereview.chromium.org/2707383007 .
2017-02-27 15:18:27 -08:00
Vyacheslav Egorov 1c7cb7c5e9 VM: remove service_object_patch.dart and all associated code.
This deletion has several reasons:

- This code is broken and refers to non-existant private parts of dart:io
(e.g. `_NativeSocket._sockets`, `_ProcessImpl._processes`, `_RandomAccessFile._files`).

- This code is not reachable through the service protocol. `_serviceObjectHandler` uses
`paths` to fetch the right handler from `_servicePathMap` but caller `ServiceGetIOHandler`
always passes empty paths.

- The only test that was attempting to test some of this code through mirrors (sic!)
has been disabled since January 2015.

After deletion all tests continue to pass meaning that nobody really relies on this
broken code in any way.

BUG=https://github.com/dart-lang/sdk/issues/28882
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2715253002 .
2017-02-27 16:08:16 +01:00
Zach Anderson c6b5c19347 [Fuchsia] Use magenta/process.h for mx_job_default, mx_vmar_root_self
Those symbols will soon be removed from magenta/syscalls.h.

BUG=
R=zra@google.com

Review-Url: https://codereview.chromium.org/2711273003 .
2017-02-24 08:00:49 -08:00
Vyacheslav Egorov f746f27870 Fix issues in dart:io implementation found by fasta.
R=kustermann@google.com
BUG=https://github.com/dart-lang/sdk/issues/28882

Review-Url: https://codereview.chromium.org/2718673002 .
2017-02-24 12:19:55 +01:00
Ryan Macnak 781fd36086 Add an option to gen_snapshot for creating a Makefile describing a snapshot's dependencies. This option may be used when generating any snapshot kind, or without generating a snapshot.
- Factor out MallocGrowableArray from vm to platform.
 - Add File::Print.

R=asiva@google.com

Review-Url: https://codereview.chromium.org/2715463003 .
2017-02-23 12:40:48 -08:00
Zachary Anderson de63e4fa94 [Fuchsia] Update to the newest spelling of launchpad calls
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2713523005 .
2017-02-22 15:41:40 -08:00
Zach Anderson 30da80fb17 [dart:io][windows] Set up CRT error handling behavior
fixes #28852

R=fschneider@google.com

Review-Url: https://codereview.chromium.org/2710103002 .
2017-02-22 13:55:07 -08:00
Zach Anderson bc07953866 [dart:io][windows] Make unicode characters display correctly.
This change has two pieces.
- Set the console code page to UTF8.
  - This makes strings printed with print() display correctly
- Set the file translation mode to _O_WTEXT when writing to a
  stdout or stderr that is connected to a console.
  - This makes strings printed with e.g. stdout.writeln()
    display correctly.

fixes #28571

R=asiva@google.com, fschneider@google.com

Review-Url: https://codereview.chromium.org/2698813002 .
2017-02-21 22:47:03 -08:00
Zachary Anderson e0e9489d4c [Fuchsia] Remove dead code
This removes a Dart configuration and a temporary test harness that
were used for Fuchsia bootstrapping, but which aren't needed anymore.

R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2708163002 .
2017-02-21 12:34:59 -08:00
Erik Corry c6a199e40b Sort class IDs before training AppJIT snapshots
R=fschneider@google.com, rmacnak@google.com
BUG=

Review-Url: https://codereview.chromium.org/2699853002 .
2017-02-20 12:14:17 +01:00
kdaker e35365588b minor typo fix in CLI usage description, snapsot -> snapshot (#28828) 2017-02-18 17:06:51 -08:00
Ryan Macnak 32220dddcf Don't write magic numbers in script snapshots from gen_snapshot
Also includes tiny doc fix.

BUG=
R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2701523007 .
2017-02-17 15:05:37 -08:00
Zach Anderson 063ae12ffc Fuchsia's message pipes are called channels for a while now
R=zra@google.com

Review-Url: https://codereview.chromium.org/2692853014 .
2017-02-17 07:43:53 -08:00
Peter von der Ahé 00bed94e0c Fix various nits in VM patch files.
R=vegorov@google.com

Review-Url: https://codereview.chromium.org/2705593002 .
2017-02-17 16:28:57 +01:00
Ryan Macnak 1392108dea Windows: VirtualFree with MEM_RELEASE wants 0 instead of the region's size.
R=zra@google.com

Review-Url: https://codereview.chromium.org/2700673004 .
2017-02-16 15:43:39 -08:00
Ryan Macnak ab212fedb3 Undo rename of LoadExtensionLibrary to LoadLibrary since mangling on Windows seems to create a conflict with LoadLibraryW.
Update use of IsolateData in Dartium's vm service.

R=zra@google.com

Review-Url: https://codereview.chromium.org/2695403003 .
2017-02-16 14:22:23 -08:00