OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Victor Carbune (victor@rosedu.org) | 2 * Copyright (C) 2012 Victor Carbune (victor@rosedu.org) |
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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 return true; | 68 return true; |
69 } | 69 } |
70 | 70 |
71 bool GenericEventQueue::cancelEvent(Event* event) { | 71 bool GenericEventQueue::cancelEvent(Event* event) { |
72 bool found = m_pendingEvents.contains(event); | 72 bool found = m_pendingEvents.contains(event); |
73 | 73 |
74 if (found) { | 74 if (found) { |
75 EventTarget* target = event->target() ? event->target() : m_owner.get(); | 75 EventTarget* target = event->target() ? event->target() : m_owner.get(); |
76 probe::asyncTaskCanceled(target->getExecutionContext(), event); | 76 probe::asyncTaskCanceled(target->getExecutionContext(), event); |
77 m_pendingEvents.remove(m_pendingEvents.find(event)); | 77 m_pendingEvents.erase(m_pendingEvents.find(event)); |
78 TRACE_EVENT_ASYNC_END2("event", "GenericEventQueue:enqueueEvent", event, | 78 TRACE_EVENT_ASYNC_END2("event", "GenericEventQueue:enqueueEvent", event, |
79 "type", event->type().ascii(), "status", | 79 "type", event->type().ascii(), "status", |
80 "cancelled"); | 80 "cancelled"); |
81 } | 81 } |
82 | 82 |
83 if (m_pendingEvents.isEmpty()) | 83 if (m_pendingEvents.isEmpty()) |
84 m_timer.stop(); | 84 m_timer.stop(); |
85 | 85 |
86 return found; | 86 return found; |
87 } | 87 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 probe::asyncTaskCanceled(target->getExecutionContext(), event); | 123 probe::asyncTaskCanceled(target->getExecutionContext(), event); |
124 } | 124 } |
125 m_pendingEvents.clear(); | 125 m_pendingEvents.clear(); |
126 } | 126 } |
127 | 127 |
128 bool GenericEventQueue::hasPendingEvents() const { | 128 bool GenericEventQueue::hasPendingEvents() const { |
129 return m_pendingEvents.size(); | 129 return m_pendingEvents.size(); |
130 } | 130 } |
131 | 131 |
132 } // namespace blink | 132 } // namespace blink |
OLD | NEW |