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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 void ScopedEventQueue::initialize() { | 51 void ScopedEventQueue::initialize() { |
52 DCHECK(!s_instance); | 52 DCHECK(!s_instance); |
53 std::unique_ptr<ScopedEventQueue> instance = | 53 std::unique_ptr<ScopedEventQueue> instance = |
54 WTF::wrapUnique(new ScopedEventQueue); | 54 WTF::wrapUnique(new ScopedEventQueue); |
55 s_instance = instance.release(); | 55 s_instance = instance.release(); |
56 } | 56 } |
57 | 57 |
58 void ScopedEventQueue::enqueueEventDispatchMediator( | 58 void ScopedEventQueue::enqueueEventDispatchMediator( |
59 EventDispatchMediator* mediator) { | 59 EventDispatchMediator* mediator) { |
60 if (shouldQueueEvents()) | 60 if (shouldQueueEvents()) |
61 m_queuedEventDispatchMediators.append(mediator); | 61 m_queuedEventDispatchMediators.push_back(mediator); |
62 else | 62 else |
63 dispatchEvent(mediator); | 63 dispatchEvent(mediator); |
64 } | 64 } |
65 | 65 |
66 void ScopedEventQueue::dispatchAllEvents() { | 66 void ScopedEventQueue::dispatchAllEvents() { |
67 HeapVector<Member<EventDispatchMediator>> queuedEventDispatchMediators; | 67 HeapVector<Member<EventDispatchMediator>> queuedEventDispatchMediators; |
68 queuedEventDispatchMediators.swap(m_queuedEventDispatchMediators); | 68 queuedEventDispatchMediators.swap(m_queuedEventDispatchMediators); |
69 | 69 |
70 for (auto& mediator : queuedEventDispatchMediators) | 70 for (auto& mediator : queuedEventDispatchMediators) |
71 dispatchEvent(mediator.release()); | 71 dispatchEvent(mediator.release()); |
(...skipping 17 matching lines...) Expand all Loading... |
89 } | 89 } |
90 | 90 |
91 void ScopedEventQueue::decrementScopingLevel() { | 91 void ScopedEventQueue::decrementScopingLevel() { |
92 DCHECK(m_scopingLevel); | 92 DCHECK(m_scopingLevel); |
93 m_scopingLevel--; | 93 m_scopingLevel--; |
94 if (!m_scopingLevel) | 94 if (!m_scopingLevel) |
95 dispatchAllEvents(); | 95 dispatchAllEvents(); |
96 } | 96 } |
97 | 97 |
98 } // namespace blink | 98 } // namespace blink |
OLD | NEW |