| 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 | |
| 21 namespace dart { | 20 namespace dart { |
| 22 namespace bin { | 21 namespace bin { |
| 23 | 22 |
| 24 class DescriptorInfo : public DescriptorInfoBase { | 23 class DescriptorInfo : public DescriptorInfoBase { |
| 25 public: | 24 public: |
| 26 explicit DescriptorInfo(intptr_t fd) | 25 explicit DescriptorInfo(intptr_t fd) |
| 27 : DescriptorInfoBase(fd), tracked_by_kqueue_(false) {} | 26 : DescriptorInfoBase(fd), tracked_by_kqueue_(false) {} |
| 28 | 27 |
| 29 virtual ~DescriptorInfo() {} | 28 virtual ~DescriptorInfo() {} |
| 30 | 29 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 43 | 42 |
| 44 bool HasWriteEvent(); | 43 bool HasWriteEvent(); |
| 45 | 44 |
| 46 protected: | 45 protected: |
| 47 bool tracked_by_kqueue_; | 46 bool tracked_by_kqueue_; |
| 48 | 47 |
| 49 private: | 48 private: |
| 50 DISALLOW_COPY_AND_ASSIGN(DescriptorInfo); | 49 DISALLOW_COPY_AND_ASSIGN(DescriptorInfo); |
| 51 }; | 50 }; |
| 52 | 51 |
| 53 | |
| 54 class DescriptorInfoSingle : public DescriptorInfoSingleMixin<DescriptorInfo> { | 52 class DescriptorInfoSingle : public DescriptorInfoSingleMixin<DescriptorInfo> { |
| 55 public: | 53 public: |
| 56 explicit DescriptorInfoSingle(intptr_t fd) | 54 explicit DescriptorInfoSingle(intptr_t fd) |
| 57 : DescriptorInfoSingleMixin(fd, false) {} | 55 : DescriptorInfoSingleMixin(fd, false) {} |
| 58 virtual ~DescriptorInfoSingle() {} | 56 virtual ~DescriptorInfoSingle() {} |
| 59 | 57 |
| 60 private: | 58 private: |
| 61 DISALLOW_COPY_AND_ASSIGN(DescriptorInfoSingle); | 59 DISALLOW_COPY_AND_ASSIGN(DescriptorInfoSingle); |
| 62 }; | 60 }; |
| 63 | 61 |
| 64 | |
| 65 class DescriptorInfoMultiple | 62 class DescriptorInfoMultiple |
| 66 : public DescriptorInfoMultipleMixin<DescriptorInfo> { | 63 : public DescriptorInfoMultipleMixin<DescriptorInfo> { |
| 67 public: | 64 public: |
| 68 explicit DescriptorInfoMultiple(intptr_t fd) | 65 explicit DescriptorInfoMultiple(intptr_t fd) |
| 69 : DescriptorInfoMultipleMixin(fd, false) {} | 66 : DescriptorInfoMultipleMixin(fd, false) {} |
| 70 virtual ~DescriptorInfoMultiple() {} | 67 virtual ~DescriptorInfoMultiple() {} |
| 71 | 68 |
| 72 private: | 69 private: |
| 73 DISALLOW_COPY_AND_ASSIGN(DescriptorInfoMultiple); | 70 DISALLOW_COPY_AND_ASSIGN(DescriptorInfoMultiple); |
| 74 }; | 71 }; |
| 75 | 72 |
| 76 | |
| 77 class EventHandlerImplementation { | 73 class EventHandlerImplementation { |
| 78 public: | 74 public: |
| 79 EventHandlerImplementation(); | 75 EventHandlerImplementation(); |
| 80 ~EventHandlerImplementation(); | 76 ~EventHandlerImplementation(); |
| 81 | 77 |
| 82 void UpdateKQueueInstance(intptr_t old_mask, DescriptorInfo* di); | 78 void UpdateKQueueInstance(intptr_t old_mask, DescriptorInfo* di); |
| 83 | 79 |
| 84 // Gets the socket data structure for a given file | 80 // Gets the socket data structure for a given file |
| 85 // descriptor. Creates a new one if one is not found. | 81 // descriptor. Creates a new one if one is not found. |
| 86 DescriptorInfo* GetDescriptorInfo(intptr_t fd, bool is_listening); | 82 DescriptorInfo* GetDescriptorInfo(intptr_t fd, bool is_listening); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 106 int interrupt_fds_[2]; | 102 int interrupt_fds_[2]; |
| 107 int kqueue_fd_; | 103 int kqueue_fd_; |
| 108 | 104 |
| 109 DISALLOW_COPY_AND_ASSIGN(EventHandlerImplementation); | 105 DISALLOW_COPY_AND_ASSIGN(EventHandlerImplementation); |
| 110 }; | 106 }; |
| 111 | 107 |
| 112 } // namespace bin | 108 } // namespace bin |
| 113 } // namespace dart | 109 } // namespace dart |
| 114 | 110 |
| 115 #endif // RUNTIME_BIN_EVENTHANDLER_MACOS_H_ | 111 #endif // RUNTIME_BIN_EVENTHANDLER_MACOS_H_ |
| OLD | NEW |