| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 public: | 144 public: |
| 145 static EventQueue* create(EventTarget* target) | 145 static EventQueue* create(EventTarget* target) |
| 146 { | 146 { |
| 147 return new EventQueue(target); | 147 return new EventQueue(target); |
| 148 } | 148 } |
| 149 ~EventQueue(); | 149 ~EventQueue(); |
| 150 | 150 |
| 151 // Dispatches the event if this queue is active. | 151 // Dispatches the event if this queue is active. |
| 152 // Queues the event if this queue is suspended. | 152 // Queues the event if this queue is suspended. |
| 153 // Does nothing otherwise. | 153 // Does nothing otherwise. |
| 154 void dispatch(PassRefPtrWillBeRawPtr<Event> /* event */); | 154 void dispatch(RawPtr<Event> /* event */); |
| 155 | 155 |
| 156 bool isEmpty() const; | 156 bool isEmpty() const; |
| 157 | 157 |
| 158 void suspend(); | 158 void suspend(); |
| 159 void resume(); | 159 void resume(); |
| 160 void stop(); | 160 void stop(); |
| 161 | 161 |
| 162 DECLARE_TRACE(); | 162 DECLARE_TRACE(); |
| 163 | 163 |
| 164 private: | 164 private: |
| 165 enum State { | 165 enum State { |
| 166 Active, | 166 Active, |
| 167 Suspended, | 167 Suspended, |
| 168 Stopped, | 168 Stopped, |
| 169 }; | 169 }; |
| 170 | 170 |
| 171 explicit EventQueue(EventTarget*); | 171 explicit EventQueue(EventTarget*); |
| 172 | 172 |
| 173 // Dispatches queued events if this queue is active. | 173 // Dispatches queued events if this queue is active. |
| 174 // Does nothing otherwise. | 174 // Does nothing otherwise. |
| 175 void dispatchQueuedEvents(); | 175 void dispatchQueuedEvents(); |
| 176 void resumeTimerFired(Timer<EventQueue>*); | 176 void resumeTimerFired(Timer<EventQueue>*); |
| 177 | 177 |
| 178 State m_state; | 178 State m_state; |
| 179 RawPtrWillBeMember<EventTarget> m_target; | 179 Member<EventTarget> m_target; |
| 180 WillBeHeapDeque<RefPtrWillBeMember<Event>> m_events; | 180 HeapDeque<Member<Event>> m_events; |
| 181 Timer<EventQueue> m_resumeTimer; | 181 Timer<EventQueue> m_resumeTimer; |
| 182 }; | 182 }; |
| 183 | 183 |
| 184 enum WebSocketSendType { | 184 enum WebSocketSendType { |
| 185 WebSocketSendTypeString, | 185 WebSocketSendTypeString, |
| 186 WebSocketSendTypeArrayBuffer, | 186 WebSocketSendTypeArrayBuffer, |
| 187 WebSocketSendTypeArrayBufferView, | 187 WebSocketSendTypeArrayBufferView, |
| 188 WebSocketSendTypeBlob, | 188 WebSocketSendTypeBlob, |
| 189 WebSocketSendTypeMax, | 189 WebSocketSendTypeMax, |
| 190 }; | 190 }; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 String m_subprotocol; | 239 String m_subprotocol; |
| 240 String m_extensions; | 240 String m_extensions; |
| 241 | 241 |
| 242 Member<EventQueue> m_eventQueue; | 242 Member<EventQueue> m_eventQueue; |
| 243 Timer<DOMWebSocket> m_bufferedAmountConsumeTimer; | 243 Timer<DOMWebSocket> m_bufferedAmountConsumeTimer; |
| 244 }; | 244 }; |
| 245 | 245 |
| 246 } // namespace blink | 246 } // namespace blink |
| 247 | 247 |
| 248 #endif // DOMWebSocket_h | 248 #endif // DOMWebSocket_h |
| OLD | NEW |