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/dartutils.h" | 9 #include "bin/dartutils.h" |
10 #include "bin/isolate_data.h" | 10 #include "bin/isolate_data.h" |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 virtual void ReturnTokens(Dart_Port port, int count) { | 550 virtual void ReturnTokens(Dart_Port port, int count) { |
551 HashMap::Entry* entry = tokens_map_.Lookup( | 551 HashMap::Entry* entry = tokens_map_.Lookup( |
552 GetHashmapKeyFromPort(port), GetHashmapHashFromPort(port), false); | 552 GetHashmapKeyFromPort(port), GetHashmapHashFromPort(port), false); |
553 ASSERT(entry != NULL); | 553 ASSERT(entry != NULL); |
554 | 554 |
555 PortEntry* pentry = reinterpret_cast<PortEntry*>(entry->value); | 555 PortEntry* pentry = reinterpret_cast<PortEntry*>(entry->value); |
556 bool was_ready = pentry->IsReady(); | 556 bool was_ready = pentry->IsReady(); |
557 if (!disable_tokens_) { | 557 if (!disable_tokens_) { |
558 pentry->token_count += count; | 558 pentry->token_count += count; |
559 } | 559 } |
| 560 if ((!(pentry->token_count <= kTokenCount)) || (pentry->token_count < -50))
{ |
| 561 fprintf(stderr, "pentry->token_count: %p kTokenCount: %i\n", |
| 562 reinterpret_cast<void*>(pentry->token_count), kTokenCount); |
| 563 } |
560 ASSERT(pentry->token_count <= kTokenCount); | 564 ASSERT(pentry->token_count <= kTokenCount); |
561 bool is_ready = pentry->token_count > 0 && pentry->IsReady(); | 565 bool is_ready = pentry->token_count > 0 && pentry->IsReady(); |
562 if (!was_ready && is_ready) { | 566 if (!was_ready && is_ready) { |
563 active_readers_.Add(pentry); | 567 active_readers_.Add(pentry); |
564 } | 568 } |
565 } | 569 } |
566 | 570 |
567 virtual intptr_t Mask() { | 571 virtual intptr_t Mask() { |
568 if (active_readers_.HasHead()) { | 572 if (active_readers_.HasHead()) { |
569 return 1 << kInEvent; | 573 return 1 << kInEvent; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 | 638 |
635 private: | 639 private: |
636 friend class EventHandlerImplementation; | 640 friend class EventHandlerImplementation; |
637 EventHandlerImplementation delegate_; | 641 EventHandlerImplementation delegate_; |
638 }; | 642 }; |
639 | 643 |
640 } // namespace bin | 644 } // namespace bin |
641 } // namespace dart | 645 } // namespace dart |
642 | 646 |
643 #endif // BIN_EVENTHANDLER_H_ | 647 #endif // BIN_EVENTHANDLER_H_ |
OLD | NEW |