| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 ScopedEventQueue::ScopedEventQueue() : m_scopingLevel(0) {} | 44 ScopedEventQueue::ScopedEventQueue() : m_scopingLevel(0) {} |
| 45 | 45 |
| 46 ScopedEventQueue::~ScopedEventQueue() { | 46 ScopedEventQueue::~ScopedEventQueue() { |
| 47 DCHECK(!m_scopingLevel); | 47 DCHECK(!m_scopingLevel); |
| 48 DCHECK(!m_queuedEventDispatchMediators.size()); | 48 DCHECK(!m_queuedEventDispatchMediators.size()); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void ScopedEventQueue::initialize() { | 51 void ScopedEventQueue::initialize() { |
| 52 DCHECK(!s_instance); | 52 DCHECK(!s_instance); |
| 53 std::unique_ptr<ScopedEventQueue> instance = wrapUnique(new ScopedEventQueue); | 53 std::unique_ptr<ScopedEventQueue> instance = |
| 54 WTF::wrapUnique(new ScopedEventQueue); |
| 54 s_instance = instance.release(); | 55 s_instance = instance.release(); |
| 55 } | 56 } |
| 56 | 57 |
| 57 void ScopedEventQueue::enqueueEventDispatchMediator( | 58 void ScopedEventQueue::enqueueEventDispatchMediator( |
| 58 EventDispatchMediator* mediator) { | 59 EventDispatchMediator* mediator) { |
| 59 if (shouldQueueEvents()) | 60 if (shouldQueueEvents()) |
| 60 m_queuedEventDispatchMediators.append(mediator); | 61 m_queuedEventDispatchMediators.append(mediator); |
| 61 else | 62 else |
| 62 dispatchEvent(mediator); | 63 dispatchEvent(mediator); |
| 63 } | 64 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 88 } | 89 } |
| 89 | 90 |
| 90 void ScopedEventQueue::decrementScopingLevel() { | 91 void ScopedEventQueue::decrementScopingLevel() { |
| 91 DCHECK(m_scopingLevel); | 92 DCHECK(m_scopingLevel); |
| 92 m_scopingLevel--; | 93 m_scopingLevel--; |
| 93 if (!m_scopingLevel) | 94 if (!m_scopingLevel) |
| 94 dispatchAllEvents(); | 95 dispatchAllEvents(); |
| 95 } | 96 } |
| 96 | 97 |
| 97 } // namespace blink | 98 } // namespace blink |
| OLD | NEW |