OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 HeapVector<Member<T>> m_dispatchSoonList; | 69 HeapVector<Member<T>> m_dispatchSoonList; |
70 HeapVector<Member<T>> m_dispatchingList; | 70 HeapVector<Member<T>> m_dispatchingList; |
71 }; | 71 }; |
72 | 72 |
73 template <typename T> | 73 template <typename T> |
74 EventSender<T>::EventSender(const AtomicString& eventType) | 74 EventSender<T>::EventSender(const AtomicString& eventType) |
75 : m_eventType(eventType), m_timer(this, &EventSender::timerFired) {} | 75 : m_eventType(eventType), m_timer(this, &EventSender::timerFired) {} |
76 | 76 |
77 template <typename T> | 77 template <typename T> |
78 void EventSender<T>::dispatchEventSoon(T* sender) { | 78 void EventSender<T>::dispatchEventSoon(T* sender) { |
79 m_dispatchSoonList.append(sender); | 79 m_dispatchSoonList.push_back(sender); |
80 if (!m_timer.isActive()) | 80 if (!m_timer.isActive()) |
81 m_timer.startOneShot(0, BLINK_FROM_HERE); | 81 m_timer.startOneShot(0, BLINK_FROM_HERE); |
82 } | 82 } |
83 | 83 |
84 template <typename T> | 84 template <typename T> |
85 void EventSender<T>::cancelEvent(T* sender) { | 85 void EventSender<T>::cancelEvent(T* sender) { |
86 // Remove instances of this sender from both lists. | 86 // Remove instances of this sender from both lists. |
87 // Use loops because we allow multiple instances to get into the lists. | 87 // Use loops because we allow multiple instances to get into the lists. |
88 for (auto& senderInList : m_dispatchSoonList) { | 88 for (auto& senderInList : m_dispatchSoonList) { |
89 if (senderInList == sender) | 89 if (senderInList == sender) |
(...skipping 21 matching lines...) Expand all Loading... |
111 senderInList = nullptr; | 111 senderInList = nullptr; |
112 sender->dispatchPendingEvent(this); | 112 sender->dispatchPendingEvent(this); |
113 } | 113 } |
114 } | 114 } |
115 m_dispatchingList.clear(); | 115 m_dispatchingList.clear(); |
116 } | 116 } |
117 | 117 |
118 } // namespace blink | 118 } // namespace blink |
119 | 119 |
120 #endif // EventSender_h | 120 #endif // EventSender_h |
OLD | NEW |