| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 81 } |
| 82 | 82 |
| 83 void DOMWebSocket::EventQueue::dispatch(Event* event) { | 83 void DOMWebSocket::EventQueue::dispatch(Event* event) { |
| 84 switch (m_state) { | 84 switch (m_state) { |
| 85 case Active: | 85 case Active: |
| 86 DCHECK(m_events.isEmpty()); | 86 DCHECK(m_events.isEmpty()); |
| 87 DCHECK(m_target->getExecutionContext()); | 87 DCHECK(m_target->getExecutionContext()); |
| 88 m_target->dispatchEvent(event); | 88 m_target->dispatchEvent(event); |
| 89 break; | 89 break; |
| 90 case Suspended: | 90 case Suspended: |
| 91 m_events.append(event); | 91 m_events.push_back(event); |
| 92 break; | 92 break; |
| 93 case Stopped: | 93 case Stopped: |
| 94 DCHECK(m_events.isEmpty()); | 94 DCHECK(m_events.isEmpty()); |
| 95 // Do nothing. | 95 // Do nothing. |
| 96 break; | 96 break; |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 | 99 |
| 100 bool DOMWebSocket::EventQueue::isEmpty() const { | 100 bool DOMWebSocket::EventQueue::isEmpty() const { |
| 101 return m_events.isEmpty(); | 101 return m_events.isEmpty(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 while (!events.isEmpty()) { | 134 while (!events.isEmpty()) { |
| 135 if (m_state == Stopped || m_state == Suspended) | 135 if (m_state == Stopped || m_state == Suspended) |
| 136 break; | 136 break; |
| 137 DCHECK_EQ(m_state, Active); | 137 DCHECK_EQ(m_state, Active); |
| 138 DCHECK(m_target->getExecutionContext()); | 138 DCHECK(m_target->getExecutionContext()); |
| 139 m_target->dispatchEvent(events.takeFirst()); | 139 m_target->dispatchEvent(events.takeFirst()); |
| 140 // |this| can be stopped here. | 140 // |this| can be stopped here. |
| 141 } | 141 } |
| 142 if (m_state == Suspended) { | 142 if (m_state == Suspended) { |
| 143 while (!m_events.isEmpty()) | 143 while (!m_events.isEmpty()) |
| 144 events.append(m_events.takeFirst()); | 144 events.push_back(m_events.takeFirst()); |
| 145 events.swap(m_events); | 145 events.swap(m_events); |
| 146 } | 146 } |
| 147 } | 147 } |
| 148 | 148 |
| 149 void DOMWebSocket::EventQueue::resumeTimerFired(TimerBase*) { | 149 void DOMWebSocket::EventQueue::resumeTimerFired(TimerBase*) { |
| 150 DCHECK_EQ(m_state, Suspended); | 150 DCHECK_EQ(m_state, Suspended); |
| 151 m_state = Active; | 151 m_state = Active; |
| 152 dispatchQueuedEvents(); | 152 dispatchQueuedEvents(); |
| 153 } | 153 } |
| 154 | 154 |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 | 864 |
| 865 DEFINE_TRACE(DOMWebSocket) { | 865 DEFINE_TRACE(DOMWebSocket) { |
| 866 visitor->trace(m_channel); | 866 visitor->trace(m_channel); |
| 867 visitor->trace(m_eventQueue); | 867 visitor->trace(m_eventQueue); |
| 868 WebSocketChannelClient::trace(visitor); | 868 WebSocketChannelClient::trace(visitor); |
| 869 EventTargetWithInlineData::trace(visitor); | 869 EventTargetWithInlineData::trace(visitor); |
| 870 SuspendableObject::trace(visitor); | 870 SuspendableObject::trace(visitor); |
| 871 } | 871 } |
| 872 | 872 |
| 873 } // namespace blink | 873 } // namespace blink |
| OLD | NEW |