Commit graph

12 commits

Author SHA1 Message Date
ager@google.com 5c9f9ef74f Avoid needless int64_t to intptr_t conversion in eventhandler.
R=sgjesse@google.com
BUG=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@12693 260f80e4-7a28-3924-810f-c04153c831b5
2012-09-21 11:40:40 +00:00
asiva@google.com 9d123e5366 Move hashmap.h and hashmap.cc from the 'bin' directory to 'platform' directory so that it can be used from VM code too.
Review URL: https://chromiumcodereview.appspot.com//10853009

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10261 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-03 22:11:30 +00:00
ager@google.com f791a12b38 Terminate event handler thread on isolate shutdown.
R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9251 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-29 14:40:17 +00:00
ager@google.com 0a0f1d9504 Move the event handler on macos from poll to kqueue. Simpler and faster.
R=sgjesse@google.com
BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@4028 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-08 12:18:29 +00:00
sgjesse@google.com 42b70dcddb Change the thread interface in runtime/platform and use it starting all threads
The platform thread interface (dart::thread) is now refactored to an
all static interface as suggested by iposva@ and asiva@. Use this
interface for running all threads in the VM.

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

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3830 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-02 08:59:26 +00:00
sgjesse@google.com c1d041500f Use hash map for event handler file descriptor map
Instead of using an array indexed using the file descriptor for
looking up data associated with a socket (SocketData objects) this is
now stored in a hash map using the file descriptor as key.

Added hash map implementation like the one used in the V8 project.

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

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3483 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-23 09:10:51 +00:00
sgjesse@google.com 3a02bcfc04 Add additional include guard in platform specific .h files
R=ager@google.com

BUG=
TEST=

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

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3433 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-19 13:37:26 +00:00
sgjesse@google.com 5950638350 Better handling of stdin/stdout/stderr
When using stdout/stderr it is no longer necessary to explicitly
close the streams for the program to terminate. The automatic
close is handled by always closing the associated receive port
for write only streams when not waiting for any events. If a
close or error handler is installed for stdout/stderr these will
still keep the program alive.

For stdin better handling of the difference between sockets and
pipes have been immplemented. As a special case for stdin when
reading from a terminal the a POLLIN signal with 0 available
bytes is treated as end-of-file. This will trigger when pressing
ctrl-d in a terminal as POLLHUP is not set in that situation.

R=ager@google.com

BUG=
TEST=

Review URL: http://codereview.chromium.org//8533005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1507 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-14 14:47:58 +00:00
sgjesse@google.com 516d71ab0b Change the handling of closing sockets
Sockets now supports being half-closed for either reading or writing. When a socket is closed it is by default closed for both read and write and the underlying file descriptor is destroyed. However the socket close can be asked to only half-close the socket to send end of stream to the other end and still have the ability to receive more data.

The close event on a socket is only emitted when the socket is closed by the other end. Both half-close and full-close by the other end is reported as a close event. If a socket is already half closed the close event will automatically destroy the socket.

The streams on the sockets also takes advantage of this. A socket input stream will report a close event when the other end closed. A socket output stream will half-close the socket when close is called making it possible to still receive data on the input stream. When both streams have been closed the socket is destroyed.

For sockets operating on pipes they are initially created as half-closed for either reading or writing depending on which type of pipe a socket object is based on. A pipe for writing will start half-closed for reading so if it is only half-closed for writing the socket will still be destroyed. Same with a pipe for reading that will start half-closed for writing and when a close event is received half-closing the other direction will destroy the socket. Socket objects based on pipes are only exposed through streams.

Extended the socket close test to test a number of different scenarios.

Also refactor the socket data C++ object to encapsulate more socket information and operations.

Now the Linux and Mac OS versions are 100% the same as it turned out that using POLLRDHUP on Linux was not required any more.

R=ager@google.com

BUG=
TEST=

Review URL: http://codereview.chromium.org//8437090

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1196 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-04 12:34:43 +00:00
sgjesse@google.com 032de2585d Some Linux and Mac OS event handler refactoring
This moved some of the handling of the data on a socket to a socket data object.

This is a step in preparation for another change where more state will be stored on socket data object.

This is also a step in moving from an array of socket data objects indexed by the file descriptor to a hash map of socket data objects.

R=ager@google.com

BUG=
TEST=

Review URL: http://codereview.chromium.org//8431027

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1001 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-01 11:54:14 +00:00
sgjesse@google.com 6568436be7 Explicitly handle listen sockets and connection sockets differently in Linux and Mac OS eventhandler
Previously the assumption was that an POLLIN event with no data available was from a listen socket with pending accepts. However a POLLIN event from a connection socket can have no data available if the data has been read before the event is processed.

R=ager@google.com

BUG=
TEST=

Review URL: http://codereview.chromium.org//8399039

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@878 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-28 09:30:42 +00:00
dgrove@google.com 4c0f559d23 Initial checkin.
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-05 05:20:07 +00:00