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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 } | 93 } |
94 | 94 |
95 void GenericEventQueue::close() | 95 void GenericEventQueue::close() |
96 { | 96 { |
97 m_isClosed = true; | 97 m_isClosed = true; |
98 | 98 |
99 m_timer.stop(); | 99 m_timer.stop(); |
100 m_pendingEvents.clear(); | 100 m_pendingEvents.clear(); |
101 } | 101 } |
102 | 102 |
| 103 bool GenericEventQueue::enqueueEventWithoutTarget(PassRefPtr<Event> event) |
| 104 { |
| 105 if (m_isClosed) |
| 106 return false; |
| 107 |
| 108 ASSERT(!event->target()); |
| 109 |
| 110 m_pendingEvents.append(event); |
| 111 |
| 112 if (!m_timer.isActive()) |
| 113 m_timer.startOneShot(0); |
| 114 |
| 115 return true; |
| 116 } |
| 117 |
103 void GenericEventQueue::cancelAllEvents() | 118 void GenericEventQueue::cancelAllEvents() |
104 { | 119 { |
105 m_timer.stop(); | 120 m_timer.stop(); |
106 m_pendingEvents.clear(); | 121 m_pendingEvents.clear(); |
107 } | 122 } |
108 | 123 |
109 bool GenericEventQueue::hasPendingEvents() const | 124 bool GenericEventQueue::hasPendingEvents() const |
110 { | 125 { |
111 return m_pendingEvents.size(); | 126 return m_pendingEvents.size(); |
112 } | 127 } |
113 | 128 |
114 } | 129 } |
OLD | NEW |