| 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 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 class EventDispatchMediator; | 43 class EventDispatchMediator; |
| 44 | 44 |
| 45 class CORE_EXPORT ScopedEventQueue { | 45 class CORE_EXPORT ScopedEventQueue { |
| 46 WTF_MAKE_NONCOPYABLE(ScopedEventQueue); USING_FAST_MALLOC(ScopedEventQueue); | 46 WTF_MAKE_NONCOPYABLE(ScopedEventQueue); USING_FAST_MALLOC(ScopedEventQueue); |
| 47 public: | 47 public: |
| 48 ~ScopedEventQueue(); | 48 ~ScopedEventQueue(); |
| 49 | 49 |
| 50 void enqueueEventDispatchMediator(PassRefPtrWillBeRawPtr<EventDispatchMediat
or>); | 50 void enqueueEventDispatchMediator(RawPtr<EventDispatchMediator>); |
| 51 void dispatchAllEvents(); | 51 void dispatchAllEvents(); |
| 52 static ScopedEventQueue* instance(); | 52 static ScopedEventQueue* instance(); |
| 53 | 53 |
| 54 void incrementScopingLevel(); | 54 void incrementScopingLevel(); |
| 55 void decrementScopingLevel(); | 55 void decrementScopingLevel(); |
| 56 bool shouldQueueEvents() const { return m_scopingLevel > 0; } | 56 bool shouldQueueEvents() const { return m_scopingLevel > 0; } |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 ScopedEventQueue(); | 59 ScopedEventQueue(); |
| 60 static void initialize(); | 60 static void initialize(); |
| 61 void dispatchEvent(PassRefPtrWillBeRawPtr<EventDispatchMediator>) const; | 61 void dispatchEvent(RawPtr<EventDispatchMediator>) const; |
| 62 | 62 |
| 63 WillBePersistentHeapVector<RefPtrWillBeMember<EventDispatchMediator>> m_queu
edEventDispatchMediators; | 63 PersistentHeapVector<Member<EventDispatchMediator>> m_queuedEventDispatchMed
iators; |
| 64 unsigned m_scopingLevel; | 64 unsigned m_scopingLevel; |
| 65 | 65 |
| 66 static ScopedEventQueue* s_instance; | 66 static ScopedEventQueue* s_instance; |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 class EventQueueScope { | 69 class EventQueueScope { |
| 70 WTF_MAKE_NONCOPYABLE(EventQueueScope); | 70 WTF_MAKE_NONCOPYABLE(EventQueueScope); |
| 71 STACK_ALLOCATED(); | 71 STACK_ALLOCATED(); |
| 72 public: | 72 public: |
| 73 EventQueueScope() { ScopedEventQueue::instance()->incrementScopingLevel(); } | 73 EventQueueScope() { ScopedEventQueue::instance()->incrementScopingLevel(); } |
| 74 ~EventQueueScope() { ScopedEventQueue::instance()->decrementScopingLevel();
} | 74 ~EventQueueScope() { ScopedEventQueue::instance()->decrementScopingLevel();
} |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 } // namespace blink | 77 } // namespace blink |
| 78 | 78 |
| 79 #endif // ScopedEventQueue_h | 79 #endif // ScopedEventQueue_h |
| OLD | NEW |