| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef RUNTIME_BIN_EVENTHANDLER_MACOS_H_ | 5 #ifndef RUNTIME_BIN_EVENTHANDLER_MACOS_H_ |
| 6 #define RUNTIME_BIN_EVENTHANDLER_MACOS_H_ | 6 #define RUNTIME_BIN_EVENTHANDLER_MACOS_H_ |
| 7 | 7 |
| 8 #if !defined(RUNTIME_BIN_EVENTHANDLER_H_) | 8 #if !defined(RUNTIME_BIN_EVENTHANDLER_H_) |
| 9 #error Do not include eventhandler_macos.h directly; use eventhandler.h instead. | 9 #error Do not include eventhandler_macos.h directly; use eventhandler.h instead. |
| 10 #endif | 10 #endif |
| 11 | 11 |
| 12 #include <errno.h> | 12 #include <errno.h> |
| 13 #include <sys/event.h> // NOLINT | 13 #include <sys/event.h> // NOLINT |
| 14 #include <sys/socket.h> | 14 #include <sys/socket.h> |
| 15 #include <unistd.h> | 15 #include <unistd.h> |
| 16 | 16 |
| 17 #include "platform/hashmap.h" | 17 #include "platform/hashmap.h" |
| 18 #include "platform/signal_blocker.h" | 18 #include "platform/signal_blocker.h" |
| 19 | 19 |
| 20 | 20 |
| 21 namespace dart { | 21 namespace dart { |
| 22 namespace bin { | 22 namespace bin { |
| 23 | 23 |
| 24 class DescriptorInfo : public DescriptorInfoBase { | 24 class DescriptorInfo : public DescriptorInfoBase { |
| 25 public: | 25 public: |
| 26 explicit DescriptorInfo(intptr_t fd) | 26 explicit DescriptorInfo(intptr_t fd) : DescriptorInfoBase(fd) {} |
| 27 : DescriptorInfoBase(fd), tracked_by_kqueue_(false) {} | |
| 28 | 27 |
| 29 virtual ~DescriptorInfo() {} | 28 virtual ~DescriptorInfo() {} |
| 30 | 29 |
| 31 intptr_t GetPollEvents(); | 30 intptr_t GetPollEvents(); |
| 32 | 31 |
| 33 virtual void Close() { | 32 virtual void Close() { |
| 34 VOID_TEMP_FAILURE_RETRY(close(fd_)); | 33 VOID_TEMP_FAILURE_RETRY(close(fd_)); |
| 35 fd_ = -1; | 34 fd_ = -1; |
| 36 } | 35 } |
| 37 | 36 |
| 38 void set_tracked_by_kqueue(bool value) { tracked_by_kqueue_ = value; } | |
| 39 | |
| 40 bool tracked_by_kqueue() { return tracked_by_kqueue_; } | |
| 41 | |
| 42 bool HasReadEvent(); | 37 bool HasReadEvent(); |
| 43 | 38 |
| 44 bool HasWriteEvent(); | 39 bool HasWriteEvent(); |
| 45 | 40 |
| 46 protected: | |
| 47 bool tracked_by_kqueue_; | |
| 48 | |
| 49 private: | 41 private: |
| 50 DISALLOW_COPY_AND_ASSIGN(DescriptorInfo); | 42 DISALLOW_COPY_AND_ASSIGN(DescriptorInfo); |
| 51 }; | 43 }; |
| 52 | 44 |
| 53 | 45 |
| 54 class DescriptorInfoSingle : public DescriptorInfoSingleMixin<DescriptorInfo> { | 46 class DescriptorInfoSingle : public DescriptorInfoSingleMixin<DescriptorInfo> { |
| 55 public: | 47 public: |
| 56 explicit DescriptorInfoSingle(intptr_t fd) | 48 explicit DescriptorInfoSingle(intptr_t fd) |
| 57 : DescriptorInfoSingleMixin(fd, false) {} | 49 : DescriptorInfoSingleMixin(fd, false) {} |
| 58 virtual ~DescriptorInfoSingle() {} | 50 virtual ~DescriptorInfoSingle() {} |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 int interrupt_fds_[2]; | 98 int interrupt_fds_[2]; |
| 107 int kqueue_fd_; | 99 int kqueue_fd_; |
| 108 | 100 |
| 109 DISALLOW_COPY_AND_ASSIGN(EventHandlerImplementation); | 101 DISALLOW_COPY_AND_ASSIGN(EventHandlerImplementation); |
| 110 }; | 102 }; |
| 111 | 103 |
| 112 } // namespace bin | 104 } // namespace bin |
| 113 } // namespace dart | 105 } // namespace dart |
| 114 | 106 |
| 115 #endif // RUNTIME_BIN_EVENTHANDLER_MACOS_H_ | 107 #endif // RUNTIME_BIN_EVENTHANDLER_MACOS_H_ |
| OLD | NEW |