| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 namespace blink { | 65 namespace blink { |
| 66 | 66 |
| 67 DOMWebSocket::EventQueue::EventQueue(EventTarget* target) | 67 DOMWebSocket::EventQueue::EventQueue(EventTarget* target) |
| 68 : m_state(Active) | 68 : m_state(Active) |
| 69 , m_target(target) | 69 , m_target(target) |
| 70 , m_resumeTimer(this, &EventQueue::resumeTimerFired) { } | 70 , m_resumeTimer(this, &EventQueue::resumeTimerFired) { } |
| 71 | 71 |
| 72 DOMWebSocket::EventQueue::~EventQueue() { stop(); } | 72 DOMWebSocket::EventQueue::~EventQueue() { stop(); } |
| 73 | 73 |
| 74 void DOMWebSocket::EventQueue::dispatch(PassRefPtrWillBeRawPtr<Event> event) | 74 void DOMWebSocket::EventQueue::dispatch(RawPtr<Event> event) |
| 75 { | 75 { |
| 76 switch (m_state) { | 76 switch (m_state) { |
| 77 case Active: | 77 case Active: |
| 78 ASSERT(m_events.isEmpty()); | 78 ASSERT(m_events.isEmpty()); |
| 79 ASSERT(m_target->executionContext()); | 79 ASSERT(m_target->executionContext()); |
| 80 m_target->dispatchEvent(event); | 80 m_target->dispatchEvent(event); |
| 81 break; | 81 break; |
| 82 case Suspended: | 82 case Suspended: |
| 83 m_events.append(event); | 83 m_events.append(event); |
| 84 break; | 84 break; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 m_state = Stopped; | 119 m_state = Stopped; |
| 120 m_resumeTimer.stop(); | 120 m_resumeTimer.stop(); |
| 121 m_events.clear(); | 121 m_events.clear(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 void DOMWebSocket::EventQueue::dispatchQueuedEvents() | 124 void DOMWebSocket::EventQueue::dispatchQueuedEvents() |
| 125 { | 125 { |
| 126 if (m_state != Active) | 126 if (m_state != Active) |
| 127 return; | 127 return; |
| 128 | 128 |
| 129 WillBeHeapDeque<RefPtrWillBeMember<Event>> events; | 129 HeapDeque<Member<Event>> events; |
| 130 events.swap(m_events); | 130 events.swap(m_events); |
| 131 while (!events.isEmpty()) { | 131 while (!events.isEmpty()) { |
| 132 if (m_state == Stopped || m_state == Suspended) | 132 if (m_state == Stopped || m_state == Suspended) |
| 133 break; | 133 break; |
| 134 ASSERT(m_state == Active); | 134 ASSERT(m_state == Active); |
| 135 ASSERT(m_target->executionContext()); | 135 ASSERT(m_target->executionContext()); |
| 136 m_target->dispatchEvent(events.takeFirst()); | 136 m_target->dispatchEvent(events.takeFirst()); |
| 137 // |this| can be stopped here. | 137 // |this| can be stopped here. |
| 138 } | 138 } |
| 139 if (m_state == Suspended) { | 139 if (m_state == Suspended) { |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 DEFINE_TRACE(DOMWebSocket) | 713 DEFINE_TRACE(DOMWebSocket) |
| 714 { | 714 { |
| 715 visitor->trace(m_channel); | 715 visitor->trace(m_channel); |
| 716 visitor->trace(m_eventQueue); | 716 visitor->trace(m_eventQueue); |
| 717 WebSocketChannelClient::trace(visitor); | 717 WebSocketChannelClient::trace(visitor); |
| 718 RefCountedGarbageCollectedEventTargetWithInlineData<DOMWebSocket>::trace(vis
itor); | 718 RefCountedGarbageCollectedEventTargetWithInlineData<DOMWebSocket>::trace(vis
itor); |
| 719 ActiveDOMObject::trace(visitor); | 719 ActiveDOMObject::trace(visitor); |
| 720 } | 720 } |
| 721 | 721 |
| 722 } // namespace blink | 722 } // namespace blink |
| OLD | NEW |