| 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 BIN_EVENTHANDLER_H_ | 5 #ifndef BIN_EVENTHANDLER_H_ |
| 6 #define BIN_EVENTHANDLER_H_ | 6 #define BIN_EVENTHANDLER_H_ |
| 7 | 7 |
| 8 #include "bin/builtin.h" | 8 #include "bin/builtin.h" |
| 9 #include "bin/isolate_data.h" | 9 #include "bin/isolate_data.h" |
| 10 | 10 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 public: | 58 public: |
| 59 TimeoutQueue() : next_timeout_(NULL), timeouts_(NULL) {} | 59 TimeoutQueue() : next_timeout_(NULL), timeouts_(NULL) {} |
| 60 | 60 |
| 61 ~TimeoutQueue() { | 61 ~TimeoutQueue() { |
| 62 while (HasTimeout()) RemoveCurrent(); | 62 while (HasTimeout()) RemoveCurrent(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 bool HasTimeout() const { return next_timeout_ != NULL; } | 65 bool HasTimeout() const { return next_timeout_ != NULL; } |
| 66 | 66 |
| 67 int64_t CurrentTimeout() const { | 67 int64_t CurrentTimeout() const { |
| 68 ASSERT(next_timeout_ != NULL); |
| 68 return next_timeout_->timeout(); | 69 return next_timeout_->timeout(); |
| 69 } | 70 } |
| 70 | 71 |
| 71 Dart_Port CurrentPort() const { | 72 Dart_Port CurrentPort() const { |
| 73 ASSERT(next_timeout_ != NULL); |
| 72 return next_timeout_->port(); | 74 return next_timeout_->port(); |
| 73 } | 75 } |
| 74 | 76 |
| 75 void RemoveCurrent() { | 77 void RemoveCurrent() { |
| 76 UpdateTimeout(CurrentPort(), -1); | 78 UpdateTimeout(CurrentPort(), -1); |
| 77 } | 79 } |
| 78 | 80 |
| 79 void UpdateTimeout(Dart_Port port, int64_t timeout); | 81 void UpdateTimeout(Dart_Port port, int64_t timeout); |
| 80 | 82 |
| 81 private: | 83 private: |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 125 |
| 124 private: | 126 private: |
| 125 friend class EventHandlerImplementation; | 127 friend class EventHandlerImplementation; |
| 126 EventHandlerImplementation delegate_; | 128 EventHandlerImplementation delegate_; |
| 127 }; | 129 }; |
| 128 | 130 |
| 129 } // namespace bin | 131 } // namespace bin |
| 130 } // namespace dart | 132 } // namespace dart |
| 131 | 133 |
| 132 #endif // BIN_EVENTHANDLER_H_ | 134 #endif // BIN_EVENTHANDLER_H_ |
| OLD | NEW |