Commit Graph

3172 Commits

Author SHA1 Message Date
iposva@google.com 92cddd5ba8 - The dart:io library uses Uri from dart:uri.
- Fix the library tag handler to proper import libraries
  when generating snapshots.
Review URL: https://chromiumcodereview.appspot.com//9655015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5238 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-09 16:45:57 +00:00
whesse@google.com 3c6d3843fc Add native extensions for the Dart shell to the Windows platform and the Mac OS X platform.
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5235 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-09 14:34:57 +00:00
sgjesse@google.com 4f1ac7c8c6 Prevent creation of additional FileMode and Encoding objects
R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5234 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-09 14:02:58 +00:00
sgjesse@google.com 4491ea144d Add writeString method to OutputStream
All output streams now supports writeString which takes the encoding
to be used when transforming the string into a sequence of bytes.

This change also introduces an Encoding interface and Encodings class
as a repository for the supported encodings. Currently this is only
UTF-8, ISO-8859-1 and ASCII. All methods in dart:io which previously
used a String to represent the encoding now uses objects implementing
Encoding.

In this change dart:io is still using the internal UTF-8 encoder used
by the HTTP implementation. I will look into using the one in dart:utf
in a separate change.

R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5231 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-09 13:49:20 +00:00
turnidge@google.com 99edc5e69c Spot fix for linux-only source file. Cross fingers.
Review URL: https://chromiumcodereview.appspot.com//9651010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5198 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-08 23:10:24 +00:00
turnidge@google.com 48de07fb60 Start using Dart_PropagateError in the runtime/bin directory.
Review URL: https://chromiumcodereview.appspot.com//9657001

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5197 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-08 23:06:44 +00:00
iposva@google.com 8e5891cb96 - Fix the dart_no_snapshot binary.
Review URL: https://chromiumcodereview.appspot.com//9639018

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5195 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-08 22:25:29 +00:00
turnidge@google.com c143d26700 Start using Dart_SetField and Dart_GetField in the vm.
Review URL: https://chromiumcodereview.appspot.com//9642003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5185 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-08 18:36:56 +00:00
dgrove@google.com 98302c85df Unify most of our utf8 implementations. This takes the implementation
from utils/string_encoding and moves it to utils/utf . utils/utf8
goes away.
Review URL: https://chromiumcodereview.appspot.com//9462001

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5169 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-08 13:28:40 +00:00
sgjesse@google.com 300f3fe802 Add support for using an URL for establishing HTTP connections
As the URI library is now part of the standalone VM it makes sense to
have the option of using a URL for opening a HTTP connection

R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5153 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-08 08:44:59 +00:00
iposva@google.com 988862e0ef - Pass Dart_Null() instead of an empty array for unused import maps.
Review URL: https://chromiumcodereview.appspot.com//9630004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5145 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-08 00:53:56 +00:00
iposva@google.com 69eafdd3cf - Win: Disable logging output during script URI resolution.
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5143 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-08 00:19:39 +00:00
iposva@google.com 8c3715be59 - Win: Remove leading / from file path.
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5141 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-08 00:08:21 +00:00
iposva@google.com e3a8f10c52 - D:\rive\letters
Review URL: https://chromiumcodereview.appspot.com//9608028

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5140 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-08 00:02:17 +00:00
iposva@google.com a37d9578d2 - Fix build: unused vars.
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5138 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-07 23:18:16 +00:00
iposva@google.com 67b02b441d - Proper URI resolution when loading scripts from the standalone binary.
Review URL: https://chromiumcodereview.appspot.com//9614006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5135 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-07 22:57:57 +00:00
sgjesse@google.com 67d055d29c Fix hostname lookup on Windows
The previous implementation was broken and did not use the result retreived from
gethostbyname. Changed the implementation to use getaddrinfo as gethostbyname has
been deprecated in the Winsock2 library.

Added a test to test that something can be read from www.google.com.

R=ager@google.com

BUG=none
TEST=tests/standalone/src/io/HttpClientTest.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5097 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-07 15:18:50 +00:00
sgjesse@google.com f0f34bf277 Add the ability to get the current directory
Added constructor current to directory. Use like this:

var cwd = Directory.current()

R=ager@google.com

BUG=dart:1793
TEST=tests/standalone/src/io/DirectoryTest.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5087 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-07 13:23:08 +00:00
rice@google.com 0b4c8203fc Allow std{in,out,err} to be a socket
Review URL: http://chromiumcodereview.appspot.com/9617012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5056 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-06 21:36:07 +00:00
antonm@google.com 5ece65c673 Force non-Unicode build in all configurations.
Review URL: https://chromiumcodereview.appspot.com//9618018

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5044 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-06 19:00:08 +00:00
sgjesse@google.com ac12107c2f Add method available to StringInputStream
The StringInputStream did not have any way for checking the number of
available characters. Added method available like on a binary
InputStream.

R=ager@google.com

BUG=dart:1945
TEST=tests/standalone/src/io/StringStreamTest.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5021 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-06 12:42:30 +00:00
sgjesse@google.com 144e6d044c Add handling of HTTP header "Expires"
The value of the "Expires" header is now available as a property on
the HttpResponse and the HttpClientResponse.

Added formatting of dates as HTTP dates in RFC 1123 format and parsing
of HTTP dates in all three formats mentioned in RFC 2616.

R=ajohnsen@google.com

BUG=none
TEST=tests/standalone/src/io/HttpDateTest.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5016 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-06 11:24:11 +00:00
sgjesse@google.com 93eecd778e Add handling of the HTTP header "Host"
R=ajohnsen@google.com

BUG=none
TEST=tests/standalone/src/io/HttpTest.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5015 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-06 10:59:28 +00:00
antonm@google.com 7c443aefcf Force not-Unicode version of libdart_builtin.
Current implementation of file/process/etc. assumes it anyway.

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4955 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-05 15:11:51 +00:00
ager@google.com b2b123d24b Update Timer API to take the callback as the last parameter.
This makes the code easier to read when the callback actually does
work:

  new Timer(1000, (t) {
    // do
    // lots
    // of
    // stuff
  });

Also, it is more consistent with the rest of the APIs.

R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4945 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-05 12:43:41 +00:00
sgjesse@google.com b29e72fdbd Make the HttpParser and HttpUtil classes private
Move to separate files for sourcing these in the tests.

R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4934 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-05 08:04:04 +00:00
sgjesse@google.com 086c1f0c3a Handle closing of HTTP client and server
For the server keep track of the state of the connection and close the
socket when it is closed by the client. The client might close the
connection both when processing a request and while the connection is
an idle keep alive connection.

For the client keep track of the active connections as well as the
idle keep alive connections. When the client is closed make sure to
close all connections.

R=ajohnsen@google.com

BUG=none
TEST=tests/standalone/src/io/HttpShutdownTest.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4932 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-05 07:06:37 +00:00
sgjesse@google.com 096badbb62 Use a pool of native ports for file operations
See description on https://chromiumcodereview.appspot.com/9568010/

R=ager@google.com

BUG=none
TEST=tests/standalone/src/ManyFileOperationsTest.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4854 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-02 07:29:20 +00:00
sgjesse@google.com b52a27889d Use a pool of native ports for directory operations
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
2012-03-01 14:29:12 +00:00
sgjesse@google.com 9091eeff05 Missing handling of default arguments in socket stream readInto
Also made it a bit easier to write a socket connection test.

R=ager@google.com

BUG=dart:1925
TEST=tests/standalone/src/Regress-1925.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4793 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-01 12:32:52 +00:00
ager@google.com 242bba108b Reapply dart:io API changes.
R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4790 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-01 10:07:35 +00:00
ager@google.com fd31551ca4 Revert "Rename blahHandler to onBlah throughout dart:io."
D'oh! I need to update the test binaries as well. Reverting, building
and putting back in again.

R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4785 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-01 09:43:15 +00:00
ager@google.com 40e0bceab5 Rename blahHandler to onBlah throughout dart:io.
Additionally, change all single-shot methods to take their callback as an argument instead of registering it on the object.

I have attempted to find all uses in the repo but there might
be some firefighting to do when this lands.

R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4784 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-01 09:36:04 +00:00
ager@google.com f1b2e219ce Fix close callback on FileInputStreams.
Not waiting for the underlying file to actually close before
setting streamMarkedClosed can lead to too early close callbacks.

R=sgjesse@google.com
BUG=dart:1922
TEST=standalone/FileTest.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4754 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-29 15:42:19 +00:00
sgjesse@google.com 1ae77db2aa Add statusCode and reasonPhrase getters and setters to the HttpResponse interface
These where missing in the interface.

R=ager@google.com

BUG=dart:1919
TEST=tests/standalone/src/HttpTest.dart

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4750 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-29 12:59:44 +00:00
asiva@google.com 738f458956 Changes to get rid of dependency on openssl in the dart VM.
(This will enable dartium to be built on the windows platform).
Review URL: https://chromiumcodereview.appspot.com//9481019

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4717 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-28 18:36:39 +00:00
sgjesse@google.com 17abda51e5 Include HTTP library in the standalone VM
HTTP support is part of library dart:io.

The current interface is defined in runtime/bin/http.dart

R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4692 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-28 15:11:34 +00:00
sgjesse@google.com d7c1a2835f Prepare the HTTP library for inclusion in the standalone VM (step 2)
Change the handling of the received data on HTTPRequest and
HTTPClientResponse to use the InputStream interface instead of
dataReceived and dataEnd handlers.

We should probably do something to make the following serer side and
client side patterns simpler:

void handler(HTTPRequest request, HTTPResponse response) {
  ...
  StringBuffer body = new StringBuffer();
  StringInputStream input = new StringInputStream(request.inputStream);
  input.dataHandler = () => body.add(input.read());
  input.closeHandler = () {
    String data = body.toString();
    ...
  }
}

HTTPClientConnection conn = ...
  conn.responseHandler = (HTTPClientResponse r) {
  ...
  StringBuffer body = new StringBuffer();
  StringInputStream input = new StringInputStream(request.inputStream);
  input.dataHandler = () => body.add(input.read());
  input.closeHandler = () {
    String data = body.toString();
    ...
  }
}

R=ager@google.com,ajohnsen@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4679 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-28 13:04:04 +00:00
ager@google.com 4d94b5c4d9 Move back to having File.open{Input,Output}Stream return the stream directly.
R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4677 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-28 12:28:42 +00:00
whesse@google.com 87466eccdd Fix type warnings in dart:io library.
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4672 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-28 11:09:41 +00:00
ager@google.com acc7252c25 Fix type warning.
R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4663 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-28 08:51:07 +00:00
ager@google.com 103804d7f2 Make FileInputStream and FileOutputStream actually asynchronous.
Use the async API of the underlying file.

This also means that openInputStream and openOutputStream can
directly return the stream without performing IO. I'll do that
change as a follow-up.

R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4662 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-28 08:38:25 +00:00
sigmund@google.com ee6a907611 isolates refactor: this change introduces 'dart:isolate' as a library. This is a
big global change, so let me explain in more detail. This refactoring CL does
the following:
- moves all the dart code for isolates in a common library (lib/isolate)

- changes frog to understand 'dart:isolate' imoprts by loading the code from the
  location above.

- changes the vm to undernstand 'dart:isolate' imports by creating a separate
  library that is part of the bootstrap. This follows the same code-structure
  that Todd suggested in his CL introducing the mirror library

- changes dartc to use the shared isolate library as the source of truth for
  type checking. I left around some of the internal js code in dartc so that the
  backend continues to work for apps that don't use isolates.

- changes all tests that use isolates to import the library explicitly (this is a large bulk of the files in this CL)

- changes test status for tests we can't fix in this repo (e.g. co19)

- splits the isolate library code to make it possible to preserve some tests
  without exposing internal types (e.g. tests about
  serialization/deserialization)

- changes the create_sdk script to copy the isolate library to the sdk

- includes the isolate library in dartdoc

I'll wait for at least one lgtm from each area (dartc, vm, frog, sdk)

There is one important pending thing this CL doesn't do:
- update test_runner.dart: This should be updated next time we upload the new
  binaries to tool/testing/bin
- dartium specific changes: Vijay, is there anything I need to do for dartium?

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4647 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-27 22:50:44 +00:00
ager@google.com e286176171 Implement File.{readAsBytes, readAsText, readAsLines}.
Convenience methods to use if all you care about is getting the
entire contents of a file.

R=sgjesse@google.com
BUG=1579
TEST=standalone/FileTest

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4568 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-24 13:31:38 +00:00
whesse@google.com f3ab33610d Use correct format for gyp file when adding -ldl linker flag.
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4536 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 14:52:40 +00:00
whesse@google.com 47f51c1053 Add -ldl linker flag to libdart_builtin link step.
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4532 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 14:25:52 +00:00
whesse@google.com 33acdc584a Add -ldl linker flag to Dart shell extensions test shared library link.
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4530 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 13:46:36 +00:00
whesse@google.com 0e40002890 Add native extensions to the Dart shell, on the linux platform.
BUG=
TEST=standalone/TestExtensionTest

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4529 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 13:25:11 +00:00
sgjesse@google.com e07a1f818e Fix bug in Directory after porting to using native ports
The full path was no longer provided to the directory handler

R=ager@google.com

TEST=tests/standalone/src/DirectoryTest.dart

BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4521 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 11:13:35 +00:00
sgjesse@google.com 5a38a88099 Port async file operations to be using native ports instead or an isolate
R=ager@google.com

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4520 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-23 11:11:48 +00:00