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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 } | 49 } |
50 | 50 |
51 bool GenericEventQueue::enqueueEvent(PassRefPtr<Event> event) | 51 bool GenericEventQueue::enqueueEvent(PassRefPtr<Event> event) |
52 { | 52 { |
53 if (m_isClosed) | 53 if (m_isClosed) |
54 return false; | 54 return false; |
55 | 55 |
56 if (event->target() == m_owner) | 56 if (event->target() == m_owner) |
57 event->setTarget(nullptr); | 57 event->setTarget(nullptr); |
58 | 58 |
59 TRACE_EVENT_ASYNC_BEGIN1("event", "GenericEventQueue:enqueueEvent", event.ge t(), "type", event->type().ascii().data()); | 59 TRACE_EVENT_ASYNC_BEGIN1("event", "GenericEventQueue:enqueueEvent", |
60 event.get(), "type", | |
61 TRACE_STR_COPY(event->type().ascii().data())); | |
jamesr
2015/04/29 00:12:46
event->type().ascii().data() is a pointer to tempo
| |
60 m_pendingEvents.append(event); | 62 m_pendingEvents.append(event); |
61 | 63 |
62 if (!m_timer.isActive()) | 64 if (!m_timer.isActive()) |
63 m_timer.startOneShot(0, FROM_HERE); | 65 m_timer.startOneShot(0, FROM_HERE); |
64 | 66 |
65 return true; | 67 return true; |
66 } | 68 } |
67 | 69 |
68 bool GenericEventQueue::cancelEvent(Event* event) | 70 bool GenericEventQueue::cancelEvent(Event* event) |
69 { | 71 { |
70 bool found = m_pendingEvents.contains(event); | 72 bool found = m_pendingEvents.contains(event); |
71 | 73 |
72 if (found) { | 74 if (found) { |
73 m_pendingEvents.remove(m_pendingEvents.find(event)); | 75 m_pendingEvents.remove(m_pendingEvents.find(event)); |
74 TRACE_EVENT_ASYNC_END2("event", "GenericEventQueue:enqueueEvent", event, "type", event->type().ascii().data(), "status", "cancelled"); | 76 TRACE_EVENT_ASYNC_END2("event", "GenericEventQueue:enqueueEvent", event, |
77 "type", | |
78 TRACE_STR_COPY(event->type().ascii().data()), | |
jamesr
2015/04/29 00:12:46
ditto
| |
79 "status", "cancelled"); | |
75 } | 80 } |
76 | 81 |
77 if (m_pendingEvents.isEmpty()) | 82 if (m_pendingEvents.isEmpty()) |
78 m_timer.stop(); | 83 m_timer.stop(); |
79 | 84 |
80 return found; | 85 return found; |
81 } | 86 } |
82 | 87 |
83 void GenericEventQueue::timerFired(Timer<GenericEventQueue>*) | 88 void GenericEventQueue::timerFired(Timer<GenericEventQueue>*) |
84 { | 89 { |
(...skipping 19 matching lines...) Expand all Loading... | |
104 m_isClosed = true; | 109 m_isClosed = true; |
105 cancelAllEvents(); | 110 cancelAllEvents(); |
106 } | 111 } |
107 | 112 |
108 void GenericEventQueue::cancelAllEvents() | 113 void GenericEventQueue::cancelAllEvents() |
109 { | 114 { |
110 m_timer.stop(); | 115 m_timer.stop(); |
111 | 116 |
112 for (size_t i = 0; i < m_pendingEvents.size(); ++i) { | 117 for (size_t i = 0; i < m_pendingEvents.size(); ++i) { |
113 Event* event = m_pendingEvents[i].get(); | 118 Event* event = m_pendingEvents[i].get(); |
114 TRACE_EVENT_ASYNC_END2("event", "GenericEventQueue:enqueueEvent", event, "type", event->type().ascii().data(), "status", "cancelled"); | 119 TRACE_EVENT_ASYNC_END2("event", "GenericEventQueue:enqueueEvent", event, |
120 "type", | |
121 TRACE_STR_COPY(event->type().ascii().data()), | |
jamesr
2015/04/29 00:12:46
ditto
| |
122 "status", "cancelled"); | |
115 } | 123 } |
116 m_pendingEvents.clear(); | 124 m_pendingEvents.clear(); |
117 } | 125 } |
118 | 126 |
119 bool GenericEventQueue::hasPendingEvents() const | 127 bool GenericEventQueue::hasPendingEvents() const |
120 { | 128 { |
121 return m_pendingEvents.size(); | 129 return m_pendingEvents.size(); |
122 } | 130 } |
123 | 131 |
124 } | 132 } |
OLD | NEW |