OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2010 Google 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 m_pendingEventTimer->stop(); | 95 m_pendingEventTimer->stop(); |
96 m_queuedEvents.clear(); | 96 m_queuedEvents.clear(); |
97 } | 97 } |
98 | 98 |
99 void DOMWindowEventQueue::pendingEventTimerFired() | 99 void DOMWindowEventQueue::pendingEventTimerFired() |
100 { | 100 { |
101 ASSERT(!m_pendingEventTimer->isActive()); | 101 ASSERT(!m_pendingEventTimer->isActive()); |
102 ASSERT(!m_queuedEvents.isEmpty()); | 102 ASSERT(!m_queuedEvents.isEmpty()); |
103 | 103 |
104 // Insert a marker for where we should stop. | 104 // Insert a marker for where we should stop. |
105 ASSERT(!m_queuedEvents.contains(0)); | 105 ASSERT(!m_queuedEvents.contains(nullptr)); |
106 bool wasAdded = m_queuedEvents.add(0).isNewEntry; | 106 bool wasAdded = m_queuedEvents.add(nullptr).isNewEntry; |
107 ASSERT_UNUSED(wasAdded, wasAdded); // It should not have already been in the
list. | 107 ASSERT_UNUSED(wasAdded, wasAdded); // It should not have already been in the
list. |
108 | 108 |
109 RefPtr<DOMWindowEventQueue> protector(this); | 109 RefPtr<DOMWindowEventQueue> protector(this); |
110 | 110 |
111 while (!m_queuedEvents.isEmpty()) { | 111 while (!m_queuedEvents.isEmpty()) { |
112 ListHashSet<RefPtr<Event>, 16>::iterator iter = m_queuedEvents.begin(); | 112 ListHashSet<RefPtr<Event>, 16>::iterator iter = m_queuedEvents.begin(); |
113 RefPtr<Event> event = *iter; | 113 RefPtr<Event> event = *iter; |
114 m_queuedEvents.remove(iter); | 114 m_queuedEvents.remove(iter); |
115 if (!event) | 115 if (!event) |
116 break; | 116 break; |
117 dispatchEvent(event.get()); | 117 dispatchEvent(event.get()); |
118 } | 118 } |
119 } | 119 } |
120 | 120 |
121 void DOMWindowEventQueue::dispatchEvent(PassRefPtr<Event> event) | 121 void DOMWindowEventQueue::dispatchEvent(PassRefPtr<Event> event) |
122 { | 122 { |
123 EventTarget* eventTarget = event->target(); | 123 EventTarget* eventTarget = event->target(); |
124 if (eventTarget->toDOMWindow()) | 124 if (eventTarget->toDOMWindow()) |
125 eventTarget->toDOMWindow()->dispatchEvent(event, 0); | 125 eventTarget->toDOMWindow()->dispatchEvent(event, nullptr); |
126 else | 126 else |
127 eventTarget->dispatchEvent(event); | 127 eventTarget->dispatchEvent(event); |
128 } | 128 } |
129 | 129 |
130 } | 130 } |
OLD | NEW |