Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Issue 9365010: Move the event handler on macos from poll to kqueue. Simpler and faster. (Closed)

Created:
8 years, 10 months ago by Mads Ager (google)
Modified:
8 years, 10 months ago
Reviewers:
Søren Gjesse
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Move the event handler on macos from poll to kqueue. Simpler and faster. R=sgjesse@google.com BUG= TEST= Committed: https://code.google.com/p/dart/source/detail?r=4028

Patch Set 1 #

Patch Set 2 : Avoid name clash #

Total comments: 16

Patch Set 3 : Address review comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+183 lines, -164 lines) Patch
M runtime/bin/eventhandler_macos.h View 1 2 7 chunks +26 lines, -15 lines 0 comments Download
M runtime/bin/eventhandler_macos.cc View 1 2 9 chunks +157 lines, -149 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
Mads Ager (google)
8 years, 10 months ago (2012-02-08 09:55:49 UTC) #1
Søren Gjesse
lgtm https://chromiumcodereview.appspot.com/9365010/diff/2001/runtime/bin/eventhandler_macos.cc File runtime/bin/eventhandler_macos.cc (right): https://chromiumcodereview.appspot.com/9365010/diff/2001/runtime/bin/eventhandler_macos.cc#newcode47 runtime/bin/eventhandler_macos.cc:47: static void RemoveFromKqueue(intptr_t kqueue_fd_, SocketData* sd) { Maybe ...
8 years, 10 months ago (2012-02-08 10:40:36 UTC) #2
Mads Ager (google)
8 years, 10 months ago (2012-02-08 12:15:15 UTC) #3
https://chromiumcodereview.appspot.com/9365010/diff/2001/runtime/bin/eventhan...
File runtime/bin/eventhandler_macos.cc (right):

https://chromiumcodereview.appspot.com/9365010/diff/2001/runtime/bin/eventhan...
runtime/bin/eventhandler_macos.cc:47: static void RemoveFromKqueue(intptr_t
kqueue_fd_, SocketData* sd) {
On 2012/02/08 10:40:36, Søren Gjesse wrote:
> Maybe add constant kMaxChanges = 2.

Done.

https://chromiumcodereview.appspot.com/9365010/diff/2001/runtime/bin/eventhan...
runtime/bin/eventhandler_macos.cc:60: if (changes > 0) {
On 2012/02/08 10:40:36, Søren Gjesse wrote:
> And ASSERT(changes <= kMaxChanges)

Done.

https://chromiumcodereview.appspot.com/9365010/diff/2001/runtime/bin/eventhan...
runtime/bin/eventhandler_macos.cc:73: intptr_t changes = 0;
On 2012/02/08 10:40:36, Søren Gjesse wrote:
> Ditto constant.

Done.

https://chromiumcodereview.appspot.com/9365010/diff/2001/runtime/bin/eventhan...
runtime/bin/eventhandler_macos.cc:77: if (sd->HasReadEvent()) {
On 2012/02/08 10:40:36, Søren Gjesse wrote:
> Is sd->read_tracked_by_kqueue() always false here? If so ASSERT otherwise skip
> the EV_SET.

It is not always false. What is there now is correct because an ADD operation
means 'modify if exists'. However, by checking explicitly we can sometimes avoid
a system call. I have added the explicit checking.

https://chromiumcodereview.appspot.com/9365010/diff/2001/runtime/bin/eventhan...
runtime/bin/eventhandler_macos.cc:87: if (sd->HasWriteEvent()) {
On 2012/02/08 10:40:36, Søren Gjesse wrote:
> Ditto, is sd->write_tracked_by_kqueue() is always false?

Same as above. Added explicit checking.

https://chromiumcodereview.appspot.com/9365010/diff/2001/runtime/bin/eventhan...
runtime/bin/eventhandler_macos.cc:242: intptr_t
EventHandlerImplementation::GetEvents(struct kevent* event,
On 2012/02/08 10:40:36, Søren Gjesse wrote:
> Nice that we don't need special handling of pipes and need recv calls any
more.

Yes, this is so much cleaner. :)

https://chromiumcodereview.appspot.com/9365010/diff/2001/runtime/bin/eventhan...
runtime/bin/eventhandler_macos.cc:274: // If the read end closed, close the
write end as well,
On 2012/02/08 10:40:36, Søren Gjesse wrote:
> Maybe rephrase "If the read end closed, close the write end as well," to
> something like "If the receiver closed for reading then close for writing".

Done.

https://chromiumcodereview.appspot.com/9365010/diff/2001/runtime/bin/eventhan...
File runtime/bin/eventhandler_macos.h (right):

https://chromiumcodereview.appspot.com/9365010/diff/2001/runtime/bin/eventhan...
runtime/bin/eventhandler_macos.h:9: #error Do not include eventhandler_linux.h
directly; use eventhandler.h instead.
On 2012/02/08 10:40:36, Søren Gjesse wrote:
> Please revert this change.

Whoops. Thanks! I started this with a copy from the linux file because the
structure would be similar to epoll. :)

Powered by Google App Engine
This is Rietveld 408576698