| 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 | 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 21 matching lines...) Expand all Loading... |
| 32 #include "core/frame/SuspendableTimer.h" | 32 #include "core/frame/SuspendableTimer.h" |
| 33 | 33 |
| 34 namespace blink { | 34 namespace blink { |
| 35 | 35 |
| 36 class DOMWindowEventQueueTimer : public SuspendableTimer { | 36 class DOMWindowEventQueueTimer : public SuspendableTimer { |
| 37 WTF_MAKE_NONCOPYABLE(DOMWindowEventQueueTimer); | 37 WTF_MAKE_NONCOPYABLE(DOMWindowEventQueueTimer); |
| 38 public: | 38 public: |
| 39 DOMWindowEventQueueTimer(DOMWindowEventQueue* eventQueue, ExecutionContext*
context) | 39 DOMWindowEventQueueTimer(DOMWindowEventQueue* eventQueue, ExecutionContext*
context) |
| 40 : SuspendableTimer(context) | 40 : SuspendableTimer(context) |
| 41 , m_eventQueue(eventQueue) { } | 41 , m_eventQueue(eventQueue) { } |
| 42 void trace(Visitor* visitor) { visitor->trace(m_eventQueue); } | |
| 43 | 42 |
| 44 private: | 43 private: |
| 45 virtual void fired() { m_eventQueue->pendingEventTimerFired(); } | 44 virtual void fired() { m_eventQueue->pendingEventTimerFired(); } |
| 46 | 45 |
| 47 RawPtr<DOMWindowEventQueue> m_eventQueue; | 46 RawPtr<DOMWindowEventQueue> m_eventQueue; |
| 48 }; | 47 }; |
| 49 | 48 |
| 50 PassRefPtr<DOMWindowEventQueue> DOMWindowEventQueue::create(ExecutionContext* co
ntext) | 49 PassRefPtr<DOMWindowEventQueue> DOMWindowEventQueue::create(ExecutionContext* co
ntext) |
| 51 { | 50 { |
| 52 return adoptRef(new DOMWindowEventQueue(context)); | 51 return adoptRef(new DOMWindowEventQueue(context)); |
| 53 } | 52 } |
| 54 | 53 |
| 55 DOMWindowEventQueue::DOMWindowEventQueue(ExecutionContext* context) | 54 DOMWindowEventQueue::DOMWindowEventQueue(ExecutionContext* context) |
| 56 : m_pendingEventTimer(adoptPtr(new DOMWindowEventQueueTimer(this, context))) | 55 : m_pendingEventTimer(adoptPtr(new DOMWindowEventQueueTimer(this, context))) |
| 57 , m_isClosed(false) | 56 , m_isClosed(false) |
| 58 { | 57 { |
| 59 m_pendingEventTimer->suspendIfNeeded(); | 58 m_pendingEventTimer->suspendIfNeeded(); |
| 60 } | 59 } |
| 61 | 60 |
| 62 DOMWindowEventQueue::~DOMWindowEventQueue() | 61 DOMWindowEventQueue::~DOMWindowEventQueue() |
| 63 { | 62 { |
| 64 } | 63 } |
| 65 | 64 |
| 66 void DOMWindowEventQueue::trace(Visitor* visitor) | |
| 67 { | |
| 68 #if ENABLE(OILPAN) | |
| 69 visitor->trace(m_pendingEventTimer); | |
| 70 visitor->trace(m_queuedEvents); | |
| 71 #endif | |
| 72 EventQueue::trace(visitor); | |
| 73 } | |
| 74 | |
| 75 bool DOMWindowEventQueue::enqueueEvent(PassRefPtr<Event> event) | 65 bool DOMWindowEventQueue::enqueueEvent(PassRefPtr<Event> event) |
| 76 { | 66 { |
| 77 if (m_isClosed) | 67 if (m_isClosed) |
| 78 return false; | 68 return false; |
| 79 | 69 |
| 80 ASSERT(event->target()); | 70 ASSERT(event->target()); |
| 81 | 71 |
| 82 bool wasAdded = m_queuedEvents.add(event).isNewEntry; | 72 bool wasAdded = m_queuedEvents.add(event).isNewEntry; |
| 83 ASSERT_UNUSED(wasAdded, wasAdded); // It should not have already been in the
list. | 73 ASSERT_UNUSED(wasAdded, wasAdded); // It should not have already been in the
list. |
| 84 | 74 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 void DOMWindowEventQueue::dispatchEvent(PassRefPtr<Event> event) | 122 void DOMWindowEventQueue::dispatchEvent(PassRefPtr<Event> event) |
| 133 { | 123 { |
| 134 EventTarget* eventTarget = event->target(); | 124 EventTarget* eventTarget = event->target(); |
| 135 if (eventTarget->toDOMWindow()) | 125 if (eventTarget->toDOMWindow()) |
| 136 eventTarget->toDOMWindow()->dispatchEvent(event, nullptr); | 126 eventTarget->toDOMWindow()->dispatchEvent(event, nullptr); |
| 137 else | 127 else |
| 138 eventTarget->dispatchEvent(event); | 128 eventTarget->dispatchEvent(event); |
| 139 } | 129 } |
| 140 | 130 |
| 141 } | 131 } |
| OLD | NEW |